Skip to content

Instantly share code, notes, and snippets.

View stith's full-sized avatar

Anna Stith stith

View GitHub Profile
@stith
stith / stuff.js
Last active August 29, 2015 13:57
doStuff().then(function(things) {
if (!things) {
throw new Error("Here I want to skip everything else, including the 'then's after the next catch..");
}
if (canMakeNewThing) {
// This should continue to the next 'then'
return someNewThing.save();
}
#!/usr/bin/python
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
# Mirror from http://s3.jspenguin.org/ssltest.py
import sys
import struct
import socket
import time
@stith
stith / keybase.md
Created June 5, 2015 02:50
keybase.md

Keybase proof

I hereby claim:

  • I am stith on github.
  • I am stith (https://keybase.io/stith) on keybase.
  • I have a public key whose fingerprint is 34D5 7F07 9811 B5EA B7D4 5915 7C4E EFA1 B205 55BD

To claim this, I am signing this object:

@stith
stith / grep-find-files-containing-text.sh
Created November 19, 2009 02:54
Random command line snippets
grep -lir "some text" *
// -l outputs only names of files containing text instead of the line
// -i ignores case
// -r recursive, go into subdirectories
@stith
stith / dice.txt
Created January 4, 2010 14:27
Cleverbot conversations
User: Will you roll a dice, please?
Cleverbot: I don't understand your request.
User: Roll a dice.
Cleverbot: Four.
User: Roll a dice.
def allocated_date=(new_value)
write_attribute(:allocated_date, new_value) unless read_attribute(:allocated_date)
end
@stith
stith / aasm_test.rb
Created March 4, 2010 09:52
Ruby test cases for testification
#!/usr/bin/env ruby
# Testing the aasm gem to see how to get one aasm_event to decide
# which state to transition into
require 'rubygems'
require 'aasm'
class TestObject
include AASM
aasm_initial_state :active
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"name = %@",someVariableNameLol];
NSArray *filteredArray = [friends filteredArrayUsingPredicate:predicate];
Product Names Guidelines
You may use Apple, iPad, or any other Apple word mark (but not the Apple Logo or other Apple-owned graphic symbol/logo) in a referential phrase on packaging or promotional/advertising materials to describe that the third party product is compatible with the referenced Apple product or technology, provided they comply with the following requirements.
a. The Apple word mark is not part of the product name.
b. The Apple word mark is used in a referential phrase such as "runs on," "for use with," "for," or "compatible with."
c. The Apple word mark appears less prominent than the product name.
d. The product is in fact compatible with, or otherwise works with, the referenced Apple product.
e. The reference to Apple does not create a sense of endorsement, sponsorship, or false association with Apple or Apple products or services.
f. The use does not show Apple or its products in a false or derogatory light.
@stith
stith / debug.m
Created January 3, 2011 02:12
MSLog code
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Debug
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#define DEBUG_ON // Toggle to DEBUG_OFF or comment out to hide all debug code
#ifdef DEBUG_ON
#define MSLog(format, ...) CFShow([[NSString stringWithFormat:@"<%@:%d> ",[[NSString stringWithUTF8String:__FILE__] lastPathComponent],__LINE__] stringByAppendingFormat:format, ## __VA_ARGS__])
#else
#define MSlog(format, ...)
#endif