This file contains 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 http = require('http'), | |
sys = require('sys'), | |
URL = require('url'), | |
querystring = require('querystring'), | |
OAuth = require('oauth').OAuth; | |
var oa = new OAuth('https://api.twitter.com/oauth/request_token', | |
'https://api.twitter.com/oauth/access_token', | |
'YOUR APP CONSUMER KEY HERE', | |
'YOUR APP CONSUMER SECRET HERE', |
This file contains 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
for (var i = 0; i < 1024 * 1024; i++) { | |
process.nextTick(function () { Math.sqrt(i) } ) | |
} |
This file contains 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
Depending on whether the connection is behind a proxy or not, the proxy settings will need to set/reset correspondingly when using npm and git. | |
The command to set and reset the proxy are | |
# Set proxy for npm: | |
npm config set proxy http://proxy:8080 | |
npm config set https-proxy http://proxy:8080 | |
# Set proxy for git: | |
git config --global http.proxy http://proxy:8080 |
This file contains 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 path = require('path'); | |
var fs = require('fs'); | |
var os = require('os'); | |
var express = require('express'); | |
var app = express(); | |
var Busboy = require('busboy'); | |
app.get('/', function (req, res) { | |
res.send('<html><head></head><body>\ | |
<form method="POST" enctype="multipart/form-data">\ |
Advantages compared to using symbols as enum values:
- Enum values are much more customizable. For example, one can have custom prototype and/or instance methods.
- Enum values get two custom properties:
name
provides direct access to the name of an enum value.ordinal
holds a number, the position of the enum value. Useful for some applications.
- One can use
instanceof
to test whether a value is an element of an enum. - One occasionally requested feature for enums is that enum values be numbers (e.g. for flags) or strings (e.g. to compare with values in HTTP headers). That can be achieved by making those values properties of enum values. For an example, see
enum Mode
, below.
Static properties of enums:
This blog post has helped me clean up my postgres development environment on Mac. So making a copy!
How completely uninstall PostgreSQL 9.X on Mac OSX
This article is referenced from stackoverflow:
If installed PostgreSQL with homebrew , enter brew uninstall postgresql
If you used the EnterpriseDB installer , follow the following step.
This file contains 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
import axios from 'axios'; | |
class Service { | |
constructor() { | |
let service = axios.create({ | |
headers: {csrf: 'token'} | |
}); | |
service.interceptors.response.use(this.handleSuccess, this.handleError); | |
this.service = service; | |
} |
This file contains 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
const { exec } = require('child_process') | |
function run(cmd) { | |
return new Promise((resolve, reject) => { | |
exec(cmd, (error, stdout, stderr) => { | |
if (error) return reject(error) | |
if (stderr) return reject(stderr) | |
resolve(stdout) | |
}) | |
}) |
OlderNewer