Skip to content

Instantly share code, notes, and snippets.

View jasdev's full-sized avatar

Jasdev Singh jasdev

View GitHub Profile
@jay3686
jay3686 / gist:9376565
Created March 5, 2014 21:05
flatting list of lists or non lists
"""
In [56]: a = [1,[2,3,4], 4,5,6, [7,8], 9, 10]
In [57]: normalize = lambda x : x if type(x) == list else [x]
In [58]: list(itertools.chain(*map(normalize, a)))
Out[58]: [1, 2, 3, 4, 4, 5, 6, 7, 8, 9, 10]
In [59]: a
//
// Genetics.swift
// Genetics
//
// Created by Julius Parishy on 12/1/14.
// Copyright (c) 2014 Julius Parishy. All rights reserved.
//
import Cocoa
import CoreGraphics
@sandofsky
sandofsky / gist:7134b1ff90d235901254
Created February 19, 2015 04:15
Example of fetching messages from Parse
class ViewController: UITableViewController {
var messages:[Message]?
var timer:NSTimer?
override func viewDidLoad() {
super.viewDidLoad()
}
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
@briankassouf
briankassouf / main.go
Created January 25, 2015 00:01
Imgur-esque hash generator written in Go
package main
import (
"crypto/rand"
"fmt"
"log"
)
func main() {
hashGetter := make(chan string)
@fj
fj / gist:1065069
Last active September 26, 2015 07:58
First Wednesdays Charlottesville info
@BinRoot
BinRoot / lol.txt
Created October 18, 2012 16:52
Team 4 - University of Virginia
We're pretty cool guys hacking away everyday all the way everywhere.
Follow Puneet on reddit.com/r/puneet
Follow Jasdev at @justdavesingh
Follow Nishant at shuklan.com
@natecook1000
natecook1000 / DictionaryObjectsForKeys.swift
Last active December 9, 2015 18:43
Initializers for Dictionary like NSDictionary +dictionaryWithObjects:forKeys:
// (c) 2015 Nate Cook, licensed under the MIT license
//
// Initializers for Dictionary like NSDictionary +dictionaryWithObjects:forKeys:
public extension Dictionary {
/// Creates a new Dictionary from the given `keys` and `values` collections.
///
/// More efficient than the sequence version because it can reserve the correct
/// capacity before filling the dictionary. Returns `nil` if the lengths of the
/// two collections differ.
@BinRoot
BinRoot / davidhu.js
Last active December 15, 2015 12:19
Nice RegEx, Bro
if(/^([a-z]([a-z]|\d|\+|-|\.)*):(\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])
|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?((\[(|(v[\da-f]{1,}\.(([a-z]|\d|-|\.|_|~)|[!\$&'\(\)\*\+,;=]|
:)+))\])|((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\
d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-
\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=])*)(:\d*)?)(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF
\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*|(\/((([a-z]|\d|-|\.|_|~|[\u00A0-
\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-
\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)|((([a-z]|\d|-|\.|_|~|[
\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~
|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)|((([a-z]|\d|-|\.
@BinRoot
BinRoot / systemd.quote
Last active December 16, 2015 06:19
Arch Systemd
We make Arch for ourselves, and for the ones that like it like we do.
Whether we have a million users or one hundred users –
we will keep making it the distro we like.
Deal with it.
- Brain0
@sozorogami
sozorogami / main.go
Created October 6, 2015 14:09
Convert `Podfile.lock` dependency list into a `.dot` file than can be opened in OmniGraffle
package main
import "os"
import "bufio"
import "io/ioutil"
import "regexp"
import "strings"
// Copy Podfile.lock contents into input.txt in same dir as script