Skip to content

Instantly share code, notes, and snippets.

View thephw's full-sized avatar
❤️
Building software with love

Patrick Howard Wiseman thephw

❤️
Building software with love
View GitHub Profile
@thephw
thephw / iphone.css
Created September 28, 2012 02:56
Project Q iPhone4 Media Query Quickfix
/* iPhone 4 */
@media
only screen and (-webkit-min-device-pixel-ratio : 1.5),
only screen and (min-device-pixel-ratio : 1.5) {
/* Styles */
#centercol {
width: 450px;
}
}
@thephw
thephw / foobar.rb
Created October 28, 2012 06:15
Proper After Initialize
# == Schema Information
#
# Table name: foobars
#
# id :integer not null, primary key
# created_at :datetime not null
# updated_at :datetime not null
# name :string(255) not null
# baz :string(255)
@thephw
thephw / .bashrc
Last active October 13, 2015 18:28
Kittenify-Rails lets you easily swap out your placeholder images in from placehold it with kittens via a view helper. Sexy hotness. And seriously cute.
export KITTENIFY=1
@thephw
thephw / colorize.rb
Created December 13, 2012 15:44
Semi-graceful seeds...
# config/initializers/colorize.rb
## Just for prettier output
class String
def colorize(color, options = {})
background = options[:background] || options[:bg] || false
style = options[:style]
offsets = ["gray","red", "green", "yellow", "blue", "magenta", "cyan","white"]
styles = ["normal","bold","dark","italic","underline","xx","xx","underline","xx","strikethrough"]
start = background ? 40 : 30
@thephw
thephw / Console Shim
Last active December 12, 2015 06:58
Fix issues with IE not having a console object when the debug console is not open.
// Avoid `console` errors in browsers that lack a console.
(function() {
var method;
var noop = function () {};
var methods = [
'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',
'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',
'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd',
'timeStamp', 'trace', 'warn'
];
@thephw
thephw / gist:4743827
Last active January 24, 2018 23:28
Taxes 2017 for IRB
################
## Taxes 2017 ##
################
SINGLE_STD_DEDUCTION = 6350
MARRIED_STD_DEDUCTION = 12700
FEDERAL_INDIVIDUAL_INCOME_TAX_RATES = {
9325 => 0.10,
37950 => 0.15,
91900 => 0.25,
@thephw
thephw / gist:5321913
Last active December 15, 2015 20:58
Why people should hate me... dynamic method generation in a static configuration file. Whatever, whatever, I do what I want.
exports.definition = {
config: {
extra_methods: [
{
name: 'test',
url: 'test',
type: 'get'
}
],
extendModel: function(Model) {
@thephw
thephw / fb.js
Last active December 16, 2015 00:10
Extend your facebook authentication token.
function fbExtendAuthentication(accessToken){
var extensionData = {
grant_type: 'fb_exchange_token',
client_id: '', //App ID
client_secret: '', //App Secret, only secure because only admins see this page
fb_exchange_token: accessToken,
};
$.ajax('https://graph.facebook.com/oauth/access_token', {
data: extensionData,
{
"color_scheme": "Packages/RailsCasts Colour Scheme/RailsCastsColorScheme.tmTheme",
"folder_exclude_patterns":
[
".bundle",
".git",
".svn",
".sass-cache",
"doc",
"log",
@thephw
thephw / nonstupid.js
Created April 11, 2013 16:06
Non-stupid alert boxes template
var title = '';
var message = '';
var alert = Ti.UI.createAlertDialog({title:'', message:message});
alert.show();