Skip to content

Instantly share code, notes, and snippets.

View rjungemann's full-sized avatar

Roger Jungemann rjungemann

View GitHub Profile
@danharper
danharper / gulpfile.js
Last active September 25, 2024 09:04
New ES6 project with Babel, Browserify & Gulp
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var browserify = require('browserify');
var watchify = require('watchify');
var babel = require('babelify');
function compile(watch) {
var bundler = watchify(browserify('./src/index.js', { debug: true }).transform(babel));
require 'date'
class FirebasePush
PUSH_CHARS = '-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz'
def initialize
@prev_ts = 0
@rand_chars = Array.new(12)
end
@jbgi
jbgi / Term.java
Last active November 6, 2024 12:48
Generalized Algebraic Data Types (GADT) in Java
import static java.lang.System.*;
import java.util.function.BiFunction;
import java.util.function.Function;
// Implementation of a pseudo-GADT in Java, translating the examples from
// http://www.cs.ox.ac.uk/ralf.hinze/publications/With.pdf
// The technique presented below is, in fact, just an encoding of a normal Algebraic Data Type
// using a variation of the visitor pattern + the application of the Yoneda lemma to make it
// isomorphic to the targeted 'GADT'.
@tonyg
tonyg / fusion-caselambda.rkt
Created January 24, 2015 22:28
Experiments with fusable streams and transducers in Racket
#lang racket
;; Fusable Streams, after Coutts, Leshchinskiy and Stewart 2007.
;; Haskell:
;; data Stream a where Stream :: (s -> Step s a) -> s -> Stream a
;; data Step s a = Yield a s | Skip s | Done
;; Clojure transducers support:
;; - early termination
;; - completion cleanup
@gatlin
gatlin / typed-racket-monads.md
Last active September 24, 2024 16:43
A simple definition and demonstration of monads in Typed Racket

What the fuck is a monad?

Or: functor? I 'ardly know 'er!

Monads are difficult to explain without sounding either patronizing or condescending: I would sound patronizing if I came up with some facile analogy and I would be condescending to describe it categorically.

Instead, I'll frame a problem and piece-by-piece solve the problem with what will turn out to be a monad.

@slime73
slime73 / sdl-metal-example.m
Last active September 9, 2021 10:53
SDL + Metal example
/**
* This software is in the public domain. Where that dedication is not recognized,
* you are granted a perpetual, irrevokable license to copy and modify this file
* as you see fit.
*
* Requires SDL 2.0.4.
* Devices that do not support Metal are not handled currently.
**/
#import <UIKit/UIKit.h>
@numtel
numtel / binlog.js
Created December 18, 2014 09:13
Tail mysqlbinlog in row mode with Node JS
#!/usr/bin/env node
var determineDb = function(lines, startIndex){
// Look backward from statement at startIndex to find database name used
var result;
for(var i = startIndex; i >= 0; i--){
result = lines[i].match(/^use (`([^\.]+)`|[^\.\/]+)?/i);
if(result === null) continue;
if(result[2] === undefined){
return result[1];
@gatlin
gatlin / parser-combinator.rkt
Last active June 22, 2020 19:11
Simple parser combinator example in Typed Racket
#lang typed/racket
(provide None
Just
Opt
maybe
neq?
Parser
lit
try-parse

Preview build: Container grouping and stack composition

NOTE: this is out of date - refer to moby/moby#9694

Here is a preview build of two new features we’re working on concurrently: container grouping (docker groups) and stack composition (docker up). Together, they will eventually form a complete replacement for Fig.

@AnderRasoVazquez
AnderRasoVazquez / pomodoro.sh
Last active June 15, 2022 18:37
[A simple pomodoro script for Bash shell] #shell #bash
#!/bin/bash
## pomodoro script by Ander Raso Vázquez anderraso@gmail.com
############## DOCUMENTATION ###################
## After a pomodoro of 25 min -> 5 min break
## After 4 pomodoros done -> 15 min break
##
## USAGE
## [command] [number of pomodoros]
## example: