Skip to content

Instantly share code, notes, and snippets.

View zfogg's full-sized avatar
🔐
24BD65F25E5D7311F5FFB2D3EDDAE1DA7360D7F4

Zachary Fogg zfogg

🔐
24BD65F25E5D7311F5FFB2D3EDDAE1DA7360D7F4
View GitHub Profile
@zfogg
zfogg / gist:5080310
Last active December 14, 2015 11:38
Potential CoffeeScript Bug
app.use thing.middleware
src: __dirname
compile: compile
#The above used to compile like this:
`app.use(thing.middleware({
src: __dirname,
compile: compile
}));`
@zfogg
zfogg / PythTrips.clj
Created June 27, 2013 01:18
A lazy sequence of the Pythagorean Triples.
(defn t1
[[a b c]]
[($= 1 * a - 2 * b + 2 * c)
($= 2 * a - 1 * b + 2 * c)
($= 2 * a - 2 * b + 3 * c)])
(defn t2
[[a b c]]
[($= 1 * a + 2 * b + 2 * c)
($= 2 * a + 1 * b + 2 * c)
@zfogg
zfogg / bookmark_me.js
Created December 6, 2013 11:30
B+W Mandela
// Made for http://webapps.aljazeera.net/aje/custom/mandelamosaicwebsite/mandela.html
// too lazy to mouse over entire face
// tl;dr - make bookmark, set URL to:
javascript:$("rect").each(function(d){d3.select(this).attr("fill",function(d){return d.Old})});
// Source:
$("rect").each(function(tile) {
@zfogg
zfogg / 145e.coffee
Last active December 31, 2015 14:09
/r/dailyprogrammer #145 - easy
#!/usr/bin/env coffee
#
# http://redd.it/1t0r09 -/r/dailyprogrammer
# [12/16/13] Challenge #145 [Easy] Tree Generation
zipWith = (xss..., f) ->
for i in [0..-1+Math.min.apply 0, (x.length for x in xss)]
f.apply @, (xs[i] for xs in xss)
@zfogg
zfogg / 145e.hs
Last active December 31, 2015 14:49
/r/dailyprogrammer #145 - easy
import Data.List
merge = zipWith (++)
reflect = map tail . reverse
concat' = intercalate "\n"
triangle n = take n . zipWith replicate [1,2..] . repeat
@zfogg
zfogg / fib.go
Created December 21, 2013 07:55
Fibonacci in Go
package main
import "fmt"
import "math/big"
func main() {
f := fibonacci()
for i := 0; i < 100; i++ {
fmt.Println(f(i))
}
@zfogg
zfogg / microthreads.go
Created December 21, 2013 07:56
Microthreads in Go
package main
import ("flag"; "fmt")
var ngoroutine = flag.Int("n", 100000, "how many")
func f(left, right chan int) { left <- 1 + <-right }
func main() {
flag.Parse();
@zfogg
zfogg / pe23.go
Created December 21, 2013 07:56
pe23 in Go
package main
const n1, n2 int = 1, 28123
func main() {
// All abundant 'n's from n1 to n2.
abundant := make([]int, 0)
for n := n1; n <= n2; n++ {
if n < sumDivisors(n) {
abundant = append(abundant, n)
}
@zfogg
zfogg / asd.md
Created April 1, 2014 08:31
IDEA: Non-database MySQL implementations

A MySQL implementation that uses various weird backends to store the actual data (so anything except actual databases).

Basically a system where one writes an interface between MySQL queries, and some arbitrary (non-database) place to store and retrieve data.

Some ideas for initial interfaces:

  1. Embed data into jpegs and upload to imgur.
  2. Reddit comments and threads.
  3. A bunch of email accounts that send messages to each other.
  4. CSV files in Dropbox. (boring + obvious)

Keybase proof

I hereby claim:

  • I am zfogg on github.
  • I am zfogg (https://keybase.io/zfogg) on keybase.
  • I have a public key whose fingerprint is 20A5 A16B AFEA E60B C906 2612 EC96 825B 93D7 D925

To claim this, I am signing this object: