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
const readline = require('readline') | |
const fs = require('fs') | |
const lineReader = readline.createInterface({ | |
input: fs.createReadStream('/usr/share/dict/words', { encoding: 'utf8' }) | |
}) | |
const word = process.argv[2] | |
if (!word) { |
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
@media (min-width:768px) { | |
.r { | |
clear: left; | |
} | |
.r:before, .r:after { | |
content: ""; | |
display: table; | |
} | |
.r:after { | |
clear: both; |
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 lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Snake</title> | |
</head> | |
<style> | |
.board { | |
width: 300px; | |
height: 300px; |
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 Immutable from 'immutable' | |
import Bacon from 'baconjs' | |
import h from 'virtual-dom/h' | |
import diff from 'virtual-dom/diff' | |
import patch from 'virtual-dom/patch' | |
import createElement from 'virtual-dom/create-element' | |
const INCREMENT = 'INCREMENT' | |
const DECREMENT = 'DECREMENT' |
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
const voidElements = { area:1, base:1, br:1, col:1, command:1, embed:1, hr:1, img:1, input:1, keygen:1, link:1, meta:1, param:1, source:1, track:1, wbr:1 }; | |
function exists (n) { | |
if (n instanceof Array || typeof n === 'string') return n.length > 0; | |
return !!(n === 0 || 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
import React from 'react' | |
// E(String, { attr: val }, ... ReactElement || Atom) -> ReactElement | |
// Allows use of css selector shorthand and concise element creation | |
function E (head, attrs, ... child) { | |
if (typeof head === 'function') return React.createElement(head, attrs, ... child) | |
var i, p, c |
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 u = require('util'); | |
var strings = ["1234", "hello", "hell", "1el", "1235"]; | |
var trie = {}; | |
function insert (trie, str) { | |
var i, ref = trie; |
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 translation of the example on http://nightmare.com/rushing/irken/irken/lang.html | |
;; Type definition follows Haskell's approach | |
(data (tree a) | |
empty | |
(node a (tree a) (tree a))) | |
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 <stdlib.h> | |
#include <string.h> | |
// Usage: ./pals war_and_peace.txt | |
char *readFile(char *filename) { | |
FILE *infile; | |
char *buffer; |
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
#lang racket | |
(require 2htdp/image) | |
(require "../connive/connive.rkt") | |
(:= rate 5) ; amount to mutate each property per generation | |
(:= gen-size 30) ; generation size | |
(:= acceptable-dist 20) ; how close the best of a generation is to ideal to stop evolving | |
(struct state (a o h r g b) #:transparent) |