Skip to content

Instantly share code, notes, and snippets.

View Maciek416's full-sized avatar

Maciej Adwent Maciek416

View GitHub Profile
Request {
domain: null,
_events:
{ error: [Function: bound ],
complete: [Function: bound ],
pipe: [Function],
data: [Function],
end: [Function] },
_eventsCount: 5,
_maxListeners: undefined,
{
"local": {
"SOMEVAR1": "123_local",
"SOMEVAR2": "asdf banana",
"SOMEVAR3": "hello world"
},
"production": {
"SOMEVAR1": "123_prod",
"SOMEVAR2": "asdf serious banana",
"SOMEVAR3": "hello serious world"
/*
* Copyright (c) 2007-2012, Marketo, Inc. All rights reserved.
* Marketo marketing automation web activity tracking script
*
* $Id: munchkin.js 44633 2012-08-17 23:47:19Z dj $
* $Rev: 44633 $
*/
var Munchkin = {
ASSOCIATE_LEAD: "associateLead",
CLICK_LINK: "clickLink",
# classic async style
getData: (input, done) ->
output = Math.sin(input) * Math.cos(input)
done(output)
# async return through callback sugar
getData~ (input) ->
Math.sin(input) * Math.cos(input)
@Maciek416
Maciek416 / gist:5541286
Created May 8, 2013 15:34
Prefixing list comprehensions with "then"
# This form doesn't work
a = num for num in [0..364]
alert(a.join(","))
# This form works
a = (num for num in [0..364])
alert(a.join(","))
# This form also works
a = then num for num in [0..364]
# async example for Haifeng
iterator = (item, next) ->
result = item.split("").reverse().join()
next(result)
finished = (err, results) ->
console.log("finished with results: ", results)
async.map(["banana","apple","orange"], iterator, finished)
@Maciek416
Maciek416 / gist:3790205
Created September 26, 2012 19:57
CoffeeScript Oddities
# return true if _ is <= to __
(=>((=>_)()<=(=>__)()))()
# call a method
((___)->alert(___[(((o)->"_-_-"[o])(o-1) for o in(__ for __ in[(for ____ of ___ then ____).toString().length..1])).join ""]()))("-_-_":->"cool!")
@Maciek416
Maciek416 / gist:3171173
Created July 24, 2012 16:57 — forked from igrigorik/gist:3148848
Convert any YouTube video into an audio file you can listen to on the go...
# Convert any YouTube video into an audio file you can listen to on the go, using:
# http://rg3.github.com/youtube-dl/
{ ~ } > brew install ffmpeg
{ ~ } > wget https://raw.github.com/rg3/youtube-dl/2012.02.27/youtube-dl
{ ~ } > chmod u+x youtube-dl
# Pick which video format you want to download.. (use any YT video link)
{ ~ } > ./youtube-dl -s -F http://www.youtube.com/watch?v=vT1KmTQ-1Os
<!DOCTYPE html>
<html lang="en">
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="./stativus.js"></script>
</head>
<body>
<div id="state-A" style="display: none; background-color: red; color: white;">
<h1>State A</h1>
<div id="state-A1" style="display: none; background-color: orange; color: white;">leaf state A1</div>