This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Step 1: Clone repository from GitHub | |
$ git clone https://github.com/ericalli/static-site-boilerplate | |
&& cd static-site-boilerplate && rm -rf .git && git init | |
// Step 2: Install dependencies | |
$ npm install | |
// Step 3: Run the development server | |
$ npm run start | |
// Step 4: Generate production-ready files | |
$ npm run build:dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This is a JavaScript Scratchpad. | |
* | |
* Enter some JavaScript, then Right Click or choose from the Execute Menu: | |
* 1. Run to evaluate the selected text (Cmd-R), | |
* 2. Inspect to bring up an Object Inspector on the result (Cmd-I), or, | |
* 3. Display to insert the result in a comment after the selection. (Cmd-L) | |
*/ | |
(function webpackUniversalModuleDefinition(root,factory){if(typeof exports==='object'&&typeof module==='object') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("a").on('click', function (event) { | |
if (this.hash !== "") { | |
event.preventDefault(); | |
var hash = this.hash; | |
$('html, body').animate({ | |
scrollTop: $(hash).offset().top | |
}, 800, function () { | |
window.location.hash = hash; | |
}); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function triggerEvent(el, type) { | |
if ('createEvent' in document) { | |
// modern browsers, IE9+ | |
var e = document.createEvent('HTMLEvents'); | |
e.initEvent(type, false, true); | |
el.dispatchEvent(e); | |
} else { | |
// IE 8 | |
var e = document.createEventObject(); | |
e.eventType = type; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" | |
xmlns:v="urn:schemas-microsoft-com:vml" | |
xmlns:o="urn:schemas-microsoft-com:office:office" | |
lang="en" xml:lang="en"> | |
<head> | |
<title>Interactive Email Elements</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export PATH=$PATH:/Users/koyanloshe/.npm-packages/bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function onVisibilityChange(el, callback) { | |
var old_visible; | |
return function () { | |
var visible = isElementInViewport(el); | |
if (visible != old_visible) { | |
old_visible = visible; | |
if (typeof callback == 'function') { | |
callback(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# clone repo | |
git clone https://github.com/Microsoft/vscode-react-sample.git react-todo | |
# navigate to repo | |
cd appFolderName | |
# install deps | |
npm install | |
# Run in terminal backend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var net = require('net') | |
var chatServer = net.createServer(), clientList = [] | |
chatServer.on('connection', function(client) { | |
client.name = client.remoteAddress + ':' + client.remotePort client.write('Hi ' + client.name + '!\n'); | |
clientList.push(client) | |
client.on('data', function(data) { broadcast(data, client) | |
}) }) | |
function broadcast(message, client) { for(var i=0;i<clientList.length;i+=1) { | |
if(client !== clientList[i]) { clientList[i].write(client.name + " says " + message) | |
} } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//primary attempt | |
killall node | |
//secondary attempt | |
kill -9 $(ps aux | grep '\snode\s' | awk '{print $2}') |