Skip to content

Instantly share code, notes, and snippets.

View jmyrland's full-sized avatar

Jørn A. Myrland jmyrland

View GitHub Profile
@alex-cellcity
alex-cellcity / Version.m
Created May 30, 2011 04:55
Runtime iOS Version Checking
/*
* System Versioning Preprocessor Macros
*/
#define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)
@johnathan-sewell
johnathan-sewell / episerver-recursive-methods.cs
Created May 13, 2012 13:59
EPiServer tree recursive methods
protected static void FindDescendantsOfType<T>(PageData page, ICollection<T> descendants) where T : class
{
var children = DataFactory.Instance.GetChildren(page.PageLink);
foreach (var child in children)
{
if (child is T)
{
descendants.Add(child as T);
}
FindDescendantsOfType(child, descendants);
@jimmynotjim
jimmynotjim / gist:3666470
Created September 7, 2012 13:59
Use Modernizr to conditionally use Columnizer.js when css columns aren't supported
<script type="text/javascript">
//
// Requires Modernizr, jquery, and columnizer.js
// http://modernizr.com (Requires a production version, demo doesn't include yep/nope)
// http://jquery.com
// http://welcome.totheinter.net/columnizer-jquery-plugin/
//
// Replace [url], [target], and [options] w/ your specific needs
//
@kreeger
kreeger / BDKCollectionIndexView.m
Created February 11, 2013 17:19
An index-title-scrubber-bar, for use with a UICollectionView (or even a PSTCollectionView). Gives a collection view the index title bar that a UITableView gets for (almost) free. A huge thank you to @yang from http://stackoverflow.com/a/14443540/194869, which saved my bacon here.
/*
* BDKCollectionIndexView.h
*/
#import <UIKit/UIKit.h>
/** The direction in which the control is oriented. Assists in determining layout values.
*/
typedef enum {
BDKCollectionIndexViewDirectionVertical = 0,

BDKCollectionIndexView

An index-title-scrubber-bar, for use with a UICollectionView (or even a PSTCollectionView). Gives a collection view the index title bar for -sectionIndexTitles that a UITableView gets for (almost) free. A huge thank you to @Yang from [this Stack Overflow post][so], which saved my bacon here.

The problem

When you're using a UITableView and you define the UITableViewDataSource method -sectionIndexTitlesForTableView:, you get a sweet right-hand-side view for scrubbing through a long table view of fields, separated by sections. The titles are the names of the sections, by default (or at least letters based on the section names).

UITableView with section index titles

@tedmiston
tedmiston / nodejs-tcp-example.js
Last active May 20, 2024 11:27
Node.js TCP client and server example
/*
In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp
server, but for some reason omit a client connecting to it. I added an
example at the bottom.
Save the following server in example.js:
*/
var net = require('net');
@timothyarmes
timothyarmes / gist:7080170
Last active March 27, 2022 03:28
An implementation of a UINavigationBar subclass for iOS7 which creates a taller navigation bar suitable for adding extra controls underneath the title.The appearance proxy is used for shifting the title and bar button items back up to their original vertical position.Note that it's easy to specify your subclass in XCode: clicking on the UINaviga…
#define kAppNavBarHeight 66.0
@implementation TATallNavigationBar
- (id)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if (self) {
[self setupAppearance];
}
@rxaviers
rxaviers / gist:7360908
Last active June 6, 2024 10:33
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@asbjornenge
asbjornenge / nanodom.js
Last active December 31, 2015 22:29
Nanodom.js - a very small dom manipulation library.
define([], function() {
function dom() {}
dom.prototype = new Array;
dom.prototype.append = function(element) { element.map(function(e) { this[0].appendChild(e) }.bind(this)); return this}
dom.prototype.remove = function() { this.map(function(e) {e.parentNode.removeChild(e)}); return this}
dom.prototype.prepend = function(element) { element.map(function(e) { this[0].insertBefore(e, this[0].childNodes[0]) }.bind(this)); return this}
dom.prototype.empty = function(elements) { this.map(function(e) { e.innerHTML = ""}); return this}
dom.prototype.addClass = function(classes) { this.map(function(e) { e.className += ' '+classes}); return this}
dom.prototype.removeClass = function(classes) {
@ArsenArts
ArsenArts / Long-Shadows-for-Font-Awesome.markdown
Created March 13, 2014 11:36
A Pen by Arsen Zbidnyakov.