Skip to content

Instantly share code, notes, and snippets.

View jessearmand's full-sized avatar

Jesse Armand jessearmand

View GitHub Profile
@jessearmand
jessearmand / Model
Created July 11, 2014 06:39
Library Management
{
"isbn12345": {
"title": "Introdution to Algorithms",
"available": true,
"borrow_date": 1405062840,
"due_date": 1405102840,
"student334343": {
"name": "Sergey Brin",
"books": ["isbn12345", "isbn12346"]
}
#!/bin/sh
# unregister broken GHC packages. Run this a few times to resolve dependency rot in installed packages.
# ghc-pkg-clean -f cabal/dev/packages*.conf also works.
function ghc-pkg-clean() {
for p in `ghc-pkg check $* 2>&1 | grep problems | awk '{print $6}' | sed -e 's/:$//'`
do
echo unregistering $p; ghc-pkg $* unregister $p
done
}
@jessearmand
jessearmand / unregister_old_ghc_packages.sh
Created May 17, 2014 18:50
unregister packages belonging to a previous version of ghc
#!/bin/sh
ghc-pkg check --simple-output | xargs -n 1 ghc-pkg unregister --force
[{"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];
@jessearmand
jessearmand / set-xcode-plugin-uuid.sh
Created March 11, 2014 04:16
Set Xcode plugin UUID compatibility
#!/bin/sh
XCODEUUID=`defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID`
defaults write ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins/$1.xcplugin/Contents/Info DVTPlugInCompatibilityUUIDs -array-add $XCODEUUID
@jessearmand
jessearmand / utilitiesCost.hs
Last active December 30, 2015 05:29
A simple haskell module to calculate utilties cost.
module UtilitiesCost
( electricityCost
, gasCost
, waterCost
, utilitiesCost
) where
import Debug.Trace
data Reading = Reading Double Double deriving (Eq, Show, Read)
@jessearmand
jessearmand / module_test.rb
Last active December 18, 2015 02:29
Some module test
module Debug
def whoAmI?
"#{self.name} (\##{self.id}): #{self.to_s}"
end
end
module Debugger
def whoAmI?
"#{self.id}: #{self.to_s}"
end
@jessearmand
jessearmand / fleet-hub-init.sh
Created May 10, 2013 02:44
fleet hub init script from @tblobaum
#!/bin/bash
SET_USER="node"
SET_NODE_VERSION="v0.6.14"
SET_HUB_PORT="1024"
SET_HUB_SECRET="beepboop"
[ -d /etc/node ] || mkdir /etc/node
cat > /etc/node/fleet-hub.conf <<EOT