Skip to content

Instantly share code, notes, and snippets.

View iwatakeshi's full-sized avatar
📚
Always learning

Takeshi iwatakeshi

📚
Always learning
View GitHub Profile
/**
* AuthController
*
* @module :: Controller
* @description :: Contains logic for handling auth requests.
*/
var passport = require('passport');
var GoogleStrategy = require('passport-google').Strategy;
@iwatakeshi
iwatakeshi / array-early-exit-options.js
Created October 9, 2015 04:20 — forked from wilmoore/array-early-exit-options.js
Array iteration early exit options -- best options are lodash.forEach or Array#some.
/**
* Use `Array#some` when it is convenient to exit on truthy return values
* Use `lodash.forEach` when it is convenient to exit on false (you can cast if necessary with `!!`)
*/
var _ = require('lodash');
var numbers = [1, 2, 3, 4, 5, 6];
console.log('Array#forEach (result not as expected)');
@iwatakeshi
iwatakeshi / .gitignore
Created November 16, 2015 19:48 — forked from mathiasbynens/.gitignore
Generating a regular expression to match valid JavaScript identifiers (like https://mathiasbynens.be/demo/javascript-identifier-regex) in Node.js
node_modules
@iwatakeshi
iwatakeshi / node-and-npm-in-30-seconds.sh
Created March 24, 2016 17:32 — forked from isaacs/node-and-npm-in-30-seconds.sh
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl -k -L https://npmjs.org/install.sh | sh
@iwatakeshi
iwatakeshi / gulpfile.js
Created April 8, 2016 04:52 — forked from danharper/gulpfile.js
New ES6 project with Babel, Browserify & Gulp
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));
@iwatakeshi
iwatakeshi / gist:e7b24ea44206eab7f2bfa3188a47e874
Created October 12, 2017 17:10 — forked from jwebcat/gist:5122366
Properly download from github using wget and curl
wget --no-check-certificate --content-disposition https://github.com/joyent/node/tarball/v0.7.1
# --no-check-cerftificate was necessary for me to have wget not puke about https
curl -LJO https://github.com/joyent/node/tarball/v0.7.1
@iwatakeshi
iwatakeshi / dijkstra.cpp
Created October 13, 2017 15:55 — forked from johngian/dijkstra.cpp
Dijkstra in C++ using STL
#define MAX 999999999
#include <stdio.h>
#include <stdlib.h>
#include <map>
#include <vector>
#include <queue>
#include <utility>
using namespace std;
class compare
@iwatakeshi
iwatakeshi / codesign_gdb.md
Created October 19, 2017 04:27 — forked from hlissner/codesign_gdb.md
Codesign gdb on OSX

Note: these instructions are for pre-Sierra MacOS. Sierra Users: see https://gist.github.com/gravitylow/fb595186ce6068537a6e9da6d8b5b96d by @gravitylow.

If you are getting this in gdb on OSX while trying to run a program:

Unable to find Mach task port for process-id 57573: (os/kern) failure (0x5).
 (please check gdb is codesigned - see taskgated(8))
  1. Open Keychain Access
/*
* PriorityQueue.cpp
*
* Created on: 2013/10/27
* Author: tsu-nera
*
*/
#include "PriorityQueue.h"
#include <iostream>
@iwatakeshi
iwatakeshi / delete_git_submodule.md
Created July 22, 2018 14:39 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule