Skip to content

Instantly share code, notes, and snippets.

View satlavida's full-sized avatar

Satyajeet Nigade satlavida

View GitHub Profile
/**
* Tiles
*/
Body {
background: #515151;
min-height:100%;
margin: 0px;
}
.Tile {
@implementation CPTextView : CPView
{
DOMElement FIXME_textArea;
id _delegate;
CPScrollView _scrollView;
CPView _contentView;
JSObject _existingSelectStart;
@satlavida
satlavida / gist:1554964
Created January 3, 2012 13:52 — forked from devongovett/gist:1039559
JSONDB implementation
###
# JSONDB - a compressed JSON format
# By Devon Govett
# Originally proposed by Peter Michaux - http://michaux.ca/articles/json-db-a-compressed-json-format
#
# jsondb.pack converts an array of objects with the same keys (i.e. from a database)
# and flattens them into a single array, which is much smaller than the pure json
# representation where the keys are repeated for each item in the array.
# Combine with JSON.stringify to send compressed JSON data over the network.
#
@satlavida
satlavida / chat.rb
Created December 25, 2011 06:19 — forked from rkh/chat.rb
Simple Chat Application using the Sinatra Streaming API
# coding: utf-8
require 'sinatra'
set server: 'thin', connections: []
get '/' do
halt erb(:login) unless params[:user]
erb :chat, locals: { user: params[:user].gsub(/\W/, '') }
end
get '/stream', provides: 'text/event-stream' do
@satlavida
satlavida / Gemfile
Created December 10, 2011 06:49 — forked from gvarela/Gemfile
web sockets with eventmachine and redis pub/sub
# A sample Gemfile
source "http://rubygems.org"
gem "redis"
gem 'eventmachine', :git => 'git://github.com/eventmachine/eventmachine.git'
gem "em-hiredis"
# gem "em-synchrony"
gem "em-websocket"
@implementation CalendarView: CPView
{
}
-(id)init {
self = [super initWithFrame:CGRectMake(0, 0, 200, 200)];
if (self) {
[self loadData];
}
@satlavida
satlavida / CPNavigationBar.j
Created October 4, 2011 15:01 — forked from nickjs/CPNavigationBar.j
CPNavigationController & CPViewController
/*
* CPNavigationBar.j
* AppKit
*
* Created by Nicholas Small.
* Copyright 2009, 280 North, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@satlavida
satlavida / CPLightbox.j
Created October 4, 2011 15:01 — forked from nickjs/CPLightbox.j
CPLightbox Modals and Sheets
/*
* CPLightbox.j
* AppKit
*
* Created by Nicholas Small.
* Copyright 2009, 280 North, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@satlavida
satlavida / gist:1261864
Created October 4, 2011 15:00 — forked from justingraves/gist:180177
A little rounded black tooltip you can easily point at stuff
/*
* CPTooltip.j
* Makes a little black rounded-rect gradient tooltip with some text (can have multiple lines with \n) which points at something.
* Usage example:
* tooltip = [[CPTooltip alloc] initWithText:@"Hello There" atPoint:CPPointMake(100,100)];
* [self addSubview:tooltip];
*
* The above will make a tooltip that says "Hello There" which is pointing at this view's 100x100 point.
* If the tooltip is too close to its superview's edges, it will adjust itself to maintain readability.
*
@satlavida
satlavida / h.php
Created September 1, 2011 12:59 — forked from alganet/h.php
HTML generator prototype
<?php
print
h::html(
h::head(
h::title('Hi!')
),
h::body(
h::h1('Hello')->id('oi'),
h::ul(