Skip to content

Instantly share code, notes, and snippets.

View adamyeats-zz's full-sized avatar

Adam Yeats adamyeats-zz

  • Ocasta Studios
  • Brighton, England
View GitHub Profile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
def double(x)
x * 2
end
p [1,2,3].map(&method(:double))
# [2, 4, 6]
@staltz
staltz / introrx.md
Last active July 25, 2024 08:00
The introduction to Reactive Programming you've been missing
# app/assets/javascripts/ember-app/templates/partials/_header.js.coffee
%nav.navbar.navbar-default.navbar-fixed-top
.container
.navbar-header
%btn.navbar-toggle{ data: { target: '.navbar-collapse', toggle: 'collapse' }, type: 'button' }
%span.sr-only Toggle Navigation
%span.icon-bar
%span.icon-bar
%span.icon-bar
= hb 'link-to "index" class="navbar-brand"' do
@afeld
afeld / gist:5704079
Last active November 27, 2023 15:43
Using Rails+Bower on Heroku
@gr2m
gr2m / 01_hoodie-email-worker.dreamcode.js
Last active December 17, 2015 05:19
This is dreamcode for the Hoodie (http://hood.ie) Email worker, doing the backend magic behind hoodie.email.send( options ). I'm not a Node person, just dreaming out loud ;-)
function Worker(app) {
this.app = app;
app.on('add:$email', this.sendEmail.bind(this) );
}
Worker.prototype.sendEmail = function(email) {
// check if email has been configured
var emailConfig = app.config.get("email")
@gr2m
gr2m / call_for_contributors.md
Last active December 17, 2015 00:19
Hoodie empowers frontend developers to build fully capable apps, without thinking backend. We've put a lot of thoughts into its API and made a proof-of-concept implementation, but now want to reach out to gather opinions on how hoodie.js should be implemented "the proper JavaScript way".

hoodie.js is a library to abstract common backend tasks in form of frontend developer friendly JavaScript methods.

The API is what we care most about. No matter of how complex are behind the curtain, hoodie.js has to remain as simple as jQuery.

The current implementation is done with CoffeeScript, for reasons. But we want to move to make a proper JavaScript implementation and want to invite you to help us:

  • what's your opinion on how the hoodie.js modules should be structured, the "JavaScript way"?
  • what are libraries we should look into / learn from?
  • this is your chance: do you want to help migrating hoodie.js to JavaScript? Raise your hand
@jcoglan
jcoglan / tweets.js
Last active December 15, 2015 16:48
// This is in response to https://gist.github.com/Peeja/5284697.
// Peeja wanted to know how to convert some callback-based code to functional
// style using promises.
var Promise = require('rsvp').Promise;
var ids = [1,2,3,4,5,6];
// If this were synchronous, we'd simply write:
var cluster = require('cluster');
var PORT = +process.env.PORT || 1337;
if (cluster.isMaster) {
// In real life, you'd probably use more than just 2 workers,
// and perhaps not put the master and worker in the same file.
cluster.fork();
cluster.fork();
cluster.on('disconnect', function(worker) {
@SlexAxton
SlexAxton / .zshrc
Last active April 25, 2023 03:57
My gif workflow
gifify() {
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
fi
else