Skip to content

Instantly share code, notes, and snippets.

@zhjuncai
zhjuncai / gist:5797427
Created June 17, 2013 14:46
Mircoformat
<div class="vcard">
<div class="fn org">Wikimedia Foundation Inc.</div>
<div class="adr">
<div class="street-address">149 New Montgomery Street, 3rd Floor</div>
<div> <span class="locality">San Francisco</span>, <abbr class="region" title="California">CA</abbr> <span class="postal-code">94105</span></div>
<div class="country-name">USA</div>
</div>
<div>Phone: <span class="tel">+1-415-839-6885</span></div>
<div>Email: <span class="email">info@wikimedia.org</span></div>
<div>
@zhjuncai
zhjuncai / gist:5797435
Created June 17, 2013 14:47
Microdata
<article itemscope itemtype="http://schema.org/Recipe">
<h1 itemprop="name">Beef with Carrots and Onions</h1>
<p itemprop="description">Carrots and onions goes really well together with grilled beef.</p>
<ul>
<li itemprop="ingredients">250 g beef</li>
<li itemprop="ingredients">One carrot</li>
<li itemprop="ingredients">One onion</li>
</ul>
<p itemprop="recipeInstructions">Trim the onion and carrot, chop them finely and fry in a pan. Grill the beef for 2 minuted per side in a really hot cast iron skillet.</p>
</article>
@zhjuncai
zhjuncai / getter-setter.js
Created June 19, 2013 14:47
JavaScript getter setter Starting in JavaScript 1.8.5, the get operator: can have an identifier which is either a number or a string; must have exactly zero parameters (see Incompatible ES5 change: literal getter and setter functions must now have exactly zero or one arguments for more information); must not appear in an object literal with anot…
var entry = {
log : [],
set current : function(str){
return this.log[this.log.length-1] = str;
}
get latest : function(){
if(this.log.length > 0){
return this.log[this.length - 1];
}else{
return null;
@zhjuncai
zhjuncai / script.js
Created July 3, 2013 02:58
A CodePen by nicolas barradeau. progressive quad Bezier explained - isolated and commented sample from the previous pen. hope it will be of some use. NB this is N-dimensionnal so you can process cubic Bezier too :)
/**
* @author Nicolas Barradeau
*/
//a progressive quadBezier + a scribbler
(function() {
//a series of quadratic curves descriptions P0 x/y, anchor x/y, P1 x/y
var path = [ 200,200, 300,100, 350,150,
mysqldump -u username -p[password] olddb --lock-tables=false | mysql -u username -p[username] test_db
@zhjuncai
zhjuncai / phpunit.sh
Created July 5, 2013 15:13
Install PHPUnit in Ubuntu 12.04
sudo apt-get remove phpunit
sudo pear channel-discover pear.phpunit.de
sudo pear channel-discover pear.symfony-project.com
sudo pear channel-discover components.ez.no
sudo pear update-channels
sudo pear upgrade-all
sudo pear install --alldeps phpunit/PHPUnit
sudo apt-get install phpunit
@zhjuncai
zhjuncai / gist:5994342
Last active December 19, 2015 17:49
CURL Usage
--silent don't output anything
curl --silent http://example.com > /dev/null 2>&1
curl --output-document=/dev/null http://example.com
--cookie attach cookie with your request
curl --cookie "key=value" http://server.com
@zhjuncai
zhjuncai / z_demo_structdescr.abap
Last active March 19, 2024 03:39
abap demo use of cl_abap_structdescr to get list of structure component definition
*&---------------------------------------------------------------------*
*& report z_demo_structdescr
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
report z_demo_structdescr.
@zhjuncai
zhjuncai / Z_DEMO_STRING.abap
Created July 26, 2013 02:48
ABAP strlen test demo
*&---------------------------------------------------------------------*
*& Report Z_DEMO_STRING
*&---------------------------------------------------------------------*
REPORT Z_DEMO_STRING.
data:
lv_length type i,
lv_string type char20.
@zhjuncai
zhjuncai / vhost.conf
Last active December 20, 2015 07:39
Virtual Host configuration
<VirtualHost *:80>
ServerAdmin email@gmail.com
ServerName project.local
DocumentRoot /home/uname/Documents/GitProj
<Directory /home/uname/Documents/GitProj/>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all