Skip to content

Instantly share code, notes, and snippets.

Jaden Geller JadenGeller

View GitHub Profile
View how-to-make-a-racist-ai-without-really-trying.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mayoff
mayoff / main.m
Created May 31, 2017
adding objc_boxable to CoreGraphics structs
View main.m
@import Foundation;
@import CoreGraphics;
typedef struct __attribute__((objc_boxable)) CGPoint CGPoint;
typedef struct __attribute__((objc_boxable)) CGSize CGSize;
typedef struct __attribute__((objc_boxable)) CGRect CGRect;
typedef struct __attribute__((objc_boxable)) CGVector CGVector;
int main(int argc, const char * argv[]) {
@autoreleasepool {
View protocolsarefornewbies.swift
import UIKit
struct Monoid<A> {
let zero: A
let append: (A, A) -> A
}
let additive = Monoid(zero: 0, append: +)
let multiplicative = Monoid(zero: 1, append: *)
View Proposal.md
@forairan
forairan / PhpJava.java
Last active Oct 18, 2018
This snippet of code is syntactically valid in both PHP and Java, and produces the same output in both.
View PhpJava.java
/*<?php
//*/public class PhpJava { public static void main(String[] args) { System.out.printf("/*%s",
//\u000A\u002F\u002A
class PhpJava {
static function main() {
echo(//\u000A\u002A\u002F
"Hello World!");
}}
//\u000A\u002F\u002A
PhpJava::main();
View ABT.swift
/// An operator is given by a list of arities, where each element indicates the number of
/// variables bound by the operator at that position and the length of the list determines the
/// number of variables the operator accepts. The full generalization of arity is called
/// the operator's "valence".
///
/// For example, if I have a little calculator language with let-bindings, its operators
/// would look like this:
///
///
/// enum CalcOps : Operator {
@airspeedswift
airspeedswift / MyArray.swift
Last active Nov 22, 2016
Array using ManagedBuffer
View MyArray.swift
private class MyArrayBuffer<Element>: ManagedBuffer<Int,Element> {
func clone() -> MyArrayBuffer<Element> {
return self.withUnsafeMutablePointerToElements { elements -> MyArrayBuffer<Element> in
return MyArrayBuffer<Element>.create(self.allocatedElementCount) { newBuf in
newBuf.withUnsafeMutablePointerToElements { newElems->Void in
newElems.initializeFrom(elements, count: self.value)
}
return self.value
@brentsimmons
brentsimmons / gist:2080595ac8a6f41711af
Last active Aug 29, 2015
Swift init from unknown class
View gist:2080595ac8a6f41711af
import Cocoa
protocol Thing {
var x: String {get}
init(s: String)
}
class Foo: Thing {
let x: String
@ohanhi
ohanhi / frp.md
Last active Apr 16, 2019
Learning FP the hard way: Experiences on the Elm language
View frp.md

Learning FP the hard way: Experiences on the Elm language

by Ossi Hanhinen, @ohanhi

with the support of Futurice 💚.

Licensed under CC BY 4.0.

Editorial note

@nathggns
nathggns / brainfuck.ts
Created Jun 7, 2015
brainfuck in typescript
View brainfuck.ts
declare function require(module:string):any;
declare var process:any;
var readline = require('readline');
var fs = require('fs');
type brainfuckDone = (char : string) => void;
type brainfuckInput = (done : brainfuckDone) => void;
function brainfuck(tokens : string[], inp : brainfuckInput) {
You can’t perform that action at this time.