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
// You can copy and paste this into your browser's developer console to navigate through the JSON response | |
function espn(path, key, callback) { | |
var xhr = new XMLHttpRequest(); | |
xhr.open('GET', 'http://api.espn.com/v1' + path + '?apikey=' + key); | |
xhr.addEventListener('readystatechange', function() { | |
if (xhr.readyState === 4 && xhr.status === 200) { | |
callback(JSON.parse(xhr.responseText)); | |
} | |
}); |
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
/* BUILD: gcc -lcrypto -lssl http_get.c -o http_get */ | |
/* USAGE: ./http_get www.google.com */ | |
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <sys/types.h> | |
#include <sys/socket.h> | |
#include <netdb.h> |
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
// /r/dailyprogrammer challenge #169 (http://redd.it/29od55) | |
// Word list from https://dotnetperls-controls.googlecode.com/files/enable1.txt | |
var wordlist = require('fs').readFileSync('./dict', 'utf8').split(/\n+/) | |
.filter(function(e) { return e; }); | |
console.log(challenge169(process.argv[2] || 'A oweaib who fprd not zfqzh challenges should mt ewlst to kze', wordlist)); | |
function challenge169(string, wordlist) { | |
var shift = function(characters, start, end) { | |
for (var n = start, _ret = []; n < end; n++) { |
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
#include <stdio.h> | |
#include <sys/stat.h> | |
int main(int argc, char *argv[]) { | |
if (argc == 1) { | |
return 0; | |
} | |
int tc = 0, |
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 XMLHttpRequest = function() { | |
var http = require('http'), | |
https = require('https'); | |
var method, host, port, path, protocol, | |
request, xhr, callEventListeners, | |
statusCodes, syncFinished, | |
lastReadyState = 0, | |
listeners = ['readystatechange', 'abort', 'error', 'loadend', 'progress', 'load'], |
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
#include <iostream> | |
class Bitset { | |
private: | |
char *data; | |
size_t b_size; | |
public: | |
Bitset(size_t s) : b_size(s), data(new char[b_size + 1]) { | |
this->reset(); |
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
#include <iostream> | |
#define BLOCK 2048 | |
template <class T> | |
class Array { | |
private: | |
T *data; | |
size_t cap; | |
size_t max_cap; |
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> | |
<html> | |
<head> | |
<title>Canvas Clock</title> | |
<style> | |
body, html { | |
background-color: #1b1d1e; | |
} | |
#clock { | |
position: absolute; |
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 background script is needed in order to store | |
// persistent objects in memory. Content scripts | |
// run a seperate instance for each open tab in Chrome. | |
var nextLink = (function(linkArray) { | |
// Initialize a copy of the original links | |
var currentSet = linkArray.slice(); | |
return function() { |
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
log = console.log.bind(console); | |
var Heap = function(fn) { | |
this.fn = fn || function(e) { | |
return e; | |
}; | |
this.items = []; | |
}; | |
Heap.prototype = { |