Skip to content

Instantly share code, notes, and snippets.

Andrew Sardone andrewsardone

Block or report user

Report or block andrewsardone

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View defuns.el
(defun markdown-custom ()
(add-hook 'markdown-mode-hook '(lambda() (markdown-custom)))
(provide 'defuns)
View gist:107299
#import "AppController.h"
@implementation AppController
- (void)awakeFromNib {
NSMenu *menu = [self createMenu];
menuItem = [[[NSStatusBar systemStatusBar] statusItemWithLength:24] retain];
[menuItem setImage:[NSImage imageNamed:@"41-picture-frame"]];
[menuItem setTarget:self];
View callbacks.rb
# Cookie cutter code from ActiveRecord::Callbacks
# Adds before_move and after_move callbacks for the awesome_nested_set
# plugin by Collective Idea
# RAILS_ROOT/vendor/plugins/awesome_nested_set_extensions/lib/callbacks.rb
module CollectiveIdea #:nodoc:
module Acts #:nodoc:
module NestedSet #:nodoc:
View gist:130895
# text_children_of_element(REXML::XPath.first(node, query))
def text_children_of_element(e, s=[])
if e.has_elements?
s << ""
e.each_element { |el| text_value_of_element(el,s) }
elsif e.has_text?
s << e.text.chomp
s.join(" ")
View gist:167172
$ git checkout -f 03712e55d876484c383c13422bd4f26f34c59a82
FATAL: Could not checkout 03712e55d876484c383c13422bd4f26f34c59a82
Command returned status code 1: error: git checkout-index: unable to create symlink product/mms/conf/ (File name too long)
View macruby_json_experiment.rb
#!/usr/bin/env macruby
# example using Twitter API
framework 'Cocoa'
framework 'JSON'
url = NSURL.URLWithString ""
request = NSURLRequest.requestWithURL(url)
response = NSURLConnection.sendSynchronousRequest(request, returningResponse:nil, error:nil)
json_string = NSString.alloc.initWithData(response, encoding:NSUTF8StringEncoding)
View gist:215435
#!/usr/bin/env bash
[[ -n "$1" ]] || { echo "Usage: $0 project_name"; exit 0 ; }
mkdir -m 770 $1.git
cd $1.git
git --bare init --shared=group
#!/usr/bin/env bash
# makeGitRepo
[[ -n "$1" ]] || { echo "Usage: $0 project_name"; exit 0 ; }
mkdir -m 770 $1.git
cd $1.git
git --bare init --shared=group
View gist:215438
pushd /Volumes/JungleDisk/Git
makeGitRepo project
You can’t perform that action at this time.