Skip to content

Instantly share code, notes, and snippets.

Marco Sero MarcoSero

Block or report user

Report or block MarcoSero

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@MarcoSero
MarcoSero / .zshrc
Created Nov 3, 2015
Fast git prompt
View .zshrc
# Load oh-my-zsh first
source $ZSH/oh-my-zsh.sh
# If we are on a big repo, re-define git prompt
function git_prompt_info() {
if [[ "$(command git config --get oh-my-zsh.hide-status 2>/dev/null)" != "1" ]]; then
ref=$(command git symbolic-ref HEAD 2> /dev/null) || \
ref=$(command git rev-parse --short HEAD 2> /dev/null) || return 0
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$ZSH_THEME_GIT_PROMPT_SUFFIX"
fi
@MarcoSero
MarcoSero / package-ida.sh
Last active Aug 29, 2015 — forked from phatblat/package-ida.sh
A quick script to package up an .ipa correctly since `xcodebuild -exportArchive` misses the required SwiftSupport and WatchKitSupport folders
View package-ida.sh
#!/bin/bash -e
#
# package-ipa.sh
#
# Bundles an iOS app correctly, using the same directory structure that Xcode does when using the export functionality.
#
xcarchive="$1"
output_ipa="$2"
View tictactoe.hs
--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]
View Has weird right-to-left characters.txt
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶
View 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": {
View decompression.m
+ (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 / cabal_dash_docset.sh
Created Dec 9, 2014
Convert all Cabal documentation to a Dash docset
View cabal_dash_docset.sh
#!/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/"
@MarcoSero
MarcoSero / contacts.hs
Created Nov 2, 2014
Simple JSON-backed address book in Haskell
View contacts.hs
{-# LANGUAGE OverloadedStrings, DeriveGeneric #-}
import Data.Aeson ((.:), (.:?), decode, encode, FromJSON(..), ToJSON(..), Value(..))
import Data.Aeson.Encode.Pretty
import qualified Data.ByteString.Lazy as BS (readFile, writeFile)
import Control.Applicative ((<$>), (<*>))
import Control.Monad.IO.Class
import Control.Monad
@MarcoSero
MarcoSero / .gitconfig
Last active Aug 29, 2015
Cleanup merged branches
View .gitconfig
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"
View camel and snake case.hs
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)
You can’t perform that action at this time.