Skip to content

Instantly share code, notes, and snippets.

View dgrijalva's full-sized avatar

Dave Grijalva dgrijalva

View GitHub Profile
@matthiasplappert
matthiasplappert / gist:9493050
Last active August 29, 2015 13:57
QuickLook Debugging for `UIView`
@interface UIView (MPAdditions)
@end
@implementation UIView (MPAdditions)
- (id)debugQuickLookObject {
if (self.bounds.size.width < 0.0f || self.bounds.size.height < 0.0f) {
return nil;
}
@dgrijalva
dgrijalva / renamer.go
Created April 6, 2013 22:07
Experimenting with code generation using `go/ast`. I wanted to see if it was practical to use compilable go code as a template for project generation. For example: if you wanted to be able to generate a falcore app from a template, what would that look like? If you could keep the template file looking like regular go source code (without templat…
package main
import (
"fmt"
"os"
"strings"
"go/parser"
"go/token"
"go/ast"
"go/printer"
@dgrijalva
dgrijalva / gist:1198745
Created September 6, 2011 19:42
openssl notes
# Convert ssh-rsa key to pem
ssh-keygen -f infile.pub -e -m PKCS8 > outfile.pem
# Encrypt a file using public key pem
openssl rsautl -encrypt -inkey public.pem -pubin -in file.txt -out file.ssl
# Decrypt using private key
openssl rsautl -decrypt -inkey private.pem -in file.ssl -out decrypted.txt
@dgrijalva
dgrijalva / Rakefile
Created August 9, 2011 20:23
Rakefile for building Go projects
require 'rake/clean'
require 'rake/testtask'
# Insert executable name here
TARGET = ''
CLEAN.include('**/*.6')
CLOBBER.include(TARGET)
def required_modules go_file
@dgrijalva
dgrijalva / .irbrc
Last active September 25, 2015 03:58
My .irbrc (IRB Quick snippets)
# Time something
def t; t = Time.now; r = yield; puts Time.now - t; r; end