Skip to content

Instantly share code, notes, and snippets.

View geraldyeo's full-sized avatar
🎯
Focusing

Gerald Yeo geraldyeo

🎯
Focusing
View GitHub Profile
@geraldyeo
geraldyeo / hex-rgb-hsl.js
Created June 29, 2016 03:31
Regex for HEX/RGB(A)/HSL(A)
// Use simple one, if you need to find a definitely correct HEX/RGB(A)/HSL(A)
// color value among random text (limitations are set by its initial correctness):
/(#[\d\w]+|\w+\((?:\d+%?(?:,\s)*){3}(?:\d*\.?\d+)?\))/i
// …or use complex one instead, if you need to find (or not) one (or several)
// HEX/RGB(A)/HSL(A) color value(s) that has to be verified:
/(#(?:[\da-f]{3}){1,2}|rgb\((?:\d{1,3},\s*){2}\d{1,3}\)|rgba\((?:\d{1,3},\s*){3}\d*\.?\d+\)|hsl\(\d{1,3}(?:,\s*\d{1,3}%){2}\)|hsla\(\d{1,3}(?:,\s*\d{1,3}%){2},\s*\d*\.?\d+\))/gi
@geraldyeo
geraldyeo / rebase.sh
Created June 24, 2016 08:55
git rebase locally
# rebase using the last four commits from where the HEAD is with HEAD~4
git rebase -i HEAD~4
@geraldyeo
geraldyeo / keystone.js
Created April 20, 2016 02:23
adding more options for express server
var keystone = require('keystone');
var express = require('express');
var body = require('body-parser');
var helmet = require('helmet');
var app = express();
app.use(body.urlencoded({ extended: false }));
app.use(body.json());
app.use(helmet());
@geraldyeo
geraldyeo / keymap.cson
Created March 4, 2016 07:49
atom keymap: emmet
'atom-text-editor[data-grammar~="jsx"]:not([mini])':
'tab': 'emmet:expand-abbreviation-with-tab'
@geraldyeo
geraldyeo / git_gists.sh
Last active January 25, 2016 10:48
Some git gists
# rename branch
git branch -m <branch>
git push origin --delete <old_branch>
git push -u origin <branch>
# rename github repo
git remote rm origin
git remote add origin [email protected]:"yourusername"/"projectname".git
#
# A two-line, Powerline-inspired theme that displays contextual information.
#
# This theme requires a patched Powerline font, get them from
# https://github.com/Lokaltog/powerline-fonts.
#
# Authors:
# Isaac Wolkerstorfer <[email protected]>
# Jeff Sandberg <[email protected]>
# Sorin Ionescu <[email protected]>
@geraldyeo
geraldyeo / wallabyconfig.js
Created September 15, 2015 03:16
wallaby.js config file
var babel = require('babel');
module.exports = function (wallaby) {
return {
files: [
'src/lib/**/*.js',
],
tests: [
'src/test/*.spec.js'
],
@geraldyeo
geraldyeo / no-ds_store
Created June 11, 2015 11:54
get rid of DS_Store
`defaults write com.apple.desktopservices DSDontWriteNetworkStores true`
Install [Asepsis](http://asepsis.binaryage.com/)
`sudo find . -name '*.DS_Store' -type f -delete`
@geraldyeo
geraldyeo / curlbot.txt
Created April 14, 2015 02:52
curl as googlebot
curl -L -A "Googlebot/2.1 (+http://www.google.com/bot.html)" http://example.com
var source = require('vinyl-source-stream');
var gulp = require('gulp');
var gutil = require('gulp-util');
var browserify = require('browserify');
var reactify = require('reactify');
var watchify = require('watchify');
var notify = require("gulp-notify");
var scriptsDir = './scripts';
var buildDir = './build';