Skip to content

Instantly share code, notes, and snippets.

View rainforest-of-code's full-sized avatar

rainforest-of-code

View GitHub Profile

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called (Functional) Reactive Programming (FRP).

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://conemu.github.io/install.ps1'))"
/**
* Exercises explaining covariant and contravariant functors.
*
* Additionally exercises explaining variance of types over their type parameters.
*
* Implement the `???` functions. Are all implementable?
*/
trait Functors {
/**

Beautiful Code

Language Elements

# 49 methods for the price of one
# via @sferik
module Enumerable

# block & yield syntax

Ignore line-ending differences when diffing

(You can't use this with git difftool or merge though)

git diff --ignore-space-at-eol

Prefer one branch over another when merging

group :production do
gem 'unicorn'
# Enable gzip compression on heroku, but don't compress images.
gem 'heroku-deflater'
# Heroku injects it if it's not in there already
gem 'rails_12factor'
end

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

  • Buy a mac mini
  • Install 10.8
  • Create a user account for Jenkins
  • Install xcode
  • Turn on screen sharing
  • Turn off energy save sleeping
  • Login as your jenkins user
  • Use ssh-keygen to create a key for github
  • Create a github account for your build machine
  • Add the key to your build machine github account
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';
@rainforest-of-code
rainforest-of-code / most_used_css_property_names.js
Created October 12, 2012 21:31 — forked from NV/most_used_css_property_names.js
PhantomJS script to collect most used CSS property names (supported by WebKit)
// phantomjs --web-security=no most_used_css_property_names.js
var urls = [
'http://google.com',
'http://facebook.com',
'http://youtube.com',
'http://yahoo.com',
'https://github.com/',
'http://twitter.com/',
'http://en.wikipedia.org/wiki/Main_Page',