Skip to content

Instantly share code, notes, and snippets.

View armanddp's full-sized avatar

Armand du Plessis armanddp

View GitHub Profile
@armanddp
armanddp / rails_guides_offline.bash
Created August 30, 2012 10:58
Rails Guides Offline
ruby-1.9.3-p194 in current/
› gem install RedCloth
Building native extensions. This could take a while...
Successfully installed RedCloth-4.2.9
1 gem installed
Installing ri documentation for RedCloth-4.2.9...
Installing RDoc documentation for RedCloth-4.2.9...
ruby-1.9.3-p194 in current/
› gem which rails
@armanddp
armanddp / iphone_vibrations
Created May 27, 2012 10:26
Custom Vibrations for iPhone
To use Cus­tom Vibra­tions, open the Set­tings app, tap “Gen­er­al” then “Acces­si­bil­i­ty” then turn Cus­tom Vibra­tions on. Now in Set­tings tap “Sounds,” then “Vibra­tion” under the head­ing “Vibra­tion Patterns.” At the bot­tom, tap “Cre­ate New Vibration.” Start tap­ping on the screen, and your pat­tern of tap­ping will be record­ed for use with any alert. You can make sev­er­al of these. The most com­mon use for Cus­tom Vibra­tions is to be able to tell who’s call­ing when your iPhone is in silent mode.
Source: Cult of Mac http://www.cultofmac.com/169875/what-apples-vibrating-pen-tells-us-about-the-future-of-everything/
@armanddp
armanddp / gradiate.rb
Created May 11, 2011 12:13
Function to transition between two colors
def gradiate(color1, color2, steps)
[color1].tap do |colors|
red, green, blue = (color1 >> 16), ((color1 >> 8) & 0xFF), (color1 & 0xFF)
red_diff, green_diff, blue_diff = ((color2 >> 16) - red), (((color2 >> 8) & 0xFF) - green), ((color2 & 0xFF) - blue)
(steps += 1).times do |i|
ratio = i.to_f / steps
colors << (((red_diff * ratio) + red).to_i << 16 | ((green_diff * ratio) + green).to_i << 8 | ((blue_diff * ratio) + blue).to_i)
end
colors << color2
@armanddp
armanddp / wifi_rssi
Created January 26, 2011 18:18
useful console command to fine-tune wireless signal
while x=1; do /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | grep CtlRSSI; sleep 0.3; done
e.g.
pkgtrans git-1.7.1-sol10-x86-local .
cd SMCgit
joe pkginfo
# Update Basedir
BASEDIR=/opt/csw
pkgtrans ruby-1.9.1p376-sol10-x86-local .
cd SMCruby
joe pkginfo
% Set install path
% Get file size
wc -c pkginfo
% Calc new checksum
== Add Firebug 'Lite' functionality to Chrome et co.
javascript:var firebug=document.createElement('script');firebug.setAttribute('src','http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js');document.body.appendChild(firebug);(function(){if(window.firebug.version){firebug.init();}else{setTimeout(arguments.callee);}})();void(firebug);
== Quick & Dirty Instructions for Reverse SSH tunnel
ssh -gNR 3000:localhost:3000 user@host.domain.com
ssh -gNR <remote_port>:localhost:<local_port> user@remoteserver