Skip to content

Instantly share code, notes, and snippets.

View tilomitra's full-sized avatar
👋

Tilo Mitra tilomitra

👋
View GitHub Profile
//This will add the addButton on the rightmost corner of the UIToolbar (toolbar)
UIBarButtonItem *addButton = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addTasks:)];
UIBarButtonItem *BtnSpace = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil];
[toolbar setItems:[NSArray arrayWithObjects:BtnSpace,addButton, nil] animated:YES];
//The first example is adding a subview to your MainWindow nib so that it loads a nib from another view controller.
//The following code goes in the AppDelegate.m under the following method
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch
[window addSubview:switchViewController.view]; //replace switchViewController with your own viewController
[window makeKeyAndVisible];
return YES;
<!DOCTYPE html>
<html>
<head>
<title>Getting data back with Datasource</title>
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/3.2.0/build/cssreset/reset-min.css">
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/3.2.0/build/cssbase/base-min.css">
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/3.2.0/build/cssgrids/grids-min.css">
<link rel="stylesheet" type="text/css" href="styles.css">
/*Gradient Text in Webkit*/
.gradient {
font-size: 100px;
background: -webkit-gradient(linear, left top, left bottom, from(white), to(black));
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
/*Inset Text*/
.inset {
@tilomitra
tilomitra / dd-plugin.js
Created May 20, 2011 21:18
YUI Drag Plugin for Y.Node and Y.Widget
/**
* Simple Drag plugin that can be attached to a Node or Widget via the plug method.
* @module dd
* @submodule dd-plugin
*/
/**
* Simple Drag plugin that can be attached to a Node or Widget via the plug method.
* @class Drag
* @extends DD.Drag
@tilomitra
tilomitra / YUI-Animated-Panel-Timers.html
Created June 22, 2011 00:40
A basic implementation on how to make a sliding panel using JS Timers in YUI3.3.0, a la Twitter.
<!DOCTYPE html>
<meta charset="utf-8">
<head>
<script type="text/javascript" src="http://yui.yahooapis.com/3.3.0/build/yui/yui-min.js"></script>
<style>
body {
font-family: "HelveticaNeue-Light", "Helvetica Neue Light",
"Helvetica Neue", sans-serif;
@tilomitra
tilomitra / YUI-Animated-Panel-CSS.html
Created June 22, 2011 01:58
A basic implementation on how to make a sliding panel using CSS Transitions and YUI3.3.0, a la Twitter.
<!DOCTYPE html>
<meta charset="utf-8">
<head>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="default" />
<meta name="apple-touch-fullscreen" content="yes" />
<meta name="viewport" content="width=device-width,maximum-scale=1.0" />
<meta name = "viewport" content = "initial-scale = 1.0, user-scalable = no">
<script type="text/javascript" src="http://yui.yahooapis.com/3.3.0/build/yui/yui-min.js"></script>
@tilomitra
tilomitra / component.json
Created August 10, 2011 23:48
component.json for panel
{
"name" : "panel",
"displayName": "Panel",
"description": "The Panel is a UI Control that is meant to behave similarly to an OS window. The Panel control extends the functionality of Overlay, adding support for modality, close/dismiss buttons, autohiding and autofocus. Plugins to make it draggable and resizable are supported as well. Panel includes a pre-defined stylesheet to support default look and feel characteristics.",
"author" : "tilomitra",
"tags": ["widget", "beta", "panel", "extension"],
"use" : ["panel"],
"examples" : [
@tilomitra
tilomitra / scrollview.js
Created August 26, 2011 23:47
YUI3 Scrollview config to make scrolling feel smoother
var scrollView = new Y.ScrollView({
srcNode: '#resultList',
height: 260,
flick: {
minDistance:1,
minVelocity:0.4,
axis: "y"
},
deceleration: 0.983,
bounce:0.65,
@tilomitra
tilomitra / categorizeLikes.m
Created February 4, 2012 09:42
Categorizing Facebook Likes into an NSMutableDictionary
/*
This method takes a NSDictionary of likes returned by facebook and returns an NSMutableDictionary of NSArrays, where
each key in the dictionary corresponds with a "category"
For example:
{
"company": [{} , {} , {} ],
"song": [ {} , {} ]
}