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 path = require('path'); | |
// require(X) from module at path Y | |
function resolve(x, y) { | |
// 1. If X is a core module, | |
// a. return the core module | |
// b. STOP | |
if (isCoreModule(x)) { | |
console.log(x + " is a core module"); | |
} |
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 reverse(a) { | |
return a.length ? reverse(a.slice(1)).concat([a[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
;(function(window, undefined) { | |
/** | |
* some utitlity to help handling compatibility issues | |
*/ | |
var util = { | |
/** | |
* Cross-browser event handler support. | |
* @param {Object} elem the event target | |
* @param {Object} type event object | |
* @param {Function} fn event handler |
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 <string.h> | |
int main(void) { | |
char line[30000]; | |
char str[30000]; | |
FILE * pFile = fopen ("myfile.txt" , "r"); | |
/* Avoid buffer overflow by using fgets() */ |
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
import math | |
data = list() | |
f = open("data") | |
for line in f: | |
data.append(float(line)) | |
T = len(data) - 1 |
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> | |
int main(int argc, char *argv[]) { | |
char msg[100]; | |
char *in = "%99[^\n]%*c"; | |
scanf(in, msg); | |
printf("%s\n", msg); | |
return 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
function reverseChild(pare) { | |
if (!pare.children || pare.children.length < 2) return; | |
var emptyParent = document.createElement(pare.nodeName); | |
var detachedParent = pare.parentNode.replaceChild(emptyParent, pare); | |
var emptyLeft = document.createElement(detachedParent.children[0].nodeName); | |
var emptyRight = document.createElement(detachedParent.children[0].nodeName); | |
for (var i = 0, len = detachedParent.children.length; i < Math.floor(len/2); i++) { | |
var left = detachedParent.replaceChild(emptyLeft, detachedParent.children[i]); |
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
// compile me with `gcc -std=c99` or `gcc -std=gnu99` | |
#include <stdio.h> | |
int sum(int n_col; int arr[][n_col], int n_row, int n_col) { | |
int i, j, total = 0; | |
for (i = 0; i < n_row; ++i) { | |
for (j = 0; j < n_col; ++j) { | |
total += arr[i][j]; | |
} |
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 reverse(seq) { | |
if (seq.length > 1) | |
return seq.slice(-1).concat(reverse(seq.slice(0, -1))); | |
else | |
return seq; | |
} |
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
.issue_text { | |
font-family: "CamingoCode", "Fira Mono", menlo, monaco, consolas, monospace; | |
margin-left: 10px; | |
} | |
a:link, | |
a:focus { | |
color: #1281c9; | |
} | |
a:visited { | |
color: #673ab7; |