Skip to content

Instantly share code, notes, and snippets.

@goooooouwa
goooooouwa / ClassName.h
Created August 30, 2013 07:58
This gist shows you how to define public and private method and property, also where to define instance variable.
//
// className.h
// Objective-C exploration
//
// Created by Greg Xu on 8/30/13.
// Copyright (c) 2013 Greg Xu. All rights reserved.
//
#import <Foundation/Foundation.h>
# synchronous workflow:
success();
failure();
synchronousFunction(){
do something
if return TRUE, call success()
else call failure()
}
#!/bin/bash
### this script use ctags installed by Homebrew to generate tags for all gems specified in your Rails project's gemfile.
# `brew --prefix` display the install path of brew
# generate tags for all gems specified in the gemfile.
bundle show --paths | xargs `brew --prefix`/bin/ctags -R
# index the tags and append the tags for your project run
`brew --prefix`/bin/ctags -R -a *
#!/bin/bash
psql -U postgres book_store_development
sed -i "" "s/.*console.log.*//g" app.js
sed -i "" "s/.*console.log.*//g" index.js
sed -i "" "s/.*console.log.*//g" routes.js
sed -i "" "s/.*console.log.*//g" ./controllers/callback_controller.js
sed -i "" "s/.*console.log.*//g" ./controllers/callback_new_controller.js
sed -i "" "s/.*console.log.*//g" ./controllers/callback_show_controller.js
sed -i "" "s/.*console.log.*//g" ./controllers/contact_controller.js
sed -i "" "s/.*console.log.*//g" ./controllers/dashboard_controller.js
#!/bin/bash
###
#
# Mailx for Gmail Command Line for Ubuntu
# Version 1.0
#
# USAGE:
# sudo ./setup_gmail_command_line.sh install
#
open -a /Applications/Google Chrome.app --args --allow-file-access-from-files --disable-web-security
# local server
redis-server /usr/local/etc/redis.conf
bundle exec sidekiq -d -L log/sidekiq.log
bundle exec rails s puma
bundle exec rackup faye/config.ru -p 9292
/usr/bin/mongod --config /etc/mongodb.conf
@goooooouwa
goooooouwa / GoogleImageSearch.sh
Created December 6, 2013 14:41
This is a Google Image batch download tool, takes search query as input, resulting a folder containing Google Image search results( usually couple of images). This is a prototype, real product will be created later on.
# DESCRIPTION
# This is a Google Image batch download tool, takes search query as input,
# resulting a folder containing Google Image search results( usually couple of images).
# SYNOPSIS
# ./GoogleImageSearch.sh QUERY
# EXAMPLE
# ./GoogleImageSearch.sh 'Linkin Park'
echo 'searching Google Image for' $1 '...';
#replace space with '+', ex."Linkin Park" -> "Linkin+Park"
@goooooouwa
goooooouwa / sed_pound
Last active January 3, 2016 07:59
search and replace all appearance of "&pound;" in each template.
sed -i 's/&pound;/<%= localStorage.getItem("PT-currency-symbol") %>/g' ./client/mypt.html
sed -i 's/&pound;/<%= localStorage.getItem("PT-currency-symbol") %>/g' ./client/mypt.html
sed -i 's/&pound;/<%= localStorage.getItem("PT-currency-symbol") %>/g' ./trainer/dashboard.html
sed -i 's/&pound;/<%= localStorage.getItem("PT-currency-symbol") %>/g' ./trainer/packages/view.html
sed -i 's/&pound;/<%= localStorage.getItem("PT-currency-symbol") %>/g' ./trainer/invoices/listItem.html
sed -i 's/&pound;/<%= localStorage.getItem("PT-currency-symbol") %>/g' ./trainer/invoices/listItem.html
sed -i 's/&pound;/<%= localStorage.getItem("PT-currency-symbol") %>/g' ./trainer/invoices/view.html
sed -i 's/&pound;/<%= localStorage.getItem("PT-currency-symbol") %>/g' ./trainer/profile.html
sed -i 's/&pound;/<%= localStorage.getItem("PT-currency-symbol") %>/g' ./trainer/profile.html