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
(defn transpose [m] | |
(apply mapv vector m)) | |
(defn rotate-left [m] | |
(apply mapv vector (map reverse m))) | |
(defn- combine [[x y & xs :as row]] | |
(cond (empty? row) nil | |
(nil? y) (list x) | |
(= x y) (cons (* x 2) (combine xs)) |
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>jQuery Snippet</title> | |
</head> | |
<body> | |
<a href="event">event</a> | |
<ul id="container"> | |
</ul> |
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 empty_list() { | |
return null; | |
} | |
// concat :: [[a]] -> [a] | |
function concat(xs) { | |
return foldr(append, empty_list, xs); | |
} | |
// foldr :: (a -> b -> b) -> b -> [a] -> b |
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 Promise(fn) { | |
this.promise = $.Deferred(function(dfd) { | |
fn(dfd.resolve, dfd.fail); | |
}).promise(); | |
} | |
Promise.prototype.then = function(done, fail) { | |
this.promise.then(done, fail); | |
}; |
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>jQuery Snippet</title> | |
</head> | |
<body> | |
<div id="container"></div> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/underscore-contrib/0.1.4/underscore-contrib.min.js"></script> |
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
struct my_struct lookup(int count, const struct my_struct coll[], char value[]) { | |
int i; | |
for (i = 0; i < count; ++i) { | |
if (strcmp(coll[i].attr, value) == 0) { | |
return coll[i]; | |
} | |
} | |
return NULL; | |
} |
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
require 'scanf' | |
def flip(mask, os) | |
os.map { |o| mask ^ o } | |
end | |
Infinity = 1.0/0 | |
def solve(n, l, flows, required_flows) | |
outlets = flows.split(" ").map { |f| f.to_i(2) } |
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, $) { | |
var containers = []; | |
// Public: position a container overlayed close to the target | |
// | |
// container - the container id | |
// callback - a function callback that receives 'container' and 'target' | |
// | |
// Examples | |
// |
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> | |
<meta charset="utf-8"> | |
<title>Hello world</title> | |
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.3.0/pure-min.css"> | |
</head> | |
<body> | |
<div class="pure-g-r" id="layout"> | |
<div class="pure-u-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
# a2enmod headers expires | |
SetEnv no-gzip | |
<LocationMatch "^/assets/.*\.(css|js)$"> | |
RewriteEngine on | |
# Make sure the browser supports gzip encoding before we send it, | |
# and that we have a precompiled .gz version. | |
RewriteCond %{HTTP:Accept-Encoding} \b(x-)?gzip\b |