Skip to content

Instantly share code, notes, and snippets.

@chris-ramon
chris-ramon / gist:1996938
Created March 7, 2012 22:59 — forked from padolsey/gist:527683
JavaScript: Detect IE
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
@chris-ramon
chris-ramon / JavaCandR.sublime-build
Created July 6, 2012 22:57 — forked from DevinClark/JavaCandR.sublime-build
This is a build script for Sublime Text 2 that will compile and run the open java file by simply pressing cmd + B. I am very new at Java so feel free to point out problems with this script. You can just drop this file in the User Packges folder and restar
{
"cmd": ["javac", "$file_name"],
"cmd": ["java", "$file_base_name"],
"working_dir": "${project_path:${folder}}",
"selector": "source.java"
}
@chris-ramon
chris-ramon / Capistrano-Deployment-Recipe.rb
Created November 15, 2012 05:16 — forked from mrrooijen/Capistrano-Deployment-Recipe.rb
a "base" Capistrano Rails Deployment Recipe. Use it to deploy your Rails application. It is also easily expandable. So feel free to grab this Recipe and add your own tasks/customization!
# Guide
# Configure the essential configurations below and do the following:
#
# Repository Creation:
# cap deploy:repository:create
# git add .
# git commit -am "initial commit"
# git push origin master
#
# Initial Deployment:
@chris-ramon
chris-ramon / sublime.json
Last active October 13, 2015 18:58 — forked from abrookins/gist:1933635
sublime build
// path of the file to override: /home/user/.config/sublime-text-2/Packages/Python/Python.sublime-build
// for simple scripts using virtualenv
{
"cmd": ["python", "-u", "$file"],
"env": {"PYTHONPATH": "/home/chris/venvs/venv-authorize-sauce/lib/python2.7/site-packages"},
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python"
}
@chris-ramon
chris-ramon / url_patterns.py
Created December 11, 2012 16:26 — forked from c4urself/url_patterns.py
url django
(r'^articles/(?P<year>\d{4}/?$, 'main.views.year'),
# When a use case comes up that a month needs to be involved as
# well, you add an argument in your regex:
(r'^articles/(?P<year>\d{4}/(?P<month>\d{2})/?$, 'main.views.year_month'),
# That works fine, unless of course you want to show something
# different for just the year, in which case the following case can be
# used, making separate views based on the arguments as djangoproject
from selenium import webdriver
def select_from_chosen(driver, id, value):
chosen = driver.find_element_by_id(id + '_chzn')
results = chosen.find_elements_by_css_selector(".chzn-results li")
found = False
for result in results:
if result.text == value:
rails generate scaffold Post title:string body:string
rake db:migrate

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.

package main
import (
"fmt"
"io/ioutil"
"net/http"
"net/url"
"regexp"
"strings"
)
package main
import (
"fmt"
"io/ioutil"
"net/http"
"net/url"
"regexp"
"strings"
)