Skip to content

Instantly share code, notes, and snippets.

View shsteven's full-sized avatar

Steven Zhang shsteven

View GitHub Profile
@shsteven
shsteven / gist:781715
Created January 16, 2011 11:42
Making the background cool
UIView *view = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 100)] autorelease];
CAGradientLayer *gradient = [CAGradientLayer layer];
gradient.frame = view.bounds;
gradient.colors = [NSArray arrayWithObjects:(id)[[UIColor blackColor] CGColor], (id)[[UIColor whiteColor] CGColor], nil];
[view.layer insertSublayer:gradient atIndex:0];
@shsteven
shsteven / DCModelSegue.podspec
Last active December 19, 2015 22:19
DCModelSegue Podspec with iOS5 Support
Pod::Spec.new do |s|
s.name = "DCModalSegue"
s.version = "0.0.2"
s.summary = "A custom segue which makes a 'pushed back' modal presenting animation."
s.homepage = "https://github.com/zetachang/DCModalSegue"
s.license = 'MIT'
s.authors = {"David Chang" => "zeta11235813@gmail.com"}
s.source = { :git => "https://github.com/zetachang/DCModalSegue.git", :tag => "0.0.2" }
s.platform = :ios, '5.0'
s.source_files = 'DCModalSegue/*.{h,m}'
@shsteven
shsteven / NSObjecDictionaryRepresentation
Created August 26, 2013 14:08
NSObject+DictionaryRepresentation
@implementation NSObject (TSDictionaryRepresentation)
/**
Turns an object into NSDictionary, for API requests
*/
- (NSDictionary *)dictionaryRepresentationWithMapping: (NSDictionary *)mapping {
NSMutableDictionary *mutableDict = [NSMutableDictionary new];
[mapping enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
@shsteven
shsteven / MTStatusBarOverlay.podspec
Last active December 23, 2015 19:09
MTStatusBarOverlay master branch
Pod::Spec.new do |s|
s.name = 'MTStatusBarOverlay'
s.version = '0.9.1.1'
s.platform = :ios
s.summary = 'A custom iOS status bar overlay seen in Apps like Reeder, Evernote and Google Mobile App.'
s.homepage = 'https://github.com/shsteven/MTStatusBarOverlay'
s.author = { 'Matthias Tretter' => 'myell0w@me.com' }
s.source = { :git => 'https://github.com/myell0w/MTStatusBarOverlay.git', :branch => 'master', :tag => '0.9.1.1' }
s.description = 'This class provides a custom iOS (iPhone + iPad) status bar overlay window known from ' \
@shsteven
shsteven / MagicalRecord.podspec
Last active December 24, 2015 01:29
MagicalRecord develop branch
Pod::Spec.new do |s|
s.name = 'MagicalRecord'
s.version = '2.2.1-develop'
s.license = 'MIT'
s.summary = 'Super Awesome Easy Fetching for Core Data 1!!!11!!!!1!.'
s.homepage = 'http://github.com/magicalpanda/MagicalRecord'
s.author = { 'Saul Mora' => 'saul@magicalpanda.com' }
s.source = { :git => 'https://github.com/magicalpanda/MagicalRecord.git',:branch=>'develop' }
s.description = 'Handy fetching, threading and data import helpers to make Core Data a little easier to use.'
s.source_files = 'MagicalRecord/**/*.{h,m}'
@shsteven
shsteven / MCPanelViewController.podspec
Created October 11, 2013 08:59
Sample Podspec for MCPanelViewController
Pod::Spec.new do |s|
s.name = 'MCPanelViewController'
s.version = '0.1' # modify accordingly
s.platform = :ios
s.summary = 'Drop-in panel control for iOS with blurring background and screen-edge activation gestures.'
s.homepage = 'https://github.com/mehsome/MCPanelViewController'
s.author = { 'Matthew Cheok' => 'your@email.address' }
s.source = { :git => 'https://github.com/mehsome/MCPanelViewController.git', :branch => 'master', :tag => '0.1' }
s.description = 'Drop-in panel control for iOS with blurring background and screen-edge activation gestures.'
@shsteven
shsteven / 0_reuse_code.js
Created March 12, 2014 01:34
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@shsteven
shsteven / css_resources.md
Created March 12, 2014 01:50 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides

@shsteven
shsteven / javascript_resources.md
Created March 12, 2014 01:50 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
function getTrilateration(position1, position2, position3) {
var xa = position1.x;
var ya = position1.y;
var xb = position2.x;
var yb = position2.y;
var xc = position3.x;
var yc = position3.y;
var ra = position1.distance;
var rb = position2.distance;
var rc = position3.distance;