Skip to content

Instantly share code, notes, and snippets.

View flyingzl's full-sized avatar
🎯
Focusing

石头 flyingzl

🎯
Focusing
  • Chengdu,China
View GitHub Profile
@flyingzl
flyingzl / singleton.js
Created January 23, 2013 13:06
javascript singleton pattern
var Singleton =(function(){
var _instance ;
function init(){
return {
method: function(){
return 1;
},
property: 'hello'
}
}
var __hasProp = {}.hasOwnProperty,
__extends = function(child, parent) {
for (var key in parent) {
if (__hasProp.call(parent, key))
child[key] = parent[key];
}
function ctor() {
this.constructor = child;
}
<style type="text/css">
#container { border: 1px solid #000; }
#left { background: #ccc; width: 300px; float: left; height:200px; }
#right { background: #ddd; width: 300px; float: right; height:200px;}
/* self clearing rules ie8以上及其firefox、chrome等浏览器支持 */
var DeferredHelper = {
objectVariableIsSet: function(object, variableName) {
var dfd = $.Deferred();
var interval = setInterval(function() {
if (object[variableName] !== undefined) {
clearInterval(interval);
console.log('objectVariableIsSet');
dfd.resolve()
}
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script type="text/javascript">
if( !Object.create){
Object.create = function( o ){
function actor() {}
actor.prototype = o;
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}
}
apply plugin: 'android'
//
// API.swift
//
// Created by Taro Minowa on 6/10/14.
// Copyright (c) 2014 Higepon Taro Minowa. All rights reserved.
//
import Foundation
typealias JSONDictionary = Dictionary<String, AnyObject>
@flyingzl
flyingzl / http-sever.go
Created June 10, 2015 07:50
golang server and client
package main
import (
"fmt"
"html/template"
"io"
"log"
"net/http"
"os"
)
@flyingzl
flyingzl / think_in_react.js
Last active October 21, 2015 10:01
Think in React
var App = (props) =>{
return <ProductFilterTable items={props.items} />
}
var ProductFilterTable = React.createClass({
getInitialState: function(){
return {
text: "",
onlyStock:false
@flyingzl
flyingzl / android_naviator_react-native.js
Last active September 26, 2017 06:32
Use Navigator component in react-native
'use strict';
var React = require('react-native');
var {
AppRegistry,
View,
Navigator,
Text,
BackAndroid,
StyleSheet