// jQuery
$(document).ready(function() {
// code
})| import { store } from './fileWhereStoreLives'; | |
| // add this code in your app's entry point file to | |
| // set localStorage when navigating away from app | |
| window.onbeforeunload = function(e) { | |
| const state = store.getState(); | |
| localStorage.setItem( | |
| 'local-storage-key', | |
| JSON.stringify(state.stateYouWantToPersist) | |
| ); |
| /* | |
| * http://stackoverflow.com/questions/123999/how-to-tell-if-a-dom-element-is-visible-in-the-current-viewport/26039199#26039199 | |
| */ | |
| function isElementPartiallyInViewport(el) | |
| { | |
| //special bonus for those using jQuery | |
| if (typeof jQuery !== 'undefined' && el instanceof jQuery) el = el[0]; | |
| var rect = el.getBoundingClientRect(); | |
| // DOMRect { x: 8, y: 8, width: 100, height: 100, top: 8, right: 108, bottom: 108, left: 8 } |
| module.exports = { | |
| config: { | |
| // default font size in pixels for all tabs | |
| fontSize: 12, | |
| // font family with optional fallbacks | |
| fontFamily: 'Menlo, "DejaVu Sans Mono", Consolas, "Lucida Console", monospace', | |
| // terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk) | |
| cursorColor: 'rgba(248,28,229,0.8)', |
| import { format } from 'url'; | |
| import { STATUS_CODES } from 'http'; | |
| import uppercamelcase from 'uppercamelcase'; | |
| class HTTPError extends Error { | |
| constructor(code, message, extras) { | |
| super(message || STATUS_CODES[code]); | |
| if (arguments.length >= 3 && extras) { | |
| Object.assign(this, extras); | |
| } |
| DROP TABLE currency; | |
| -- Create table variable | |
| CREATE TABLE currency ( | |
| name VARCHAR(20), | |
| code VARCHAR(3), | |
| symbol VARCHAR(5) | |
| ); | |
| ALTER TABLE currency CONVERT TO CHARACTER SET utf8; |
| # Compiled source # | |
| ################### | |
| *.com | |
| *.class | |
| *.dll | |
| *.exe | |
| *.o | |
| *.so | |
| # Packages # |
My typical setup for a development box in VirtualBox uses two NICs. The first uses NAT to allow the box to communicate with the outside world through my host computer’s network connection. (NAT is the default, so shouldn't require any setup.) The second is a "host-only" connection that allows my host and guest to interact.
To create a host-only connection in VirtualBox, start by opening the preferences in VirtualBox. Go to the "Network" tab, and addd a Host-only Network. Modify the host-only network, and disable DHCP. Make a note of the IP address. (Feel free to set the IP address as well, if you like.)
Next, assign this host-only adapter to the virtual machine. Select the VM and press "Settings". Go to the "Network" tab, and select "Adpater 2". Enable the adapter, set it to a "Host-only Adapter", and select the adpater you created above.
| // set-up a connection between the client and the server | |
| var socket = io.connect(); | |
| // let's assume that the client page, once rendered, knows what room it wants to join | |
| var room = "abc123"; | |
| socket.on('connect', function() { | |
| // Connected, let's sign-up for to receive messages for this room | |
| socket.emit('room', room); | |
| }); |