Skip to content

Instantly share code, notes, and snippets.

View andrewjamesford's full-sized avatar

Andrew Ford andrewjamesford

View GitHub Profile
@andrewjamesford
andrewjamesford / gist:4141514
Created November 24, 2012 21:46 — forked from hileon/gist:1311735
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Windows)

General

Ctrl+KB toggle side bar
Ctrl+Shift+P command prompt
Ctrl+` python console
Ctrl+N new file

Editing

@andrewjamesford
andrewjamesford / gist:4408808
Created December 29, 2012 19:22
Show the iOS activity indicator animation
UIActivityIndicatorView *ai = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
ai.center = self.view.center;
[ai startAnimating];
[self.view addSubview:ai];
var Mosaic = ( function () {
return {
init: function( $id ) {
this.cacheElements($id);
this.bindEvents();
},
cacheElements: function($id) {
this.$mosaicTileLink = $($id);
},
bindEvents: function() {
@andrewjamesford
andrewjamesford / functions.php
Created January 30, 2013 12:01
jQuery from the Google CDN for Wordpress
//jQuery Insert From Google
if (!is_admin()) add_action("wp_enqueue_scripts", "my_jquery_enqueue", 11);
function my_jquery_enqueue() {
wp_deregister_script('jquery');
wp_register_script('jquery', "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . "://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js", false, null);
wp_enqueue_script('jquery');
}
@andrewjamesford
andrewjamesford / spacing.scss
Created March 13, 2013 07:50
A SCSS version of the spacing classes used in OOCSS
/* spacing helpers
p,m = padding,margin
a,t,r,b,l,h,v = all,top,right,bottom,left,horizontal,vertical
s,m,l,n = small(5px),medium(10px),large(20px),none(0px)
*/
$spacing-none: 0;
$spacing-small: 5px;
$spacing-medium: 10px;
$spacing-large: 20px;
@andrewjamesford
andrewjamesford / iemenu.js
Created April 23, 2013 21:22
Little polyfill to add classes for old IE browsers that don't support Nth child and other pseudo CSS selectors.
var iemenu = (function () {
return {
init: function () {
this.cacheElements();
this.addClasses();
},
cacheElements: function () {
this.$navigation = $('#navigation');
this.$navItems = $('.nav1Top');
},
@mixin css-triangle($triangle-size, $triangle-color, $triangle-direction) {
content: "";
display: block;
width: 0;
height: 0;
border: solid $triangle-size;
@if ($triangle-direction == top) {
border-color: $triangle-color transparent transparent transparent;
}
@if ($triangle-direction == bottom) {
@andrewjamesford
andrewjamesford / entypo.css
Created April 25, 2013 09:37
Enytpo font - Grabbed from fontello.com
@charset "UTF-8";
@font-face {
font-family: 'entypo';
src: url("../font/entypo/entypo.eot");
src: url("../font/entypo/entypo.eot#iefix") format('embedded-opentype'),
url("../font/entypo/entypo.woff") format('woff'),
url("../font/entypo/entypo.ttf") format('truetype'),
url("../font/entypo/entypo.svg#entypo") format('svg');
font-weight: normal;
<html>
<head>
<style>
.main { ... }
.leftnav { ... }
/* ... any other styles needed for the initial render here ... */
</style>
<script>
// Any script needed for initial render here.
// Ideally, there should be no JS needed for the initial render
- (void)viewDidLoad
{
UIImage *menuButtonImage = [UIImage imageNamed:@"list.png"];// set your image Name here
UIButton *btnToggle = [UIButton buttonWithType:UIButtonTypeCustom];
[btnToggle setImage:menuButtonImage forState:UIControlStateNormal];
btnToggle.frame = CGRectMake(0, 0, menuButtonImage.size.width, menuButtonImage.size.height);
UIBarButtonItem *menuBarButton = [[UIBarButtonItem alloc] initWithCustomView:btnToggle];
[btnToggle addTarget:self action:@selector(toggleCalendar) forControlEvents:UIControlEventTouchUpInside];
self.navigationItem.leftBarButtonItem = menuBarButton;
}