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
{ | |
"env": { | |
"es6": true, | |
"node": true, | |
"mocha": true | |
}, | |
"extends": "airbnb-base", | |
"rules": { | |
"func-names": ["error", "never"], | |
"comma-dangle": ["error", "only-multiline"], |
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
local ret_status="%(?:%{$fg_bold[green]%}λ:%{$fg_bold[red]%}λ%s)" | |
PROMPT='${ret_status}%{$fg_bold[cyan]%}%p %{$fg[cyan]%}%c » %{$fg[green]%}%{$reset_color%}' | |
RPROMPT='$(git_prompt_info)%{$fg_bold[white]%}%{$reset_color%}' | |
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[yellow]%} " | |
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" | |
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[yellow]%}%{$fg[red]%} 🗴 %{$reset_color%}" | |
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[yellow]%}%{$fg[green]%} 🗹 %{$reset_color%}" |
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
function curry( fn, arity ) { | |
//var arity = fn.length; | |
return (function resolver() { | |
let mem = Array.prototype.slice.call( arguments ); | |
return function() { | |
let args = mem.slice(); | |
Array.prototype.push.apply( args, arguments ); | |
return ( args.length >= arity ? fn : resolver ).apply( null, args ); | |
}; |
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
Object.prototype.isEmpty = function () { | |
return !Object.keys(this) | |
.map(k => this.hasOwnProperty(k), this) // bind the value of `this` for each callback | |
.length | |
} | |
// Usage: | |
// > let obj0 = {} | |
// > let obj1 = {foo: 1, bar: 2} | |
// > obj0.isEmpty() // true |
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
String.prototype.countLetterFreq = function () { | |
return this | |
.split('') | |
.filter(l => l.trim()) | |
.map(l => l.toLowerCase()) | |
.reduce( (acc, cur) => { acc[cur] = (acc[cur] === undefined) ? 1 : acc[cur] + 1; return acc; }, {} ) | |
} | |
// Usage: | |
// > "This is a nice sentence".countLetterFreq() |
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 validateEmail = function (email) { | |
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; | |
return re.test(email); | |
} | |
var validateAlphanumeric = function (txt) { | |
var re = /^[a-z0-9]*$/i; | |
return re.test(txt); | |
} |
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
// Dependencies | |
var gulp = require('gulp'); | |
var nodemon = require('gulp-nodemon'); | |
var notify = require('gulp-notify'); | |
var livereload = require('gulp-livereload'); | |
// Task | |
gulp.task('server', function() { | |
// listen for changes | |
livereload.listen(); |
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
## Source: http://stackoverflow.com/a/1585810/1823866 | |
find /home/www/ -type f -exec \ | |
sed -i 's/subdomainA\.example\.com/subdomainB.example.com/g' {} + |
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
<?php | |
/* | |
* genurl.php | |
* | |
* Copyright 2010-11 Sayan "Riju" Chakrabarti <me@sayanriju.co.cc> | |
* | |
* This program is free software; you can redistribute it and/or modify | |
* it under the terms of the GNU General Public License as published by | |
* the Free Software Foundation; either version 2 of the License, or | |
* (at your option) any later version. |
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
#!/usr/bin/python | |
# ============================================================================= | |
# | |
# Remuco - A remote control system for media players. | |
# Copyright (C) 2006-2010 by the Remuco team, see AUTHORS. | |
# | |
# This file is part of Remuco. | |
# | |
# Remuco is free software: you can redistribute it and/or modify |