Skip to content

Instantly share code, notes, and snippets.

View humberaquino's full-sized avatar

Humberto Aquino humberaquino

View GitHub Profile
@juliengrimault
juliengrimault / FileFunctionLevelFormatter.h
Created March 17, 2012 03:33
Cocoa Lumberjack formatter showing file, function and level of the log
//
// FileFunctionLevelFormatter.h
//
// Created by Julien Grimault on 23/1/12.
// Copyright (c) 2012 Julien Grimault. All rights reserved.
//
#import "DDLog.h"
@interface FileFunctionLevelFormatter : NSObject <DDLogFormatter>
@zhjuncai
zhjuncai / randomColor.swift
Created January 17, 2015 12:11
Get Random color - swift
/**
Get Random Color by generating three random float to represent RGB
**/
func randomColor() -> UIColor{
var randomRed:CGFloat = CGFloat(drand48())
var randomGreen:CGFloat = CGFloat(drand48())
var randomBlue:CGFloat = CGFloat(drand48())
return UIColor(red: randomRed, green: randomGreen, blue: randomBlue, alpha: 1.0)
@alinradut
alinradut / CGRect helpers
Created May 26, 2011 08:40
Useful CGRect manipulation defines
#define CGRectSetPos( r, x, y ) CGRectMake( x, y, r.size.width, r.size.height )
#define CGRectSetX( r, x ) CGRectMake( x, r.origin.y, r.size.width, r.size.height )
#define CGRectSetY( r, y ) CGRectMake( r.origin.x, y, r.size.width, r.size.height )
#define CGRectSetSize( r, w, h ) CGRectMake( r.origin.x, r.origin.y, w, h )
#define CGRectSetWidth( r, w ) CGRectMake( r.origin.x, r.origin.y, w, r.size.height )
#define CGRectSetHeight( r, h ) CGRectMake( r.origin.x, r.origin.y, r.size.width, h )
@gbabiars
gbabiars / Grunt Proxy Server
Last active September 6, 2016 05:45
Grunt Connect Server with Proxies
var proxySnippet = require('grunt-connect-proxy/lib/utils').proxyRequest;
module.exports = function(grunt) {
grunt.initConfig({
watch: {
all: {
files: ['Gruntfile.js']
}
},
connect: {
@mmorey
mmorey / .gitignore
Last active November 9, 2018 16:20 — forked from adamgit/.gitignore
.gitignore file for Xcode5
#########################
# .gitignore file for Xcode5
#
# NB: if you are storing "built" products, this WILL NOT WORK,
# and you should use a different .gitignore (or none at all)
# This file is for SOURCE projects, where there are many extra
# files that we want to exclude
#
# For updates, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
# and https://gist.github.com/adamgit/3786883
@justincase
justincase / gist:5492212
Created April 30, 2013 21:48
Enable mgo debug log
mgo.SetDebug(true)
var aLogger *log.Logger
aLogger = log.New(os.Stderr, "", log.LstdFlags)
mgo.SetLogger(aLogger)
@brev
brev / git-overwrite-branch.sh
Created May 14, 2015 21:27
Git overwrite branch with another branch
# overwrite master with contents of seotweaks branch (seotweaks > master)
git checkout seotweaks # source name
git merge -s ours master # target name
git checkout master # target name
git merge seotweaks # source name

Setup lisp with slime on OS X

Install your favorite lisp interpreter

If you already have Homebrew, just open a terminal and type

$ brew install clozure-cl
@arobb
arobb / sierra-virtualbox-install.md
Last active November 24, 2020 13:15
Install macOS Sierra in VirtualBox on macOS host

Step 1 (Creating a bootable macOS Sierra ISO for VirtualBox):

  1. hdiutil attach /Applications/Install\ macOS\ Sierra\ Public\ Beta.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app
  2. hdiutil create -o /tmp/Sierra.cdr -size 7316m -layout SPUD -fs HFS+J
  3. hdiutil attach /tmp/Sierra.cdr.dmg -noverify -nobrowse -mountpoint /Volumes/install_build
  4. asr restore -source /Volumes/install_app/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase
  5. rm /Volumes/OS\ X\ Base\ System/System/Installation/Packages
  6. cp -rp /Volumes/install_app/Packages /Volumes/OS\ X\ Base\ System/System/Installation/
  7. cp -rp /Volumes/install_app/BaseSystem.chunklist /Volumes/OS\ X\ Base\ System/BaseSystem.chunklist
@DanielStormApps
DanielStormApps / EmailValidator.swift
Last active March 16, 2021 14:22 — forked from darthpelo/EmailValidator.swift
This regular expression is adapted from a version at regular-expressions.info and is a complete verification of RFC 2822. Source: http://www.cocoawithlove.com/2009/06/verifying-that-string-is-email-address.html. Dedicate article: https://medium.com/@darthpelo/email-validation-in-swift-3-0-acfebe4d879a
extension String {
/// Checks if the `String` is a valid email address.
/// ````
/// // Example
/// "name@email.com".isValidEmailAddress() // true
/// "name(at)email(dot)com".isValidEmailAddress() // false
/// "name@email".isValidEmailAddress() // false
/// "name@.com".isValidEmailAddress() // false
/// "name.com".isValidEmailAddress() // false