Skip to content

Instantly share code, notes, and snippets.

var gistPrefix = 'https://gist.github.com/',
// Cache document.write so that it can be restored once all Gists have been
// embedded.
cachedWrite = document.write,
body = $('body'),
// Map each p.gist to an object that contains the paragraph to be replaced
// and the Gist's identifier.
gists = $('a.gist').map(function(n, a) {
a = $(a);
var href = a.attr('href');
@jonathan-beebe
jonathan-beebe / SassMeister-input.scss
Created July 21, 2014 18:03
Generated by SassMeister.com.
// ----
// Sass (v3.3.10)
// Compass (v1.0.0.alpha.20)
// ----
@mixin item-generator ($n, $i: 1) {
@while $i <= $n {
.item--block--#{$i} {
@extend %item;
.item {
@jonathan-beebe
jonathan-beebe / SassMeister-input.scss
Created July 21, 2014 18:03
Generated by SassMeister.com.
// ----
// Sass (v3.3.10)
// Compass (v1.0.0.alpha.20)
// ----
@mixin item-generator ($n, $i: 1) {
@while $i <= $n {
.item--block--#{$i} {
@extend .item;
.item {
@jonathan-beebe
jonathan-beebe / SassMeister-input.scss
Created August 6, 2014 13:24
Generated by SassMeister.com.
// ----
// Sass (v3.3.14)
// Compass (v1.0.0.rc.1)
// ----
$text-base: (
font-size: 1.0rem,
line-height: 1.8rem,
font-weight: normal,
text-color: #333
@jonathan-beebe
jonathan-beebe / SassMeister-input.scss
Created August 7, 2014 12:46
Generated by SassMeister.com.
// ----
// Sass (v3.3.14)
// Compass (v1.0.0.rc.1)
// ----
//
// Code from http://thesassway.com/intermediate/a-standard-module-definition-for-sass
//
// # Thoughts
//
@jonathan-beebe
jonathan-beebe / UIImage+NegativeImage.h
Created October 8, 2014 18:55
UIImage category for inverting the image
// Retina-ready version of this StackOverflow answer
// http://stackoverflow.com/a/6672628/123781
#import <UIKit/UIKit.h>
@interface UIImage (NegativeImage)
- (UIImage *)negativeImage;
@end
@jonathan-beebe
jonathan-beebe / UIView+FindSubview.h
Created October 8, 2014 18:57
Helpful category for finding a subview during a gesture
#import <UIKit/UIKit.h>
typedef BOOL (^TestViewCallback)(UIView*);
@interface UIView (FindSubview)
- (UIView*) findSubviewWithTest:(TestViewCallback)callback;
- (BOOL) hitByGesture:(UIGestureRecognizer*)recognizer;
@end
@jonathan-beebe
jonathan-beebe / TableViewCellWithAutoLayout.m
Created January 8, 2015 20:46
Using UITableViewCell with dynamic height & autolayout
// https://github.com/smileyborg/TableViewCellWithAutoLayout/blob/master/TableViewCellWithAutoLayout/TableViewController/RJTableViewController.m
// http://stackoverflow.com/a/18746930/123781
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
// This project has only one cell identifier, but if you are have more than one, this is the time
// to figure out which reuse identifier should be used for the cell at this index path.
NSString *reuseIdentifier = CellIdentifier;
// Use the dictionary of offscreen cells to get a cell for the reuse identifier, creating a cell and storing
@jonathan-beebe
jonathan-beebe / UIVIew+Layout Example.m
Last active August 29, 2015 14:23
A set of NSArray category methods (for arrays of UIViews) to automatically layout auto-hugging rows or columns. Requires PureLayout.
// Example — say you had some content for a scrollView.
// Create a contentView and add each row as a subview.
// Then simply call the category method on the subviews array to layout
// the subviews as rows.
//
// This requires that the contentView be setup via autolayout to
// properly pin to the scrollView.
[contentView addSubviews:@[
viewA,
@jonathan-beebe
jonathan-beebe / debug_functions.h
Created July 6, 2015 18:46
Log all fonts & colors of view
void logFonts(UIView* view);
void logColors(UIView* view);