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
// block test - same as using ruby's Array#detect, but much more long winded | |
- (BOOL (^)(id obj, NSUInteger idx, BOOL *stop))inbro_test:(NSUInteger)inbro_id { | |
return [[^(id obj, NSUInteger idx, BOOL *stop) { | |
if ([obj inbro_id] == inbro_id) { | |
*stop = YES; | |
return YES; | |
} | |
return NO; | |
} copy] autorelease]; | |
} |
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
<script> | |
function appletInitialized(applet) { | |
setTimeout("set_applet_csrf()", 1000); | |
} | |
function set_applet_csrf() { | |
var name = "<%= request_forgery_protection_token %>"; | |
var value = "<%= form_authenticity_token %>"; | |
set_upload_param(name, value); | |
} |
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
<applet archive='/java/jumploader_z.jar' code='jmaster.jumploader.app.JumpLoaderApplet.class' height='400' id='jumpLoaderApplet' mayscript name='jumpLoaderApplet' width='600'> | |
<param name='uc_uploadUrl' value='/upload_video'> | |
<param name='uc_imageEditorEnabled' value='false'> | |
<param name='ac_fireAppletInitialized' value='true'> | |
<param name='uc_requestProperties' value='Cookie=_vod_session=BAh7CSIQX2NzcmZfdG9rZW4jNcVFS2xwQU03UDFGNzNIWGpHNFBIK0kzWmFBZFhJdm5BVDZYb3ZDaTNJY3c9Ig5yZXR1cm5fdG97CToHcHNUOgtzZWFyY2gwOgthY3Rpb24iCmluZGV4OgdpZDAiD3Nlc3Npb25faWQiJTkxMTZkMmFhZGRjYzBhODRkNjJjZmY2MWZkMWQ5MmViIhl3YXJkZW4udXNlci51c2VyLmtleVsHIglVc2VyaQc=--adbc189e2dbb8ef27da5127e9dcdf88cf57ffe7b'> | |
</applet> |
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
Here's what I do: | |
This is Rails 2 | |
pid = fork do | |
%x{RAILS_ENV=#{Rails.env} #{RAILS_ROOT + "/script/runner"} '#{script}'} | |
exit! | |
end | |
Process.detach pid |
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
$ sudo easy_install --upgrade twisted | |
Password: | |
install_dir /Library/Python/2.6/site-packages/ | |
Searching for twisted | |
Reading http://pypi.python.org/simple/twisted/ | |
Reading http://twistedmatrix.com/ | |
Reading http://tmrc.mit.edu/mirror/twisted/Twisted/10.0/ | |
Reading http://www.twistedmatrix.com | |
Reading http://twistedmatrix.com/products/download | |
Reading http://tmrc.mit.edu/mirror/twisted/Twisted/8.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
on run argv | |
set space_number to item 1 of argv | |
tell application "System Events" | |
keystroke space_number using {control down} | |
end tell | |
end run |
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
def four_char_code(s) | |
(s[0].ord << 24) + (s[1].ord << 16) + (s[2].ord << 8) + s[3].ord | |
end | |
system = SBApplication.applicationWithBundleIdentifier("com.apple.SystemEvents") | |
system.send(:"keystroke:using:", space_number.to_s, four_char_code('Kctl')) |
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
# initializers/mongoid.rb | |
# for when files in lib depend on or inherit from other files in lib | |
def do_require(file) | |
begin | |
require file | |
rescue NameError => e | |
e.message =~ /constant (\w+::)*(\w+)$/ | |
if $2 | |
do_require($2.underscore) |
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 | |
require 'totalspaces2' | |
displays = TotalSpaces2.display_list | |
if displays.count != 2 | |
puts "Must have 2 displays attached" | |
exit 1 | |
end |
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"> | |
<link rel="stylesheet" href="http://cmx.io/v/0.1/cmx.css"> | |
<script src="http://cmx.io/v/0.1/cmx.js" charset="utf-8"></script> | |
<style>.cmx-user-scene4 .cmx-text-border .cmx-path {stroke: orange}</style> | |
<body> | |
<div style="max-width:900px; -webkit-transform:rotate(0deg)"> | |
<scene id="scene1" width="300"> | |
<drawing t="translate(0,31)"> |