This file contains hidden or 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 http = require('http'); | |
http.createServer(function (req,res ){ | |
console.log(req); | |
res.writeHead(200,{'content-type':'text/html'}); | |
res.end('<html><body><h1>HELLO WORLD</h1></body></html>'); | |
}).listen(7777,'localhost'); |
This file contains hidden or 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
#!/usr/bin/env bash | |
for voice in $(say -v ? | perl -pe 's/^(.*?)\s.*$/$1/'); do quote=$(curl -s http://www.iheartquotes.com/api/v1/random?source=starwars | perl -pe 's/\[starwars.*?$//g'); echo $voice; say -v $voice $quote; done |
This file contains hidden or 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 fibonacci number is defined as the sum of the previous 2 numbers in the sequence. | |
By definition, the first 2 fibonacci numbers are 1 and 1. | |
Thus the sequence goes: 1,1,2,3,5,8,13,21,34...n-2,n-1,n | |
or more plainly put: | |
Fibonacci(n) = Fibonacci(n-1) + Fibonacci(n-2) | |
Below are 4 different solutions to calculate the Nth number in the fibonacci sequence | |
*/ |
This file contains hidden or 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
<html> | |
<head> | |
<script type='text/javascript' src='https://www.google.com/jsapi'></script> | |
<script type='text/javascript'> | |
google.load('visualization', '1', {'packages': ['geochart']}); | |
google.setOnLoadCallback(drawMarkersMap); | |
function drawMarkersMap() { | |
var data = google.visualization.arrayToDataTable([ | |
['State', 'Population'], |
This file contains hidden or 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
javascript: (function() { | |
var u = document.location.href; | |
if(!u) { alert('Try using on Youtube'); return; } | |
if(u.indexOf('youtube.com') == -1) { | |
alert('Try using on Youtube'); return; | |
} | |
var m = u.match(/v=([\w\d]+)/); | |
if(!m) { |
This file contains hidden or 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 arr = d3.nest() | |
.key(function(d) { | |
var dt = new Date(d.date); | |
var ret = [dt.getUTCFullYear(),dt.getUTCMonth()+1,dt.getUTCDate()]; | |
return ret.join('-'); | |
}) | |
.rollup(function(d) { | |
var sum = 0; | |
for(var i = 0; i < d.length; ++i) { | |
sum+= d[i].value; |
This file contains hidden or 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
add_action('wp_head','inject_javascript'); | |
function inject_javascript() { | |
?> | |
<!-- mfunc | |
$uid = uniqid (); | |
echo '<!-- Plugin v.01 ID: -->'; | |
echo '<!--'. $uid .'-->'; | |
echo "\n"; | |
--> | |
<!--/mfunc --> |
This file contains hidden or 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
{"sports" :[{"name" :"basketball","id" :40,"leagues" :[{"name" :"National Basketball Assoc.","abbreviation" :"nba","id" :46,"groupId" :7,"shortName" :"NBA","teams" :[{"id" :1,"location" :"Atlanta","name" :"Hawks","abbreviation" :"ATL","color" :"002B5C","links" :{"api" :{"teams" :{"href" :"http://api.espn.com/v1/sports/basketball/nba/teams/1"},"news" :{"href" :"http://api.espn.com/v1/sports/basketball/nba/teams/1/news"},"notes" :{"href" :"http://api.espn.com/v1/sports/basketball/nba/teams/1/news/notes"}},"web" :{"teams" :{"href" :"http://espn.go.com/nba/team/_/name/atl/atlanta-hawks?ex_cid=espnapi_public"}},"mobile" :{"teams" :{"href" :"http://m.espn.go.com/nba/clubhouse?teamId=1&ex_cid=espnapi_public"}}}},{"id" :2,"location" :"Boston","name" :"Celtics","abbreviation" :"BOS","color" :"006532","links" :{"api" :{"teams" :{"href" :"http://api.espn.com/v1/sports/basketball/nba/teams/2"},"news" :{"href" :"http://api.espn.com/v1/sports/basketball/nba/teams/2/news"},"notes" :{"href" :"http://api.espn.com/v1/sports/ba |
This file contains hidden or 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
for(int i = 1; i <= 100; ++i) | |
{ | |
if (i % 15 == 0) | |
{ | |
"FizzBuzz".Dump(); | |
} | |
else if(i % 3 == 0) | |
{ "Fizz".Dump();} | |
else if( i % 5 == 0) | |
{ "Buzz".Dump();} |