Skip to content

Instantly share code, notes, and snippets.

View jessearmand's full-sized avatar

Jesse Armand jessearmand

View GitHub Profile
@jessearmand
jessearmand / NSColor+isLight.h
Created May 16, 2018 03:11 — forked from kaishin/NSColor+isLight.h
Programmatically determine the perceived lightness of a color. More details on: http://robots.thoughtbot.com/closer-look-color-lightness + Online tool: http://thoughtbot.github.io/color-lightness-test/
#import <Cocoa/Cocoa.h>
@interface NSColor (isLight)
- (BOOL)isLight;
@end
[{"name":"Israel","dial_code":"+972","code":"IL"},{"name":"Afghanistan","dial_code":"+93","code":"AF"},{"name":"Albania","dial_code":"+355","code":"AL"},{"name":"Algeria","dial_code":"+213","code":"DZ"},{"name":"AmericanSamoa","dial_code":"+1 684","code":"AS"},{"name":"Andorra","dial_code":"+376","code":"AD"},{"name":"Angola","dial_code":"+244","code":"AO"},{"name":"Anguilla","dial_code":"+1 264","code":"AI"},{"name":"Antigua and Barbuda","dial_code":"+1268","code":"AG"},{"name":"Argentina","dial_code":"+54","code":"AR"},{"name":"Armenia","dial_code":"+374","code":"AM"},{"name":"Aruba","dial_code":"+297","code":"AW"},{"name":"Australia","dial_code":"+61","code":"AU"},{"name":"Austria","dial_code":"+43","code":"AT"},{"name":"Azerbaijan","dial_code":"+994","code":"AZ"},{"name":"Bahamas","dial_code":"+1 242","code":"BS"},{"name":"Bahrain","dial_code":"+973","code":"BH"},{"name":"Bangladesh","dial_code":"+880","code":"BD"},{"name":"Barbados","dial_code":"+1 246","code":"BB"},{"name":"Belarus","dial_code":"+375","
- (BOOL)stringContainsEmoji:(NSString *)string {
__block BOOL returnValue = NO;
[string enumerateSubstringsInRange:NSMakeRange(0, [string length]) options:NSStringEnumerationByComposedCharacterSequences usingBlock:
^(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop) {
const unichar hs = [substring characterAtIndex:0];
// surrogate pair
if (0xd800 <= hs && hs <= 0xdbff) {
if (substring.length > 1) {
const unichar ls = [substring characterAtIndex:1];
#!/bin/sh
#
# fleet-drone
#
# chkconfig: - 85 15
# description:
# processname: fleet-drone
# config: /etc/node/fleet-drone.conf
# pidfile: /var/run/fleet-drone.pid
@jessearmand
jessearmand / BaseViewController.m
Created October 19, 2011 09:11 — forked from boctor/BaseViewController.m
A base view controller class that when running on the simulator in debug mode, will auto simulate a memory warning every time the view controller's viewDidAppear is called
//
// BaseViewController.m
//
// Created by Peter Boctor on 5/4/11.
//
// Copyright (c) 2011 Peter Boctor
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
@jessearmand
jessearmand / new-github.sh
Created July 26, 2011 02:51 — forked from topfunky/new-github.sh
Shell shortcut to setup a Git repo with GitHub. Works with zsh or bash.
# Usage: new-github topfunky tidy_table
function new-github() {
git remote add origin git@github.com:$1/$2.git
git push origin master
git config branch.master.remote origin
git config branch.master.merge refs/heads/master
git config push.default current
}
@jessearmand
jessearmand / clean_assets.rb
Created April 29, 2011 09:29 — forked from soffes/clean_assets.rb
Rake task to clean unused images in your iOS project
desc 'Remove unused images'
task :clean_assets do
require 'set'
all = Set.new
used = Set.new
unused = Set.new
# White list
used.merge %w{Icon Icon-29 Icon-50 Icon-58 Icon-72 Icon-114}
#!/bin/bash
# run this in ~/Library/Logs/CrashReporter/MobileDevice
pth=${0%*/*}
cd "$pth"
#echo "$@"
if [ -z "$1" ]; then
find . -name "*.crash" | while read file;
do
echo "converting $file"
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal