Skip to content

Instantly share code, notes, and snippets.

View icholy's full-sized avatar
💥
breaking things

Ilia Choly icholy

💥
breaking things
View GitHub Profile
def userInput():
response = input("Enter n to deal a new hand, r to replay the last hand, or e to end game:")
if response == 'n' or 'r' or 'e':
return response
else:
print("Invalid command.")
return userInput()
@icholy
icholy / Time.ts
Last active February 15, 2017 18:47
// Until Symbol.toPrimitive is supported accross major browsers, the only way to get around Date's
// confusing default hint behaviour is to wrap it.
class Time {
private date: Date;
constructor(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number) {
this.date = Object.create(Date.prototype);
Date.apply(this.date, arguments);
}
package main
import (
"fmt"
"log"
"time"
"github.com/lib/pq"
)
# A new "intermediate" matrix is created for each element in the plane matrix.
# The intermediate matrices values are the "threat" the corresponding bird element poses to the plane element.
# In the example code, the "threat" value is calculated using:
#
# (plane_value * bird_value) / (euclidean_distance(plane_element, bird_element) + 1)
#
# The intermediate matrices are then reduced into a single matrix. In the example code, I just add them.
import numpy as np
import matplotlib.pyplot as plt
package main
import (
πg "grumpy"
π_os "os"
)
func initModule(πF *πg.Frame, _ []*πg.Object) (*πg.Object, *πg.BaseException) {
ß__main__ := πg.InternStr("__main__")
ß__name__ := πg.InternStr("__name__")
ßmain := πg.InternStr("main")
var πTemp001 *πg.Object
# Get a list of all files in the history
git log --pretty=format: --name-status | cut -f2- | sort -u > ~/all_files.txt
# Remove those files from the current branch history
cat ~/all_files.txt | xargs -L1 -I{} sh -c 'git filter-branch -f --prune-empty -d /dev/shm/scratch --index-filter "git rm --cached -f --ignore-unmatch {}" -- --all'
# Remove the remote
git remote rm origin
div#id
  background-color: red
  a.foo(href="#") some text
  span.class
    ul
      li first
      li second
    | some text
<!DOCTYPE html>
<html>
<head>
<title>SVG Icon Error</title>
<link rel="stylesheet" href="http://openlayers.org/en/v3.18.2/css/ol.css" type="text/css">
<script src="http://cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList,URL"></script>
<script src="http://openlayers.org/en/v3.18.2/build/ol-debug.js"></script>
</head>
<body>
<div id="map" class="map"></div>
interface PathNames {
propertyName: string;
targetNames: string[];
}
export default class ObjectAccessor {
isDirty = false;
const enum Comparison { GT, LT, EQ }
type CompareFunc<T> = (a: T, b: T) => Comparison;
function binarySearch<T>(array: T[], item: T, compare: CompareFunc<T>): number {
let [left, right] = [0, array.length - 1];
while (left <= right) {
let middle = Math.floor((left + right) / 2);
switch (compare(array[middle], item)) {
case Comparison.LT:
left = middle + 1;