Skip to content

Instantly share code, notes, and snippets.

<?php
class DummyClass
{
public $msg;
}
$obj = new DummyClass();
$obj->msg = "Hello World";
echo $obj->msg.PHP_EOL;
<?php
class DummyClass
{
public $msg;
}
$obj = new DummyClass();
$obj->msg = "Hello World";
echo $obj->msg.PHP_EOL;
@Wuvist
Wuvist / config.py
Created October 19, 2012 07:51
Switch config files
#!/usr/bin/env python
import sys, os
import shutil
if len(sys.argv) < 3:
print "Usage: ./configs.py [backup|restore] venture"
sys.exit()
current_path = os.path.dirname(os.path.abspath(__file__)) + os.sep
[user]
name = XXX.YYY
email = XXXX@zalora.sg
[core]
excludesfile = /home/zalora/.gitignore_global
[color]
diff = auto
status = auto
# usage: startsolr sg/tw
get_proc=`ps -e -o pid,command | grep java`
echo $get_proc > get_it
get_pid=`gawk -F" " '{ print $1 }' get_it`
kill $get_pid
rm get_it
cd solr/$1/jetty/
nohup java -jar -Dt=$1 start.jar &
cd ../..
cd trunk
sudo php bob/cli/index.php --env=dev --module=solr --controller=import --action=import
cd ..
#!/usr/bin/env python
import sys, os
import shutil
if len(sys.argv) < 2:
print "Usage: ./runsite.py venture"
sys.exit()
current_path = os.path.dirname(os.path.abspath(__file__)) + os.sep
@Wuvist
Wuvist / shuffle.py
Created November 19, 2012 11:22
Using quicksort for shuffling an array
import random
def cmp(a, b):
i = random.randint(0, 1)
if i == 1:
return True
return False
def quicksort(q, cmp):
lesser=[]
#!/usr/bin/env python
# encoding: utf-8
"""
check_balancer.py
Created by Wuvist on 2012-12-10.
Copyright (c) 2011 . All rights reserved.
"""
import urllib
@Wuvist
Wuvist / gist:4545040
Created January 16, 2013 06:09
missing </div>
<style> .sizechart_container{padding:10px 0px 40px 20px} .sizechart_container h1{font-size:160%; padding:0px 0 10px 0; margin:0;} .sizechart_container b{} .sizechart{ border:1px solid #666666; font-family:Helvetica; } a.fittingguide{color:#e53f03; font-weight:bold; text-decoration:none;} .sizechart td{padding:10px 15px 10px 15px; background:url([MEDIA_BASE_URL]/cms/vertical_line.jpg) repeat-x bottom left; color:#888888; font-size:12px} .sizechart td.header{background:#fafafa; font-weight:bold; border-bottom:1px solid #efefef; font-size:14px; color:#333333} .sc_header{font-size:16px; font-weight:bold; background:url(vertical_line.jpg) repeat-x bottom left; padding:0 10px 10px 10px; font-family:Helvetica} .sizechart_summary{font-size:12px; color:#888888;} </style> <div class="sizechart_container"> <h1>Newborn / Toddlers</h1> <table class="sizechart" cellpadding="0" cellspacing="0"> <tr> <td class="header">Age<br> Girls/Boys</td> <td class="header">Size 1</td> <td class="header">Size 2</td> <td class="header">He