Skip to content

Instantly share code, notes, and snippets.

View fernyb's full-sized avatar

Fernando Barajas fernyb

View GitHub Profile
@fernyb
fernyb / NSArray+FRBMethods.h
Created March 6, 2011 06:04
NSArray map method like Ruby's Array#map method
@interface NSArray (FRBMethods)
- (NSArray *)map:(id (^)(id item))block;
@end
@fernyb
fernyb / gist:880188
Created March 21, 2011 20:43
Command to generate header file to use with ScriptingBridge
sdef /Applications/iCal.app | sdp -fh --basename iCal
@fernyb
fernyb / FRBWindow+Extra.h
Created March 28, 2011 05:39
NSWindow Categories to get screen capture of NSWindow including the shadow
@interface NSWindow (FRBExtra)
- (NSImage *)windowImage;
- (CGImageRef)windowImageShot;
@end
@fernyb
fernyb / port-format.sh
Last active September 25, 2015 18:18
Port forward request from port 3000 to port 80
# View rules
sudo ipfw show
# Add rule
sudo ipfw add 100 fwd 127.0.0.1,3000 tcp from any to me dst-port 80
# Remove rules
sudo ipfw flush
@fernyb
fernyb / friendly_id_ext.rb
Created August 29, 2011 23:23
extend friendly_id to have more than 1 friendly_id for each model
module FriendlyId
module ActiveRecordAdapter
def has_another_friendly_id method, options={}
if FriendlyId::on_ar3?
class_attribute :friendly_ids if !self.respond_to?(:friendly_ids)
self.friendly_ids ||= []
config = Configuration.new(self, method, options)
self.friendly_ids << config
end
@fernyb
fernyb / Gemfile
Created September 14, 2011 04:19
Adding rails_mail_preview gem
group :development do
gem "rails_mail_preview", "0.0.2"
end
@fernyb
fernyb / gist:1241631
Created September 26, 2011 04:50
ffmpeg commands
ffmpeg -i SCENIC_DRIVE.m4v -qscale 5 -s 480x360 -r 15 -ar 22050 scenic_drive2.flv
@fernyb
fernyb / gist:1242863
Created September 26, 2011 17:55
Tar gzip a directory
tar -zcvf filename.tar.gz ./directory_name
@fernyb
fernyb / gist:1468509
Created December 12, 2011 18:40
ssh mysql tunnel
ssh -L 3307:domain.name.of.mysqlserver:3306 [email protected]
Download and extract the latest RTMPDump source tarball, open a Terminal window and cd to the directory you just extracted the sources, i.e. ./rtmpdump-2.3
We need to make a small change in the Makefile in the ./librtmp directory, so you need to cd into that directory
Edit Makefile in ./librtmp and replace -soname with -dylib_install_name
cd ..
sudo make install SYS=posix