This file contains hidden or 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
# Rails example | |
recipe :ignore | |
ignore(/(^tmp|jpg|png|gif|css|\.DS_Store)$/) | |
recipe :rails | |
process do |files| | |
Ruby.run_tests(files.take_and_map do |file| | |
case file |
This file contains hidden or 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 'eventmachine' | |
EM.run do | |
SEKRET_SAUCE = EM.attach( | |
open(RUBY_PLATFORM =~ /mswin|mingw/ ? 'NUL:' : '/dev/null', 'w') | |
) | |
EM.start_server('0.0.0.0', 80, Module.new do | |
def post_init; proxy_incoming_to(SEKRET_SAUCE); end | |
end) | |
end |
This file contains hidden or 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
class Job | |
LAZY_ENVIRONMENTS = %w(development test) | |
# Add a job to the queue. If we're currently running in any of the | |
# environments listed in +LAZY_ENVIRONMENTS+ then it automatically performs | |
# the job. | |
def self.enqueue(*args) | |
if LAZY_ENVIRONMENTS.include? Rails.env | |
Rails.logger.debug "Performing job instead of enqueuing: #{name}" | |
perform(*args) |
This file contains hidden or 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 keyboard shortcut to run a shell script with Alfred or Quicksilver, and point it at | |
/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend |
This file contains hidden or 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
// Jake is like Rake for nodejs https://github.com/mde/jake | |
// | |
// Assumes that Jake will be run in the root of the web app with coffee files in /js/ and | |
// a single app.less file in /css/ that can include references to other .less files | |
// | |
//requires | |
var sys = require('util'); | |
var execute = require('child_process').exec; | |
var fs = require('fs'); |
This file contains hidden or 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
expr -- (void)printf("[%s, %s]\n",(char *) object_getClassName(*(long*)($esp+4)), (char *) *(long *)($esp+8) ) |
This file contains hidden or 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
-- Based on http://pgsql.tapoueh.org/site/html/news/20080131.bloat.html | |
-- see that linked version for detailed table and index listings on where that bloat is | |
SELECT pg_size_pretty(SUM(bs*(relpages-otta))::bigint) AS wastedsize, | |
pg_size_pretty(SUM(CASE WHEN ipages < iotta THEN 0 ELSE bs*(ipages-iotta) END)::bigint) AS wastedisize | |
FROM ( | |
SELECT | |
schemaname, tablename, cc.reltuples, cc.relpages, bs, | |
CEIL((cc.reltuples*((datahdr+ma- | |
(CASE WHEN datahdr%ma=0 THEN ma ELSE datahdr%ma END))+nullhdr2+4))/(bs-20::float)) AS otta, | |
COALESCE(c2.relname,'?') AS iname, COALESCE(c2.reltuples,0) AS ituples, COALESCE(c2.relpages,0) AS ipages, |
This file contains hidden or 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
div.description a.autolink | |
{ | |
display: inline-block; | |
max-width: 250px; | |
text-overflow: ellipsis; | |
overflow: hidden; | |
} |
This file contains hidden or 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
# Do *not* load any libs here that are *not* part of Ruby’s standard-lib. Ever. | |
desc "Install all dependencies" | |
task :bootstrap do | |
if system('which bundle') | |
sh "bundle install" | |
sh "git submodule update --init" | |
# etc | |
else | |
$stderr.puts "\033[0;31m[!] Please install the bundler gem manually: $ [sudo] gem install bundler\e[0m" |
This file contains hidden or 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 Dispatch | |
func dispatch_async(queue: dispatch_queue_t = dispatch_get_main_queue(), block: dispatch_block_t) { | |
Dispatch.dispatch_async(queue, block) | |
} | |
dispatch_async { | |
// Update the UI | |
} |
OlderNewer