Skip to content

Instantly share code, notes, and snippets.

View christianroman's full-sized avatar

Christian Roman christianroman

  • Mexico
View GitHub Profile
@nozpheratu
nozpheratu / seeds.rb
Created March 21, 2013 16:53
seed file for country/state creation
# encoding: utf-8
Country.delete_all
ActiveRecord::Base.connection.reset_pk_sequence!('countries')
Country.create(:id=>1,:iso=>"AD",:name=>"Andorra")
Country.create(:id=>2,:iso=>"AE",:name=>"United Arab Emirates")
Country.create(:id=>3,:iso=>"AF",:name=>"Afghanistan")
Country.create(:id=>4,:iso=>"AG",:name=>"Antigua and Barbuda")
Country.create(:id=>5,:iso=>"AI",:name=>"Anguilla")
Country.create(:id=>6,:iso=>"AL",:name=>"Albania")
Country.create(:id=>7,:iso=>"AM",:name=>"Armenia")
@mattt
mattt / uiappearance-selector.md
Last active December 2, 2025 01:55
A list of methods and properties conforming to `UIAppearance` as of iOS 12 Beta 3

Generate the list yourself:

$ cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS*.sdk/System/Library/Frameworks/UIKit.framework/Headers
$ grep UI_APPEARANCE_SELECTOR ./*     | \
  sed 's/NS_AVAILABLE_IOS(.*)//g'     | \
  sed 's/NS_DEPRECATED_IOS(.*)//g'    | \
  sed 's/API_AVAILABLE(.*)//g'        | \
  sed 's/API_UNAVAILABLE(.*)//g'      | \
 sed 's/UI_APPEARANCE_SELECTOR//g' | \
@martinsik
martinsik / MyCalendar.h
Created March 8, 2013 09:47
Example of using EventKit on iOS 6+
#import <Foundation/Foundation.h>
@interface MyCalendar : NSObject
+ (void)requestAccess:(void (^)(BOOL granted, NSError *error))success;
+ (BOOL)addEventAt:(NSDate*)eventDate withTitle:(NSString*)title inLocation:(NSString*)location;
@end
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active July 25, 2026 13:41
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@sholloway
sholloway / PostGIS install
Created January 13, 2013 23:23
Set up a spatial database with PostGIS on EC2 using an EBS.
Steps:
Set up EBS
21Created 1 TB EBS
Created 64 Bit Amazon Linux AMI 2012.09 M1 Medium 3.7 gb ram, 2 ECUs
Connect to ec2 instance via ssh
chmod 400 IFS-KeyPair.pem
ssh -v -i IFS-KeyPair.pem ec2-user@ec2-54-234-14-65.compute-1.amazonaws.com
Note: Do not replace ec2-user with your user id. This is a AWS Amazon AMI requirement.
@asanchez75
asanchez75 / gist:4467682
Created January 6, 2013 14:51
instalacion postgis centos 5.7
yum install postgis geos proj --enablerepo=epel
yum install postgresql postgresql-server --disablerepo=updates --disablerepo=base
==============================================
//
// NSArray+CollectionOperations.h
// MSAppKit
//
// Created by Jarod Luebbert on 1/4/13.
//
//
#import <Foundation/Foundation.h>
@zapsleep
zapsleep / vImageBlurTest.mm
Last active September 6, 2016 06:12
Creating blur image from given with vImage
- (UIImage *)blurryImage:(UIImage *)image withBlurLevel:(CGFloat)blur {
if (blur < 0.f || blur > 1.f) {
blur = 0.5f;
}
int boxSize = (int)(blur * 100);
boxSize = boxSize - (boxSize % 2) + 1;
CGImageRef img = image.CGImage;
vImage_Buffer inBuffer, outBuffer;
@brobertsaz
brobertsaz / serversetup.md
Last active July 6, 2020 08:56
Ubuntu 12.04 Ruby, Rails, Nginx, Unicorn

Ubuntu 12.04, Ruby, Rails, Nginx, Unicorn and git-deploy

In the seemlingly endless search for the actual correct and easy way to deploy a Rails app, we have tried several ways. We tried out using Apache2 and running a cluster of Thin servers. With the built in threading of Puma we decided to use it with Nginx.

Server Setup

  • Create new server
  • Login to new server
    • ssh root@IPaddress (you can also use the domain name if you have the DNS setup already)
    • accept the RSA key
@tkemp
tkemp / AvailableASBDs.c
Created December 9, 2012 18:12
Get details on available AudioStreamBasicDescriptions for various file formats
void AUM_printAvailableStreamFormatsForId(AudioFileTypeID fileTypeID, UInt32 mFormatID)
{
AudioFileTypeAndFormatID fileTypeAndFormat;
fileTypeAndFormat.mFileType = fileTypeID;
fileTypeAndFormat.mFormatID = mFormatID;
UInt32 fileTypeIDChar = CFSwapInt32HostToBig(fileTypeID);
UInt32 mFormatChar = CFSwapInt32HostToBig(mFormatID);
OSStatus audioErr = noErr;
UInt32 infoSize = 0;