Skip to content

Instantly share code, notes, and snippets.

// (c) 2014 Nate Cook, licensed under the MIT license
//
// Fisher-Yates shuffle as top-level functions and array extension methods
/// Shuffle the elements of `list`.
func shuffle<C: MutableCollectionType where C.Index == Int>(inout list: C) {
let count = countElements(list)
for i in 0..<(count - 1) {
let j = Int(arc4random_uniform(UInt32(count - i))) + i
swap(&list[i], &list[j])
@zhjuncai
zhjuncai / abbr.css
Created January 16, 2014 03:01
The simple technique described in this article allows us to enhance how mobile users read the text of our web pages. Its compatibility is good because it can be employed in all major browsers, including Internet Explorer starting from version 9. In addition, we can use it in Internet Explorer 8 too using a shim to support media queries.
abbr[title]:after
{
content: " (" attr(title) ")";
}
@media screen and (min-width: 1025px)
{
abbr[title]
{
border-bottom: 1px dashed #ADADAD;
@zhjuncai
zhjuncai / index.html
Created December 19, 2013 13:43
remove jquery mobile transition
<script>
$(document).bind("mobileinit", function() {
$.mobile.defaultPageTransition = 'none';
$.mobile.defaultDialogTransition = "none";
});
</script>
<?php
// Clean argument values
$phpStormRunner = null;
$cleanedArgv = array();
foreach ($_SERVER['argv'] as $key => $value) {
if (strpos($value, 'ide-phpunit.php') === false) {
$cleanedArgv[] = $value;
} else {
$phpStormRunner = $value;
}
*&---------------------------------------------------------------------*
*& Report Z_TRQ_GET_PARTY
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT Z_TRQ_GET_PARTY.
@zhjuncai
zhjuncai / Timestamp.abap
Created August 7, 2013 03:20
Demostrate how to get timestamp in ABAP and setup timezone
*&---------------------------------------------------------------------*
*& Report Z_TIMSTAMP_DEMO
*&
*&---------------------------------------------------------------------*
*& Demostrate how to get timestamp in ABAP and setup timezone
*&
*&---------------------------------------------------------------------*
REPORT Z_TIMSTAMP_DEMO.
zend_extension="/usr/lib/php5/20090626/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=localhost
xdebug.remote_port=9000
@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
@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.