Skip to content

Instantly share code, notes, and snippets.

View jineshpaloor's full-sized avatar

Jinesh Panampattakunnath jineshpaloor

View GitHub Profile
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
# C extensions
*.so
# Distribution / packaging
.Python
env/
mport datetime
import mongoengine
from invoicing.const import DATE_FORMAT
black_listed_fields = [
"auth_token", "avatar", "deleted_at", "google_id", "last_login_at", "password"
]

footer: Nordic Ruby | @raganwald slidenumbers: true

original

^ © 2016 Reginald Braithwaite. Some rights reserved.


Optimism

/**
* JavaScript Client Detection
* (C) viazenetti GmbH (Christian Ludwig)
*/
(function (window) {
{
var unknown = '-';
// screen
@jineshpaloor
jineshpaloor / copy_files_to_dest_folder.py
Created November 12, 2015 04:34
script to copy all files from one folder by traversing recursively to another folder
import os
from shutil import *
rootdir = '/Users/jineshn/tools/Images.xcassets'
for subdir, dirs, files in os.walk(rootdir):
for file in files:
fn = os.path.join(subdir, file)
print fn
copyfile(fn, '/Users/jineshn/tools/output/'+file)
-------------------------------------------------------------------------------------
// using alamofire
Alamofire.request(.GET, Constants.Keys.BASE_URL+"/giftcards", headers: header, encoding: .JSON).validate().responseJSON() { response in
if let error = response.result.error {
self.fetchFailure(error.code, errorBody: error.description)
return
}
let json = JSON(response.result.value!)
@jineshpaloor
jineshpaloor / didSet.swift
Created November 6, 2015 05:58
example to show how does didSet and willSet work
var v : Int = 0 {
didSet{
print("didSet called \(v)")
}
willSet(newValue){
if (newValue != v){
print("value changed")
} else {
print("value not changed")
}
@jineshpaloor
jineshpaloor / find_distance.py
Last active October 11, 2015 10:15
Script to find distance between any two places in globe using google map api
import os
import sys
import json
import math
import urllib
import urllib2
def find_coords(address):
"""
@jineshpaloor
jineshpaloor / gcloud.sh
Created September 24, 2015 03:53
gcloud commands
# login in to gcloud instance
gcloud compute --project "lda-cis" ssh --zone "us-central1-f" "instance-1"
gcloud compute --project "lda-cis" ssh --zone "us-central1-f" "instance-2"
# scp in gcloud
gcloud compute --project "lda-cis" copy-files --zone "us-central1-f" "instance-1":/home/rajareddykarri/enwiki-20150805-pages-articles.xml.bz2 .
@jineshpaloor
jineshpaloor / pubsub.py
Created September 3, 2015 05:25
Implementation of python pubsub library - publisher subscriber
# -*- coding: utf-8 -*-
#==============================================================================
# Name: pubsub
#
# Purpose: Simple publish & subscribe in pure python
#
# Author: Zhen Wang
#
# Created: 23 Oct 2012
# Copyright: