Skip to content

Instantly share code, notes, and snippets.

View criscokid's full-sized avatar

Ryan Farnell criscokid

View GitHub Profile
@stevestreza
stevestreza / NSURL+Pieces.h
Created September 26, 2011 19:52
A method for debugging NSURLs to find where the different pieces of your URL are
#import <Foundation/Foundation.h>
@interface NSURL (Pieces)
-(NSDictionary *)piecesDictionary;
@end
@madrobby
madrobby / README.md
Created May 17, 2011 16:34 — forked from 140bytes/LICENSE.txt
Luhn10 algorithm

Implementation of the Luhn 10 algorithm to check validity of credit card numbers. See http://en.wikipedia.org/wiki/Luhn_algorithm for details on the algorithm.

var validCreditCard = function(a,b,c,d,e){for(d=+a[b=a.length-1],e=0;b--;)c=+a[b],d+=++e%2?2*c%10+(c>4):c;return!(d%10)};

validCreditCard('378282246310005'); //=> true
validCreditCard('378282246310006'); //=> false

// some numbers to test with
// 378282246310005 371449635398431 378734493671000
@jsjohnst
jsjohnst / comment_flag_in.css
Created December 27, 2010 05:45
Pure CSS (without extra HTML markup) comment speech bubbles for SquareSpace blogs.
.journal-comment-area-wrapper .comment .signature:before {
font-size: 10px;
content: '';
display: block;
height: 0;
width: 0;
border-right: 2em solid #666;
border-bottom: 2em solid #000;
border-bottom: 2em solid transparent;
position: absolute;
# Apple Binary Property List serializer for Ruby 1.8.
require 'iconv'
module AppleBinaryPropertyList
MIME_TYPE = 'application/octet-stream' # Don't know what to use, so use a very generic type for now
CFData = Struct.new(:data) # For marking strings as binary data which will be decoded as a CFData object