Skip to content

Instantly share code, notes, and snippets.

View appleboy's full-sized avatar
🔥
On Fire

Bo-Yi Wu appleboy

🔥
On Fire
View GitHub Profile
@appleboy
appleboy / gist:3140341
Created July 19, 2012 02:19
Escape POST string
<?php
foreach($_POST as $key => $value) {
$_POST[$key] = mysql_real_escape_string($value);
}
?>
@appleboy
appleboy / robot.js
Created December 6, 2012 06:58
appleboy
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(100);
@appleboy
appleboy / Sublime Setting
Last active December 15, 2015 12:29
Sublime Text User Setting.
{
"color_scheme": "Packages/Dayle Rees Color Schemes/Yule.tmTheme",
"default_line_ending": "unix",
"draw_white_space": "all",
"font_size": 15.0,
"ignored_packages":
[
"Vintage"
],
"indent_to_bracket": true,
@appleboy
appleboy / MariaDB 5.5 CentOS
Created March 30, 2013 15:54
MariaDB 5.5 CentOS repository list
# MariaDB 5.5 CentOS repository list - created 2013-03-30 15:52 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/centos6-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
@appleboy
appleboy / gist:6774735
Created October 1, 2013 06:52
install gearmand
install_gearmand() {
# aptitude -y install libboost-program-options-dev gperf libcloog-ppl0 libpq-dev libmemcached-dev libevent-dev
# install mariadb header file
# aptitude -y install libmariadbclient-dev
[ -f /tmp/libdrizzle-5.1.4.tar.gz ] || wget https://launchpad.net/libdrizzle/5.1/5.1.4/+download/libdrizzle-5.1.4.tar.gz -O /tmp/libdrizzle-5.1.4.tar.gz
[ -d /tmp/libdrizzle-5.1.4 ] && rm -rf /tmp/libdrizzle-5.1.4
[ -f /tmp/gearmand-1.1.9.tar.gz ] || wget https://launchpad.net/gearmand/1.2/1.1.9/+download/gearmand-1.1.9.tar.gz -O /tmp/gearmand-1.1.9.tar.gz
[ -d /tmp/gearmand-1.1.9 ] && rm -rf /tmp/gearmand-1.1.9
cd /tmp && tar xvfz libdrizzle-5.1.4.tar.gz && cd libdrizzle-5.1.4 && ./configure --prefix=/usr && make && make install
cd /tmp && tar xvfz gearmand-1.1.9.tar.gz && cd gearmand-1.1.9 && ./configure --prefix=/usr && make && make install
#!/bin/sh
script="index.php cli worker"
folder="/script_path/"
max_worker="5"
php_bin="/usr/bin/php"
count=0
current_count=$(ps aux | grep "index.php cli worker" | grep -v "grep" | wc -l)
if test $current_count -lt $max_worker
@appleboy
appleboy / copy_content.mkd
Last active May 18, 2023 07:03
Copy all branch from another repository?

Repository url

origin: https://github.com/appleboy/git-test
remote: https://github.com/appleboy/html5-template-engine

Copy all branch from another repository

Job Status

Done

  • [2014/01/14] Fix optimize admin js file error.
  • [2014/01/15] Linux logrotate for MySQL Log.
  • [2014/01/16] Move MySQL service from 100 to 101 and 102.
  • [2014/01/17] Enable [Galera Cluster][5] service on 100, 101, 102.
  • [2014/01/21] Introduction to Bobitag Server Architecture for Percona XtraDB Cluster.
  • [2014/01/24] Integrate [Require.js Javascript Loader][1] with jQuery Mobile framework on [Pili][4].
@appleboy
appleboy / gulp-compass.js
Last active January 2, 2016 23:59
Example for guip-compass settings.
var gulp = require('gulp');
var compass = require('gulp-compass');
gulp.task('compass', function() {
gulp.src('assets/stylesheets/*.sass')
.pipe(compass({
config_file: 'assets/config.rb',
sass: 'stylesheets',
css: 'your_css_folder_path'
}))
<?php
class MotelController extends \BaseController
{
/**
* Display a listing of the resource.
*
* @return Response
*/