Skip to content

Instantly share code, notes, and snippets.

View warpdesign's full-sized avatar
🏠
Working from home

Nicolas Ramz warpdesign

🏠
Working from home
View GitHub Profile
@warpdesign
warpdesign / test.js
Last active December 25, 2015 07:08
Test
function isArray(arr) {
return Object.prototype.toString.call(arr) === '[object Array]';
}
function foreach(arr, handler) {
if (isArray(arr)) {
for (var i = 0; i < arr.length; i++) {
handler(arr[i]);
}
}
@warpdesign
warpdesign / iOS7_Crash.js
Created September 17, 2014 14:49
iOS 7.x Safari crash POC
var tilesSrc = 'img/gods.png',
tilesCanvas = null,
tilesImg = null;
function getCanvasFromImage(image) {
var canvas = document.createElement('canvas');
canvas.width = image.naturalWidth;
canvas.height = image.naturalHeight;
@warpdesign
warpdesign / redirect_ipfw
Created June 16, 2014 08:58
Port redirection using ipfw
# this will redirect any incoming requests on port 80 to port 8080
ipfw add 1443 fwd 127.0.0.1,8080 tcp from any to me 80 in
@warpdesign
warpdesign / pm2_node_arguments
Created June 16, 2014 08:52
Passing arguments to nodejs using pm2
# will send--debug=7001 --trace-deprecation to nodejs executable
pm2 start myServer.js --node-args="--debug=7001 --trace-deprecation"
@warpdesign
warpdesign / pm2_options
Created June 16, 2014 08:47
Passing parameters to your script file
# -p 8080 will be sent to your myServer.js and accessible through process.argv array
pm2 start myServer.js -- -p 8080
@warpdesign
warpdesign / pm2_watch_mode
Created June 16, 2014 08:44
Using watch mode
pm2 start myServer.js --watch
@warpdesign
warpdesign / pm2_monitoring
Created June 16, 2014 07:37
Monitoring processes using the monit switch
pm2 monit
@warpdesign
warpdesign / pm2_launched
Created June 16, 2014 07:29
Launching PM2 on an 8-core iMac with "-i max" option
{ online: true, success: true, pid: 1113, pm2_version: '0.8.13' }
PM2 Process launched
┌──────────┬────┬─────────┬──────┬────────┬───────────┬────────┬─────────────┬─────────────┐
│ App name │ id │ mode │ PID │ status │ restarted │ uptime │ memory │ watching │
├──────────┼────┼─────────┼──────┼────────┼───────────┼────────┼─────────────┼─────────────┤
│ server │ 0 │ cluster │ 1114 │ online │ 0 │ 0s │ 29.738 MB │ unactivated │
│ server │ 1 │ cluster │ 1115 │ online │ 0 │ 0s │ 29.934 MB │ unactivated │
│ server │ 2 │ cluster │ 1116 │ online │ 0 │ 0s │ 30.063 MB │ unactivated │
│ server │ 3 │ cluster │ 1117 │ online │ 0 │ 0s │ 29.703 MB │ unactivated │
│ server │ 4 │ cluster │ 1118 │ online │ 0 │ 0s │ 30.293 MB │ unactivated │
@warpdesign
warpdesign / pm2-clusters
Last active August 29, 2015 14:02
Enabling cluster mode with pm2
pm2 start myServer.js -i max
@Override
public void onBackPressed() {
// finish() is called in super: we only override this method to be able to override the transition
super.onBackPressed();
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
}