(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
var detectBackOrForward = function(onBack, onForward) { | |
hashHistory = [window.location.hash]; | |
historyLength = window.history.length; | |
return function() { | |
var hash = window.location.hash, length = window.history.length; | |
if (hashHistory.length && historyLength == length) { | |
if (hashHistory[hashHistory.length - 2] == hash) { | |
hashHistory = hashHistory.slice(0, -1); | |
onBack(); |
/** | |
* Module dependencies | |
*/ | |
var express = require('express'); | |
var fs = require('fs'); | |
var mongoose = require('mongoose'); | |
var Schema = mongoose.Schema; | |
// img path |
<!doctype html> | |
<html> | |
<head> | |
<title>iFrame memory leak prevention test</title> | |
</head> | |
<body> | |
<h1>iFrame memory leak prevention test (void)</h1> | |
<p>In IE up through version 8 adding an iframe to a page and | |
removing it produces a memory leak in some cases. The pattern |
# | |
# Slightly tighter CORS config for nginx | |
# | |
# A modification of https://gist.github.com/1064640/ to include a white-list of URLs | |
# | |
# Despite the W3C guidance suggesting that a list of origins can be passed as part of | |
# Access-Control-Allow-Origin headers, several browsers (well, at least Firefox) | |
# don't seem to play nicely with this. | |
# |
// To play around with this code, copy and paste the contents of this gist | |
// into the javascript pane of http://jsbin.com/umoK/1/edit or go to | |
// http://jsbin.com/uZAfIqA/2/edit | |
// ============================================================================= | |
// Generic API | |
// ============================================================================= | |
//+ words :: string -> array | |
var words = split(' '); |
# | |
# CORS header support | |
# | |
# One way to use this is by placing it into a file called "cors_support" | |
# under your Nginx configuration directory and placing the following | |
# statement inside your **location** block(s): | |
# | |
# include cors_support; | |
# | |
# As of Nginx 1.7.5, add_header supports an "always" parameter which |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
var AWS = require('aws-sdk'), | |
fs = require('fs'); | |
// http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html#Credentials_from_Disk | |
AWS.config.loadFromPath('./aws-config.json'); | |
// assume you already have the S3 Bucket created, and it is called ierg4210-shopxx-photos | |
var photoBucket = new AWS.S3({params: {Bucket: 'ierg4210-shopxx-photos'}}); | |
function uploadToS3(file, destFileName, callback) { |
We will compare ASP.NET and Node.js for backend programming.
Source codes from examples.
This document was published on 21.09.2015 for a freelance employer. Some changes since then (14.02.2016):
async/await
. yield
and await
are used almost in the same way, so I see no point to rewrite the examples./** | |
* Based on http://stackoverflow.com/a/33585501/1783214 | |
* | |
* Handle resizing enclosed View and scrolling to input | |
* Usage: | |
* <KeyboardHandler ref='kh' offset={50}> | |
* <View> | |
* ... | |
* <TextInput ref='username' | |
* onFocus={()=>this.refs.kh.inputFocused(this,'username')}/> |