REST API response format based on some of the best practices
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //@flow | |
| import { createStore, applyMiddleware } from 'redux'; | |
| import storage from 'redux-persist/lib/storage' | |
| import { composeWithDevTools } from 'redux-devtools-extension'; | |
| import { persistStore, persistReducer } from 'redux-persist'; | |
| import thunk from 'redux-thunk'; | |
| import reducer from 'reducers'; | |
| import { createOffline } from '@redux-offline/redux-offline'; | |
| import offlineConfig from '@redux-offline/redux-offline/lib/defaults/index'; |
(To be improved)
- httpie (which provides the
httpcommand) —pip install httpie
- Save the
git-branch-protection.shasgit-branch-protectionsomewhere in your path (something like~/binor~/.local/binif you already use it) - Generate a GitHub token and save it as
~/.config/github_token.
The easiest way to get the ClamAV package is using Homebrew
$ brew install clamav
Before trying to start the clamd process, you'll need a copy of the ClamAV databases.
Create a freshclam.conf file and configure as so
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var gulp = require('gulp'); | |
| var sourcemaps = require('gulp-sourcemaps'); | |
| var source = require('vinyl-source-stream'); | |
| var buffer = require('vinyl-buffer'); | |
| var browserify = require('browserify'); | |
| var watchify = require('watchify'); | |
| var babel = require('babelify'); | |
| function compile(watch) { | |
| var bundler = watchify(browserify('./src/index.js', { debug: true }).transform(babel)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| // http://eslint.org/docs/rules/ | |
| "ecmaFeatures": { | |
| "binaryLiterals": false, // enable binary literals | |
| "blockBindings": false, // enable let and const (aka block bindings) | |
| "defaultParams": false, // enable default function parameters | |
| "forOf": false, // enable for-of loops | |
| "generators": false, // enable generators | |
| "objectLiteralComputedProperties": false, // enable computed object literal property names |
(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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| ## backup each mysql db into a different file, rather than one big file | |
| ## as with --all-databases. This will make restores easier. | |
| ## To backup a single database simply add the db name as a parameter (or multiple dbs) | |
| ## Putting the script in /var/backups/mysql seems sensible... on a debian machine that is | |
| ## Create the user and directories | |
| # mkdir -p /var/backups/mysql/databases | |
| # useradd --home-dir /var/backups/mysql --gid backup --no-create-home mysql-backup | |
| ## Remember to make the script executable, and unreadable by others |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // snippet taken from http://catapulty.tumblr.com/post/8303749793/heroku-and-node-js-how-to-get-the-client-ip-address | |
| function getClientIp(req) { | |
| var ipAddress; | |
| // The request may be forwarded from local web server. | |
| var forwardedIpsStr = req.header('x-forwarded-for'); | |
| if (forwardedIpsStr) { | |
| // 'x-forwarded-for' header may return multiple IP addresses in | |
| // the format: "client IP, proxy 1 IP, proxy 2 IP" so take the | |
| // the first one | |
| var forwardedIps = forwardedIpsStr.split(','); |
NewerOlder