Skip to content

Instantly share code, notes, and snippets.

@zhjuncai
zhjuncai / randomColor.swift
Created January 17, 2015 12:11
Get Random color - swift
/**
Get Random Color by generating three random float to represent RGB
**/
func randomColor() -> UIColor{
var randomRed:CGFloat = CGFloat(drand48())
var randomGreen:CGFloat = CGFloat(drand48())
var randomBlue:CGFloat = CGFloat(drand48())
return UIColor(red: randomRed, green: randomGreen, blue: randomBlue, alpha: 1.0)
import UIKit
import XCPlayground
class ViewController: UIViewController {
func action() { print("Bing!") }
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .whiteColor()
@zhjuncai
zhjuncai / css-supports.js
Created January 14, 2016 02:04 — forked from codler/css-supports.js
CSS.supports() Polyfill
/*! CSS.supports() Polyfill
* https://gist.github.com/codler/03a0995195aa2859465f
* Copyright (c) 2014 Han Lin Yap http://yap.nu; MIT license */
if (!('CSS' in window)) {
window.CSS = {};
}
if (!('supports' in window.CSS)) {
window.CSS._cacheSupports = {};
window.CSS.supports = function(propertyName, value) {
@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