Skip to content

Instantly share code, notes, and snippets.

View psaitu's full-sized avatar
👋
hello!

Prabhu Saitu psaitu

👋
hello!
View GitHub Profile
@psaitu
psaitu / podforceupdate.sh
Created March 10, 2016 09:18 — forked from mbinna/podforceupdate.sh
Clear CocoaPods cache, re-download and re-install all pods
#!/usr/bin/env bash
rm -rf "${HOME}/Library/Caches/CocoaPods"
rm -rf "`pwd`/Pods/"
pod update
@psaitu
psaitu / PSCornerFlowLayout.swift
Last active January 25, 2016 05:51
Corner Flow Layout In Swift
import UIKit
class CornerFlowLayout: UICollectionViewFlowLayout {
var itemTransform:CGFloat!
override func layoutAttributesForElementsInRect(rect: CGRect) -> [UICollectionViewLayoutAttributes]? {
<form action="http://localhost:3000/submit/your@email.com"
method="POST">
<input type="text", placeholder="Name", name="user[name]">
<input type="text", placeholder="Email", name="user[email]">
<input type="text", placeholder="Mobile", name="user[mobile]">
<input type="textarea", placeholder="Message", name="user[message]">
<select name="queryType">
<option value="A">A</option>
<option value="B">B</option>
<option value="C">C</option>
import {Component, View, CORE_DIRECTIVES} from 'angular2/angular2';
import {ROUTER_PROVIDERS, ROUTER_DIRECTIVES, RouterLink} from 'angular2/router';
let templateHTML = require('./SidebarComponent.html');
@Component({
selector: 'SidebarComponent',
inputs: [
'title',
'items'
@psaitu
psaitu / MultiwayTree.py
Last active September 12, 2015 07:13
Representation of Trees
"""
>>> Tree = test_listing_2_8()
>>> t = Tree(Tree("a", Tree("b", Tree("c", Tree("d")))))
>>> t.kids.next.next.val
'c'
"""
class Tree:
def __init__(self, kids, next=None):
self.kids = self.val = kids
@psaitu
psaitu / Adjacency Matrix Implemented With Nested Lists
Last active September 12, 2015 06:38
Representing Graphs As Adjacency Matrices
a, b, c, d, e, f, g, h = range(8)
N = [
[0, 1, 1, 1, 1, 1, 0, 0],
[0, 0, 1, 0, 1, 0, 0, 0],
[0, 0, 0, 1, 0, 0, 0, 0],
[0, 0, 0, 0, 1, 0, 0, 0],
[0, 0, 0, 0, 0, 1, 0, 0],
[0, 0, 1, 0, 0, 0, 1, 1],
[0, 0, 0, 0, 0, 1, 0, 1],
@psaitu
psaitu / Adjacency Dicts With Edge Weights
Last active September 11, 2015 21:09
Basic Graph Representation in Python
a, b, c, d, e, f, g, h = range(8)
N = [
{b:2, c:1, d:3, e:9, f:4},
{c:4, e:3},
{d:8},
{e:7},
{f:5},
{c:2, g:2, h:2},
{f:1, h:6},
@psaitu
psaitu / 0_reuse_code.js
Last active August 29, 2015 14:25
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
a = [79, 50, 68, 71, 73, 31, 81, 30, 33, 94, 60, 63, 99, 81, 99, 96, 59, 73, 13]
n = len(a)
def is_even(n):
return (n % 2 == 0)
def is_odd(n):
return (n % 2 != 0)
Bringing machine 'blimp' up with 'virtualbox' provider...
==> blimp: Importing base box 'ubuntu-12.04-amd64-daily'...
==> blimp: Matching MAC address for NAT networking...
==> blimp: Setting the name of the VM: blimp_blimp_1427302184848_68078
==> blimp: Clearing any previously set forwarded ports...
==> blimp: Clearing any previously set network interfaces...
==> blimp: Preparing network interfaces based on configuration...
blimp: Adapter 1: nat
blimp: Adapter 2: hostonly
==> blimp: Forwarding ports...