Skip to content

Instantly share code, notes, and snippets.

var validator = require('validator');
var hankaku = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ';
var zenkaku = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ';
var zenkakuToHankaku = function (word) {
for (var i = 0, n = zenkaku.length; i < n; i++) {
word = word.replace(new RegExp(zenkaku[i], 'gm'), hankaku[i]);
}
return word.replace(/^\s+|\s+$/g, ''); // trim head and tail white space
};
#
# A virtual host using mix of IP-, name-, and port-based configuration.
# This is based on using Homebrew for OS X. You can use this in other
# cases though, but you'll likely need to adjust some of the paths below.
#
server {
# Replace this port with the right one for your requirements
# listen 80 [default|default_server]; #could also be 1.2.3.4:80
tell application "iTunes"
activate
set newPreset to make new EQ preset
set name of newPreset to "Perfect"
set band 1 of newPreset to 3
set band 2 of newPreset to 6
set band 3 of newPreset to 9
set band 4 of newPreset to 7
set band 5 of newPreset to 6
set band 6 of newPreset to 5
tell application "iTunes"
activate
set newPreset to make new EQ preset
set name of newPreset to "Eargasm Explosion"
set band 1 of newPreset to 3
set band 2 of newPreset to 6
set band 3 of newPreset to 9
set band 4 of newPreset to 7
set band 5 of newPreset to 6
set band 6 of newPreset to 5
@awsp
awsp / tinytest.api
Last active August 29, 2015 14:18 — forked from stbaer/tinytest.api
test.isFalse(v, msg)
test.isTrue(v, msg)
test.equal(actual, expected, message, not)
test.length(obj, len)
test.include(s, v)
test.isNaN(v, msg)
test.isUndefined(v, msg)
test.isNotNull
test.isNull
test.throws(func)
@awsp
awsp / common.js
Last active August 29, 2015 14:20 — forked from markdaws/common.js
// common.js ======================================
(function(exports) {
// Define all your functions on the exports object
exports.foo = function() {
return 'bar';
};
})((typeof process === 'undefined' || !process.versions)
@awsp
awsp / setup-dev.sh
Last active August 29, 2015 14:27
Install homebrew, nginx, mysql, php55, and composer on Mac OS X
#!/bin/bash
# install homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# install homebrew's official php tap
brew tap josegonzalez/homebrew-php
@awsp
awsp / EasyJumpPreciseMotionAce.vim
Created June 29, 2016 19:14 — forked from gfixler/EasyJumpPreciseMotionAce.vim
A Vim take on Emacs' AceJump mode, itself based on Vim's PreciseJump and EasyMotion plugins
" ACEJUMP
" Based on emacs' AceJump feature (http://www.emacswiki.org/emacs/AceJump).
" AceJump based on these Vim plugins:
" EasyMotion (http://www.vim.org/scripts/script.php?script_id=3526)
" PreciseJump (http://www.vim.org/scripts/script.php?script_id=3437)
" Type AJ mapping, followed by a lower or uppercase letter.
" All words on the screen starting with that letter will have
" their first letters replaced with a sequential character.
" Type this character to jump to that word.
@awsp
awsp / delete-targz.php
Last active July 6, 2016 19:10 — forked from Xeroday/delete-targz.php
Deletes .tar.gz files older than 7 days.
<?php
$files = glob("*.tar.gz");
$days = 7;
foreach($files as $file) {
if(is_file($file)
&& time() - filemtime($file) >= $days*24*60*60) {
unlink($file);
}
}
@awsp
awsp / tmux.md
Created July 22, 2016 18:46 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a