Skip to content

Instantly share code, notes, and snippets.

View jasdev's full-sized avatar

Jasdev Singh jasdev

View GitHub Profile
@jasdev
jasdev / CharacterSet+StringLiteralConvertible.swift
Created June 30, 2016 01:33
CharacterSet StringLiteralConvertible
extension CharacterSet: StringLiteralConvertible, ExtendedGraphemeClusterLiteralConvertible {
public init(stringLiteral value: String) {
self.init(charactersIn: value)
}
public init(extendedGraphemeClusterLiteral value: ExtendedGraphemeClusterType) {
self.init(charactersIn: value)
}
public init(unicodeScalarLiteral value: UnicodeScalarType) {
@jasdev
jasdev / Runner.java
Created October 31, 2012 03:55
Blum Micali PRG
public class Runner {
/**
* @param args
*/
public static void main(String[] args) {
//Generate the first 100 bits from Blum-Micali PRG with p = 34319, g = 4, and seed x = 1022
long p = 34319;
long g = 4;
final class SampleViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let button = UIButton(type: .System)
// ...
button.addTarget(self, action: #selector(SampleViewController.buttonTapped(_:)), forControlEvents: .TouchUpInside)
final class SampleViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let button = UIButton(type: .System)
// ...
button.addTarget(self, action: #selector(SampleViewController.buttonTapped(_:)), forControlEvents: .TouchUpInside)
@jasdev
jasdev / color.py
Created December 22, 2013 04:10
quick python to generate the optimum set of RBG values for a set of size COUNT. This uses the technique outlined in this post http://gamedev.stackexchange.com/questions/46463/is-there-an-optimum-set-of-colors-for-10-players
colors = []
for i in range(0, COUNT):
colors.append(colorsys.hsv_to_rgb(fmod(i * 0.618033988749895, 1.0), 0.5, 1.0))
@jasdev
jasdev / .bash_profile
Created December 9, 2013 18:56
.bash_profile
export PATH
cdls() {
if [ -z "$1" ]; then
cd && ls -G
else
cd "$*" && ls -G
fi
}
alias cd=cdls
alias pearp='/Applications/MAMP/bin/php/php5.4.4/bin/pear'
@jasdev
jasdev / gist:7504303
Created November 16, 2013 19:33
On valuations
“You could take all the gold that’s ever been mined, and it would fill a cube 67 feet in each direction. For what it’s worth at current gold prices, you could buy — not some — all of the farmland in the United States. Plus, you could buy 10 Exxon Mobils (XOM), plus have $1 trillion of walking-around money. Or you could have a big cube of metal. Which would you take? Which is going to produce more value?” - Warren Buffett
@jasdev
jasdev / rtb.html
Created April 16, 2013 01:39
For future trolling
<html>
<title>rtb</title>
<head>
<meta http-equiv="refresh" content="5; url=http://twitter.com/r00tth3b0x">
</head>
<body bgcolor="black">
<pre><center><font color="white">
d8888b. .d88b. .d88b. d888888b d888888b db db d88888b d8888b. .d88b. db db
88 `8D .8P Y8. .8P Y8. `~~88~~' `~~88~~' 88 88 88' 88 `8D .8P Y8. `8b d8'
@jasdev
jasdev / rtb.txt
Created April 16, 2013 01:38
lolyes
d8888b. .d88b. .d88b. d888888b d888888b db db d88888b d8888b. .d88b. db db
88 `8D .8P Y8. .8P Y8. `~~88~~' `~~88~~' 88 88 88' 88 `8D .8P Y8. `8b d8'
88oobY' 88 88 88 88 88 88 88ooo88 88ooooo 88oooY' 88 88 `8bd8'
88`8b 88 88 88 88 88 88 88~~~88 88~~~~~ 88~~~b. 88 88 .dPYb.
88 `88. `8b d8' `8b d8' 88 88 88 88 88. 88 8D `8b d8' .8P Y8.
88 YD `Y88P' `Y88P' YP YP YP YP Y88888P Y8888P' `Y88P' YP YP
@jasdev
jasdev / sample.json
Created January 20, 2013 02:07
Sample Snapgraph /leaderboard output
[
{
_id: "yodawg",
score: "72948"
},
{
_id: "vivekb",
score: "10557"
},
{