I hereby claim:
- I am nzaillian on github.
- I am nzaillian (https://keybase.io/nzaillian) on keybase.
- I have a public key whose fingerprint is 8FD2 A81C 5FC8 8010 2AF0 70CD 4580 1CED AC00 074C
To claim this, I am signing this object:
"""Found myself needing to emulate key presses in an application on OS X. The solution was the following:""" | |
import os | |
def press_key(key): | |
cmd = "osascript -e 'tell application \"System Events\" to keystroke \"" + key + "\"'" | |
os.system(cmd) |
/* | |
Example usage: | |
var fj:FlickrJSON = new FlickrJSON(YOUR_API_KEY); | |
fj.loader.addEventListener(Event.COMPLETE, YOUR_LOAD_COMPLETE_CALLBACK_FUNCTION); | |
fj.doCall(FLICKR_API_METHOD_AS_STRING, {PARAM_1_NAME_AS_STRING : PARAM_1_VALUE_AS_STRING, ...}); | |
you will want to convert the response string that you get in your callback to a native Object. To do this, simply use the | |
static method FlickrJSON.objectFromResponse. |
#!/bin/bash | |
#place this somewhere in Bash's $PATH and chmod +x it.... | |
working_dir=$PWD | |
/usr/bin/osascript<<END | |
on run | |
tell application "System Events" to tell process "Terminal" to keystroke "t" using command down | |
tell application "Terminal" to do script "cd $working_dir" in front window | |
end run | |
END |
# A Rails initializer that adds accessor/mutator methods | |
# of the form "instance.property_key" for any serialized (hash) attribute | |
# of your models. Stick contents in a file called serialized_attr_accessor.rb | |
# or similar and place it in your config/initializers directory. | |
# | |
# usage: | |
# | |
# class MyModel < ActiveRecord::Base | |
# | |
# # your model has a serialized hash attribute "settings" |
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<!-- <dict> | |
<key>name</key> | |
<string>Comments</string> | |
<key>scope</key> | |
<string>source.sass</string> | |
<key>settings</key> | |
<dict> |
# The personal pattern I've devised for storing module or app-wide configuration | |
# info in ruby projects | |
require 'ostruct' | |
module SomeApp | |
class Configuration | |
def self.method_missing(*args) | |
config.send *args |
# The functionality from the cache_digests gem (https://github.com/rails/cache_digests) | |
# has been merged into actionpack for Rails 4, | |
# but the handy rake task to dump the template dependency hierarchy for a given template | |
# to the console didn't. Here's the rake task from DHH's cache_digests project tree, updated | |
# for ActionView in Rails 4. Copy it to your project's lib/tasks directory as "cache_digests.rake" | |
namespace :cache_digests do | |
desc 'Lookup nested dependencies for TEMPLATE (like messages/show or comments/_comment.html)' | |
task :nested_dependencies => :environment do | |
raise 'You must provide TEMPLATE for the task to run' unless ENV['TEMPLATE'].present? |
I hereby claim:
To claim this, I am signing this object: