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
#!/bin/sh | |
export SDK=6.0 | |
buildit() | |
{ | |
target=$1 | |
platform=$2 | |
export CC=/Applications/Xcode.app/Contents/Developer/Platforms/${platform}.platform/Developer/usr/bin/gcc | |
export CFLAGS="-arch ${target} -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/${platform}.platform/Developer/SDKs/${platform}${SDK}.sdk" |
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 capitalize(str) { | |
return str.charAt(0).toUpperCase() + str.substring(1); | |
} | |
function toCamelCase(hyphenated, isLower) { | |
var components = hyphenated.split('-'); | |
for (var i = 0; i < components.length; i++) { | |
if (!(isLower && i === 0)) { | |
components[i] = capitalize(components[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
var http = require('http'); | |
var red = '\u001b[31m'; | |
var reset = '\u001b[0m'; | |
var proxyServer = function (request, response) { | |
var components = request.headers['host'].split(':'); | |
var options = { | |
hostname: components[0], | |
port: parseInt(components[1] || 80), |
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 http = require('http'); | |
var logger = require('./logger'); | |
var PORT = 1337; | |
// | |
// Methods of task execution | |
// | |
function takeItEasy(duration) { | |
return function () { | |
var callee = arguments.callee; |
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
#!/usr/bin/env ruby | |
# encoding: utf-8 | |
# == Synopsis | |
# Requires the terminal-notifier gem ([sudo] gem install terminal-notifier) | |
# growlnotify wrapper to turn Growl alerts into Mountain Lion notifications | |
# Uses growlnotify option syntax to keep your old scripts working with the new shiny. | |
# | |
# If you use Growl via growlnotify in your shell scripting, this script | |
# will replace Growl's alerts with Mountain Lion notifications. |
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
find . \( -name '*.haml' -o -name '*.rb' \) -exec sed -i '' "s/ :\([^ ']*\) => / \1: /g" {} \; |
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
@foo = @parent.foos.build(name: 'Foo') | |
@foo.bars.build(greeting: 'hello') | |
@foo.save | |
@foo.bars.exists? # -> nil | |
@foo.bars.size > 0 #-> true |
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
module DestroyableReadonly | |
extend ActiveSupport::Concern | |
included do | |
before_update :raise_readonly | |
end | |
private | |
def raise_readonly |
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 () { | |
if (location.href.indexOf('taskboards') === -1) return; | |
showResult(accumulateHours()); | |
hookTaskRefreshed(); | |
function hookTaskRefreshed() { | |
window.addEventListener('message', function (e) { | |
if (e.data.type === 'task:refreshed') showResult(accumulateHours()); | |
}); |
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 sorted = ["山田", "佐藤", "鈴木", "石田"].sort().map(function (name) { | |
var code = name.split('').map(function (letter) { | |
return letter.charCodeAt(0); | |
}).join(' '); | |
return name + ' -> ' + code; | |
}); | |
console.log(sorted); |