Skip to content

Instantly share code, notes, and snippets.

View iwatakeshi's full-sized avatar
📚
Always learning

Takeshi iwatakeshi

📚
Always learning
View GitHub Profile
@iwatakeshi
iwatakeshi / snippet.html
Created July 12, 2015 18:55
Squarespace Gallery Snippet
<div class="
sqs-gallery-container
sqs-gallery-block-slideshow
sqs-gallery-has-controls
sqs-gallery-has-thumbnails
sqs-gallery-block-show-meta sqs-gallery-block-meta-position-bottom

I get 10 times more traffic from [Google] 1 than from [Yahoo] 2 or [MSN] 3.

@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)');
# Options For Default Plugins
# ===========================
# API Options
# See https://github.com/gengojs/plugin-api for documentation.
[api]
# 'global' refers to the api use for i18n your phrases.
# ( e.g. __("Hello") )
global = "__"
# 'localize' refers to the api use for i18n your date, time, and number.
@iwatakeshi
iwatakeshi / scanner.js
Last active October 29, 2015 23:06
An pseudo code for mr-doc.
'use strict';
class Source {
constructor(source) {
source = source[source.length - 1] === this.EOF ?
source : source += this.EOF;
this._source = [];
for(var i = 0; i < source.length; i++) { this._source[this._source.length] = source[i]; }
this._line = 1;
@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 / docs.json
Created April 3, 2016 21:01
Sample JSON output from Mr. Doc v4
{
"options": {
"name": "Mr. Doc",
"url": {
"home": "https://mr-doc.github.io/",
"repo": "https://www.github.com/mr-doc/mr-doc"
}
},
"comments": [
{
@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 / lazy.js
Last active January 26, 2017 01:16
Assuming the recorded video is on the desktop, this script will slice the video into images and merge them into a GIF image. The images will be stored into a zipped for dropbox.
#!/usr/bin/env node
const
fs = require('fs'),
path = require('path'),
exec = require('child_process').execSync;
const
cwd = process.cwd,
stat = fs.statSync,
exists = fs.existsSync;
let video = process.argv.slice(2)[0];