Skip to content

Instantly share code, notes, and snippets.

View MarcoSero's full-sized avatar

Marco Sero MarcoSero

View GitHub Profile
@MarcoSero
MarcoSero / 0_reuse_code.js
Created January 30, 2014 14:26
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console

Description

Dashing widget to display a Jenkins build status and build progress

The widget is based on the meter-widget which is default in the Dashing installation

The widget can also see the progress of a "pre-build", i.e if you have a job triggering the actual build you want to define, you can configure this job in the jenkins_build.rb as a prebuild.

For more information, please see Coding Like a tosser

iTerm2

http://www.iterm2.com/#/section/downloads

Get the iTerm color settings

https://raw.github.com/altercation/solarized/master/iterm2-colors-solarized/Solarized%20Dark.itermcolors

Apply them in iTerm through iTerm -> preferences -> profiles -> load presets -> import. You can create a different profile, other than Default if you wish to do so.

@MarcoSero
MarcoSero / camel and snake case.hs
Created August 25, 2014 10:41
Haskell case additions
separatedWords :: String -> [String]
separatedWords = filter (not . any isSpace) . groupBy ((==) `on` isSpace)
toCamel :: String -> String
toCamel = foldl (\acc x -> acc ++ [(if null acc then (head x) else (toUpper $ head x))] ++ (tail x)) [] . separatedWords . map (toLower)
toSnake :: String -> String
toSnake = foldr (\x acc -> x ++ (if null acc then "" else "_") ++ acc) [] . separatedWords . map (toLower)
@MarcoSero
MarcoSero / .gitconfig
Last active August 29, 2015 14:06
Cleanup merged branches
cleanup = "!git branch --merged | grep -v '\\*\\|master\\|develop' | xargs -n 1 git branch -d"
cleanupr = "!git fetch --prune ; git branch -r --merged | grep origin | grep -v '>' | grep -v '\\*\\|master\\|develop' | xargs -L1 | cut -d"/" -f2- | xargs git push origin --delete"
@MarcoSero
MarcoSero / cabal_dash_docset.sh
Created December 9, 2014 15:02
Convert all Cabal documentation to a Dash docset
#!/bin/zsh
arch=x86_64
os=osx
kernel=darwin
compiler=ghc
version=7.8.3
user=~/.ghc/$arch-$kernel-$version/package.conf.d
target=myhaskell.docset
dash_path="~/Library/Application Support/Dash/DocSets/Haskell/"
+ (UIImage *)decompressedImageWithImage:(UIImage *)image resizeTo:(CGSize)targetSize
{
CGImageRef imageRef = image.CGImage;
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGImageAlphaInfo alphaInfo = CGImageGetAlphaInfo(imageRef);
BOOL sameSize = NO;
if (CGSizeEqualToSize(targetSize, CGSizeMake(CGImageGetWidth(imageRef), CGImageGetHeight(imageRef)))) {
targetSize = CGSizeMake(1, 1);
sameSize = YES;
}
@MarcoSero
MarcoSero / Mantle.podspec.json
Created April 3, 2015 09:27
Mantle.podspec.json
{
"name": "Mantle",
"version": "2.0",
"summary": "Model framework for Cocoa and Cocoa Touch.",
"homepage": "https://github.com/Mantle/Mantle",
"license": "MIT",
"authors": {
"GitHub": "support@github.com"
},
"source": {
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶
--Authored by Grant Slatton on 2013 October 10
--All code is released to the public domain under the terms of [http://unlicense.org/]
import Data.List
import Control.Monad
import Data.Maybe
import Data.Function
magicSquare = [8,1,6,3,5,7,4,9,2]