Skip to content

Instantly share code, notes, and snippets.

View d6u's full-sized avatar

Daiwei Lu d6u

View GitHub Profile
class ClassA {
}
let ClassARef: ClassA.Type = ClassA.self
let a = ClassARef.init()
a is ClassA // true
let ClassARef2: ClassA.Type = b.dynamicType
struct Entity {
let name: String
let age: Int
}
enum SortResult {
case LeftFirst
case RightFirst
case Same
}
vim -E -s $1 <<-EOF
:set expandtab
:set shiftwidth=2
:set tabstop=2
:set softtabstop=2
normal ggVG=
:wq
EOF
{
"ecmaFeatures": {},
"parser": "espree",
"env": {
"browser": false,
"node": false,
"amd": false,
"mocha": false,
"jasmine": false,
"phantomjs": false,
//
// NSString+HTML.m
// MWFeedParser
//
// Copyright (c) 2010 Michael Waterfall
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
module.exports = {
// Modern
//
bs_chrome_osx: {
base: 'BrowserStack',
os: 'OS X',
os_version: 'Yosemite',
browser: 'chrome',
browser_version: '39.0'
},
@d6u
d6u / usage.js
Last active August 29, 2015 14:21 — forked from jasonfarrell/usage.js
var my_element = document.getElementById('my-element');
//-- Returns true/false
my_element.isVisible(my_element);
//: Playground - noun: a place where people can play
import Foundation
import UIKit
import XCPlayground
class DLLabel: UILabel {
let textContainer = NSTextContainer()
let layoutManager = NSLayoutManager()
'use strict';
function collectForm(form) {
var q = {};
var i;
var j;
if (!form || form.nodeName !== 'FORM') {
return null;
}
var Bluebird = require('bluebird');
function Something() {
this.queue = [];
this.currentJob = null;
}
Something.prototype.queueJob = function (job) {
if (this.currentJob) {
this.queue.push(job);