View shota.rb
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) } |
View struct_fn.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
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; | |
} |
View lazy.js
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 |
View pageshow.html
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> |
View 2048.clj
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)) |
View nth-last-child.html
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"> | |
<style> | |
li:nth-last-child(3) { background-color: red; } | |
</style> | |
</head> | |
<body> | |
<div id="container"> |
View affix-sandbox.html
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> | |
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> | |
<style> | |
#text {height: 100%; background-color: pink} | |
#header { background-color: red; } | |
#header.affix { |
View event_target.js
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
// draft | |
(function(exports) { | |
var ArrayProto = Array.prototype; | |
var nativeSlice = ArrayProto.slice, | |
nativeFilter = ArrayProto.filter; | |
/* Internal: filters the collection. (extracted from underscore.js) | |
* |
View .screenrc
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
# http://www.gnu.org/software/screen/manual/html_node/Command-Summary.html#Command-Summary | |
# Turn off start message | |
startup_message off | |
termcapinfo rxvt-unicode 'hs:ts=\E]2;:fs=\007:ds=\E]2;screen\007' | |
term screen | |
# Message to display in the status line when activity is detected in a | |
# monitored window. |
View core.clj
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
(ns stubhttp.core | |
(:require [ring.adapter.jetty :as r] | |
[ring.middleware.json :as json] | |
[ring.util.response :as response])) | |
(def state (atom {})) | |
(defn register! [{uri "uri" {:strs [status headers body]} "response"}] | |
(swap! state assoc uri {:status status :headers headers :body body})) |
OlderNewer