Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.
| Ctrl+C | copy current line (if no selection) |
| Ctrl+X | cut current line (if no selection) |
| Ctrl+⇧+K | delete line |
| Ctrl+↩ | insert line after |
| import urllib2 as u | |
| import json | |
| def GeoCode(address): | |
| """Returns Latitude and Longitude of the address using | |
| Google Maps Gecoding API | |
| """ | |
| api = "http://maps.googleapis.com/maps/api/geocode/json?address=" | |
| address = str(address.replace(" ","+")) | |
| url = api + address + "&sensor=false" |
| """Problem 112 http://bit.ly/dSvkG8 | |
| """ | |
| #increasing number | |
| def isInc(n): | |
| s = str(n) | |
| for i,x in enumerate(s): | |
| if i: | |
| if s[i] < s[i-1]: | |
| return False | |
| return True |
| """Find occurrence of an item in a list using Functional, Library & Imperative approach and compare the time. | |
| """ | |
| import time | |
| def runtime(func, *args): | |
| t=time.clock() | |
| func(*args) | |
| s=time.clock()-t | |
| return s |
| """Closing the loop | |
| http://code.google.com/codejam/contest/dashboard?c=837485#s=p0 | |
| """ | |
| def nmax(l,n): | |
| """Find sum of n highest numbers from list l | |
| """ | |
| if l and n <= len(l): | |
| temp = l[:] | |
| temp.sort() | |
| temp.reverse() |
| """Find the largest palindrome made from the product of two 3-digit numbers.""" | |
| from itertools import combinations as cnr | |
| print max([ x*y for (x,y) in cnr(range(100,999),2) if str(x*y) == str(x*y)[::-1]]) |
| #import <Foundation/Foundation.h> | |
| int main (int argc, const char *argv[]) | |
| { | |
| @autoreleasepool { | |
| NSLog(@"Hello World"); | |
| } | |
| } |
Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.
| Ctrl+C | copy current line (if no selection) |
| Ctrl+X | cut current line (if no selection) |
| Ctrl+⇧+K | delete line |
| Ctrl+↩ | insert line after |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> | |
| <title>Raindrops</title> | |
| <script type="text/javascript" src="https://github.com/mbostock/d3/raw/v1.4.0/d3.js"></script> | |
| <style type="text/css"> | |
| body { | |
| background: #012; |
| object NumberToWords { | |
| val units = List("one", "two", "three", "four", | |
| "five", "six", "seven", "eight", "nine") | |
| val teens = List("ten", "eleven", "twelve", "thirteen", | |
| "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen") | |
| val tens = List("twenty", "thirty", "forty", | |
| "fifty", "sixty", "seventy", "eighty", "ninety") | |
| def main(args: Array[String]) { |
| with open('sample.txt') as fi: | |
| dct = {} | |
| header = fi.readline() | |
| """Couldn't figure what this row is for | |
| """ | |
| rec1 = fi.readline() | |
| for line in fi.readlines(): | |
| x = line.split()[1:5] | |
| key = ",".join(x) | |
| dct[key] = dct.get(key, 0) + 1 |