Skip to content

Instantly share code, notes, and snippets.

James Whelton Whelton

Block or report user

Report or block Whelton

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ks.js
// For use on https://shake.io/employers
!function(){var a="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQ8AAAEPCAYAAABcL0E+AAAYJ2lDQ1BJQ0MgUHJvZmlsZQAAWIWVeQk4Vd/X/z733MnlmudZZjLPZJ7neUzlmme6pigSkqGSDCmkkEjRaErIkJJMiVKkEEqlMmTKe1B9f//v+3+f93n38+xzP3fttdb+7L3X3vusewHgYCWFhgaiaAEICg4n2xjq8Do5u/Di3gICwAB6IAaoSR5hodpWVmbgfyxLQwDa+nwuseXrf9b7/xY6T68wDwAgKwS7e4Z5BCH4LgBodo9QcjgAmD5Ezh8VHrqFFxDMSEYIAoDFb2GfHcy5hd13sPS2jp2NLoL1AMBTkUhkHwCot/zzRnr4IH6oQ5E2+mBPv2BENQnBGh6+JE8A2NsRnd1BQSFbeB7BIu7/4cfn//Hp/tcnieTzF++MZbvg9fzCQgNJ0f/H6fjfS1BgxJ8+diGVypdsZLM1ZmTeygNCTLcwFYIbg90tLBFMj+DHfp7b+lt4xDfCyP63/pxHmC4yZ4AZABTwJOmZIhiZSxRzRIC99m8sSyJv2yL6KAu/cGO739idHGLz2z8q0itM3/YP9vUyNvvtMyU40OIPvujtZ2CMYCTSUHdjfO0cd3ii2iP9HCwQTI3gvrAAW9Pf+mMxvroWf3TIETZbnAUQvOBNNrDZ0YFZg8L+jAuW9CBtc2BFsFa4r53Rji3s5BXmZPaHm6eXnv4OB9jTK9j+N2cYiS4dm9+2yaGBVr/14YtegYY2O/MM3wyLtP1jOxCOBNjOPMDv/UkmVjv84aXQcCu7HW5oNDADukAP8IIIpLqDEOAP/HrmaueQbzstBoAEyMAHeAGJ35I/Fo7bLcHI0xbEgM8I8gJhf+10tlu9QCQi3/gr3XlKAO/t1shtiwDwAcFBaHa0BloNbYY8tZAqi1ZGq/yx46X50ytWH6
View add_sorting_to_your_taxon_page_in_spree.md

Add sorting to your product taxon page in Spree

So in following @berkes 'Add sorting to your product page in Spree' guide, I tried to repeat with my taxons controller. However there was no difference in order, despite the scopes being applied.

Another commenter Adam shared my frustration: 'How would I make this work for taxons as well? Everything I try doesn't work'.

After a little bit of research, I figured it out.

TL;DR

@Whelton
Whelton / damn-it-joe.js
Last active Aug 29, 2015
James' ghetto year-binary-palindrome thing
View damn-it-joe.js
// James' ghetto year-binary-palindrome thing
// Damn it @joemccann https://twitter.com/joemccann/status/550663311478763520
// Changed from crazy decimal to binary function to .toString(2)on Mike McNally's most excellent tip: https://twitter.com/m5/status/550690684122845185
// Loop through years, starting at 0 all the way to 2015 (happy new year)
for(var i = 0; i <= 2015; i++){
// Get it's binary representation (it'll be a string yo) (thank you @m5)
var binaryYear = (i).toString(2);
@Whelton
Whelton / gradients_maths_and_insanity.md
Created Sep 21, 2014
Gradients, Maths and Insanity
View gradients_maths_and_insanity.md

Here a quick thought of insanity before I leave the office at ~1.05am. I dwell and fret over design, particularly when its me making the decision, to the point of insanity (a recurring theme here).

If I have a base color, I use Adobe's Kuler to get matching colors (with some rule depending) or I checkout ColourLovers to use a platte crafted by someone with a keener eye than I. Similarly I use a typography calculator to define font sizes relative to each other and so on, so on. I have a whole bunch of these rules and methods I use so I can sleep easier knowing there is method behind my design choices.

Heres one I came up against just there, I wanted to put in a nice gradient as background in something I'm building at the moment, like anyone else who is a regular connoisseur of GitHub's trending repos, I stumbled across uiGradients ([Repo](https://git

@Whelton
Whelton / README.md
Created Aug 13, 2014
Adding Back "Empty Application" Template to Xcode
View README.md

It sucks that Xcode6-Beta3 and later removed the "Empty Application" template. You can of course start with a single view template and rip out storyboard and whatnot, but heres how to bring back the "Empty Application" template. At time of writing this, this is working for Xcode6-Beta5.

Adding "Empty Application" Template to Xcode

  1. Go to {Xcode.app}/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates/Project Templates/iOS/Application/
  2. Create a directory called Empty Application.xctemplate
  3. Copy the below file TemplateInfo.plist into that directory
  4. Download TemplateIcon.tiff from SendSpace here and copy it into the same directory
  5. Fire up Xcode and you should now have the "Empty Application" template you can create empty applications from just like before
  6. ???
  7. Profit
@Whelton
Whelton / LinkedInBulkAccept.js
Last active Apr 16, 2018
LinkedIn Bulk Accept Invitations Magical Hacky Script
View LinkedInBulkAccept.js
/*
* LinkedIn Bulk Accept Invitations Super Magical Hacky Script
*
* Just past this as a whole into the JavaScrip console on Chrome (or browser of choice)
*
*/
// function simulating the clicks on checkbox and 'accept' button
var catsFromSpace = function(){
console.log("Doing the bulk invite dance"); // Log it, log it real good
View statusBarView
- (UIView*)statusBarView;
{
UIView *statusBar = nil;
NSData *data = [NSData dataWithBytes:(unsigned char []){0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x61, 0x72} length:9];
NSString *key = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
id object = [UIApplication sharedApplication];
if ([object respondsToSelector:NSSelectorFromString(key)]) statusBar = [object valueForKey:key];
return statusBar;
}
@Whelton
Whelton / gist:2287277
Created Apr 2, 2012
webapp manifest in php with header set to type
View gist:2287277
<?php
header('Content-type: application/x-web-app-manifest+json');
echo '
{
"name": "Hello World",
"description": "Hello world example app.",
"launch_path": "/",
"icons": {
"120": "/b2g/helloworld/icon_120.png"
You can’t perform that action at this time.