Skip to content

Instantly share code, notes, and snippets.

@zsrinivas
zsrinivas / test.py
Last active August 29, 2015 14:23 — forked from d30jeff/test.py
items = ['name', 'flowrate', 'temperature', 'power', 'log_time', 'created_on']
csv_data = reduce(add, map(lambda x: reduce(add, map(str, map(x.get, items))), json_format))
@zsrinivas
zsrinivas / fastIOs.cpp
Last active August 29, 2015 14:16 — forked from avamsi/fastIOs.cpp
template <class number>
void input(number *ptr){
register char c = getchar_unlocked();
while (c < 33)
c = getchar_unlocked();
*ptr = 0;
while (c > 33){
*ptr = (*ptr * 10) + (c - '0');
c = getchar_unlocked();
}
@zsrinivas
zsrinivas / fastIO.cpp
Last active August 29, 2015 14:11 — forked from avamsi/fastIO.cpp
#include <bits/stdc++.h>
template <class number>
void input(number *ptr)
{
register char c = getchar_unlocked();
while (c < 33)
c = getchar_unlocked();
*ptr = 0;
while (c > 33)
{

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
/*
* Euler's totient function phi(n).
* http://en.wikipedia.org/wiki/Euler%27s_totient_function
*
* This is an *EXTREMELY* fast function and uses
* several tricks to recurse.
*
* It assumes you have a list of primes and a fast
* isprime() function. Typically, you use a bitset
* to implement the sieve of Eratosthenes and use
This is the list of exit codes for wget:
0 No problems occurred
1 Generic error code
2 Parse error — for instance, when parsing command-line options, the .wgetrc or .netrc…
3 File I/O error
4 Network failure
5 SSL verification failure
6 Username/password authentication failure
7 Protocol errors

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

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
@zsrinivas
zsrinivas / 0_reuse_code.js
Created May 24, 2014 04:24
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