Skip to content

Instantly share code, notes, and snippets.

Avatar

Revath S Kumar revathskumar

View GitHub Profile
View jsbin.majoh.coffee
d = document
class Wrapper
constructor: (options) ->
@el = options.el
@el.querySelector('.add-item').addEventListener 'click', @add
add: (item) =>
item = new Item({el: d.createElement('li')}) unless item.el
@el.querySelector('.items').appendChild(item.el)
View jsbin.wegew.html
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Try on React.js" />
<script src="//fb.me/react-0.9.0.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<div id="hello"></div>
View error.md

Here is the warning I am receiving, while I use js-api and also without it.

It isn't possible to write into a document from an asynchronously-loaded external script unless it is explicitly opened.

@revathskumar
revathskumar / error.txt
Created June 24, 2014 18:14
npm error log
View error.txt
0 info it worked if it ends with ok
1 verbose cli [ 'node', '/home/revath/.nvm/v0.10.12/bin/npm', 'publish' ]
2 info using npm@1.4.4
3 info using node@v0.10.12
4 verbose publish [ '.' ]
5 verbose cache add [ '.', null ]
6 verbose cache add name=undefined spec="." args=[".",null]
7 verbose parsed url { protocol: null,
7 verbose parsed url slashes: null,
7 verbose parsed url auth: null,
View sample.coffee
# Helper functions
#
# helper.js.coffee
NameSpace.Helpers =
a: () ->
console.log 'a'
b: () ->
console.log 'b'
View gist:295256bb58da56e5d3be
TypeError: object is not a function
at invoke (/home/revath/code/yeoman/yeoman-generator/lib/actions/invoke.js:28:13)
at null.<anonymous> (/home/revath/code/yeoman/yeoman-generator/lib/base.js:445:12)
at /home/revath/code/yeoman/yeoman-generator/node_modules/async/lib/async.js:610:21
at /home/revath/code/yeoman/yeoman-generator/node_modules/async/lib/async.js:249:17
at iterate (/home/revath/code/yeoman/yeoman-generator/node_modules/async/lib/async.js:149:13)
at async.eachSeries (/home/revath/code/yeoman/yeoman-generator/node_modules/async/lib/async.js:165:9)
at _asyncMap (/home/revath/code/yeoman/yeoman-generator/node_modules/async/lib/async.js:248:13)
at Object.mapSeries (/home/revath/code/yeoman/yeoman-generator/node_modules/async/lib/async.js:231:23)
at Object.async.series (/home/revath/code/yeoman/yeoman-generator/node_modules/async/lib/async.js:608:19)
View introrx.md

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.

View gist:d8885a9bce49db28cc35
# SSL self signed localhost for rails start to finish, no red warnings.
# 1) Create your private key (any password will do, we remove it below)
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
@revathskumar
revathskumar / remote.sh
Created September 18, 2014 05:46
hub get repository
View remote.sh
git remote -v | awk -F: {'print $2'} | awk -F. {'print $1'}
View SpecRunner.js
require.config({
baseUrl: '/backbone-tests/',
paths: {
'jquery' : '/app/libs/jquery',
'underscore' : '/app/libs/underscore',
'backbone' : '/app/libs/backbone',
'mocha' : 'libs/mocha',
'chai' : 'libs/chai',
'chai-jquery' : 'libs/chai-jquery',
'models' : '/app/models'