A train runs along this (randomly generated) track.
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
# Brutal hack to make all string/text columns alert("hack") if they're not | |
# being properly escaped. | |
models = Dir['app/models/*.rb'].map { |path| | |
name = File.basename(path, '.*') | |
name.camelize.constantize | |
}.reject { |klass| | |
klass.superclass != ActiveRecord::Base | |
} |
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 parents(node) { | |
var nodes = [node] | |
for (; node; node = node.parentNode) { | |
nodes.unshift(node) | |
} | |
return nodes | |
} | |
function commonAncestor(node1, node2) { | |
var parents1 = parents(node1) |
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 { CALL_API } from 'redux-api-middleware' | |
export function fetchLocations() { | |
return { | |
[CALL_API]: { | |
endpoint: 'http://api.somesite.com/api/locations', | |
method: 'GET', | |
// Don't have to manually add the Authorization header to every request. | |
headers: { 'Content-Type': 'application/json' }, | |
types: ['REQUEST', 'SUCCESS', 'FAILURE'] |
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
Rehearsal ---------------------------------------- | |
gsub 0.013451 0.000356 0.013807 ( 0.013817) | |
sub 0.005154 0.000086 0.005240 ( 0.005302) | |
------------------------------- total: 0.019047sec | |
user system total real | |
gsub 0.011792 0.000351 0.012143 ( 0.012186) | |
sub 0.003583 0.000001 0.003584 ( 0.003583) |
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
# Thankyou Bartosz Blimke! | |
# https://twitter.com/bartoszblimke/status/198391214247124993 | |
module LastRequest | |
def last_request | |
@last_request | |
end | |
def last_request=(request_signature) | |
@last_request = request_signature |
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
height: 90 |
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> | |
<meta charset="utf-8"> | |
<style> | |
.path { | |
fill: transparent; | |
stroke: #ddd; | |
stroke-dasharray: 2 4; | |
stroke-width: 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
import { CALL_API } from 'redux-api-middleware' | |
export default function({ getState }) { | |
return function(next) { | |
return function(action) { | |
const callApi = action[CALL_API] | |
if (callApi) { | |
const { authToken } = getState() |
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
# .___.__ | |
# __| _/|__| ____ ____ | |
# / __ | | |/ \ / ___\ | |
# / /_/ | | | | \/ /_/ > | |
# \____ | |__|___| /\___ / | |
# \/ \//_____/ | |
# | |
# Make a "ding" sound on your Mac! Useful for notifying you when a command | |
# line script has finished. | |
# |
NewerOlder