Name of thing | Sorta like... | Mounted? | Can you even setState? | What would you say... ya do here? |
---|---|---|---|---|
constructor | initialize() | nope | nope | init stuff NO side effects |
componentWillMount | beforeDomReady() | nope | yeah but don't | Only needed in createClass now use constructor for most things |
render | render | nope | please no | render stuff and don't set any state please |
componentDidMount | domReady() | yup | yup | DOM is a go init jQuery plugins dispatch stuff |
componentWillReceiveProps | onChange() | yup | yup |
'use strict'; | |
var util = require('util'); | |
var stream = require('stream'); | |
var Writable = stream.Writable || require('readable-stream').Writable; | |
function dbConnect(connectionString) { | |
console.log('connectionString', | |
connectionString); | |
return { |
This is a list of examples and articles, in roughly the order you should follow them, to show and explain how promises work and why you should use them. I'll probably add more things to this list over time.
This list primarily focuses on Bluebird, but the basic functionality should also work in ES6 Promises, and some examples are included on how to replicate Bluebird functionality with ES6 promises. You should still use Bluebird where possible, though - they are faster, less error-prone, and have more utilities.
I'm available for tutoring and code review :)
You may reuse all gists for any purpose under the WTFPL / CC0 (whichever you prefer).
module.exports = function(grunt) { | |
// ... | |
grunt.initConfig({ | |
//... | |
// Deploy settings (task config, put inside grunt.initConfig) | |
rsync: { |
user http; | |
worker_processes auto; | |
error_log /var/log/nginx/error.log notice; | |
events { | |
worker_connections 1024; | |
multi_accept on; | |
} | |
http { |
CREATE SCHEMA liberated; | |
CREATE OR REPLACE FUNCTION public.liberate() | |
RETURNS boolean | |
LANGUAGE plv8 | |
AS $function$ | |
var tables = plv8.execute( | |
"select relname FROM pg_catalog.pg_class" | |
+ " c LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace" |
#!/bin/bash | |
# Shell script to backup MySql database (Performed for Drupal databases) | |
# It ignores drupal cache and temporary information common tables content, | |
# although it fits any mysql database dump. | |
# To backup a Mysql database file to a chosen directory you must provide the | |
# database name, and mysql access information through parameters in the script | |
# execution. | |
# Based on the original script on | |
# http://www.cyberciti.biz/nixcraft/vivek/blogger/2005/01/mysql-backup-script.html | |
# Last updated: May - 2013 |
<?php | |
/** | |
* Examples of valid statements for a drushrc.php file. Use this file to | |
* cut down on typing of options and avoid mistakes. | |
* | |
* Rename this file to drushrc.php and optionally copy it to one of | |
* five convenient places, listed below in order of precedence: | |
* | |
* 1. Drupal site folder (e.g sites/{default|example.com}/drushrc.php). |
Either copy the aliases from the .gitconfig
or run the commands in add-pr-alias.sh
Easily checkout local copies of pull requests from remotes:
git pr 4
- creates local branchpr/4
from the githubupstream
(if it exists) ororigin
remote and checks it outgit pr 4 someremote
- creates local branchpr/4
fromsomeremote
remote and checks it out