Skip to content

Instantly share code, notes, and snippets.

Darcy Liu darcyliu

Block or report user

Report or block darcyliu

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@darcyliu
darcyliu / command.sh
Created Jun 4, 2014
Hello World for Swift and C
View command.sh
export PATH="/Applications/Xcode6-Beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode6-Beta.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift hello.swift
clang world.c -oworld
@darcyliu
darcyliu / DLMultiSelectionControl.h
Last active Aug 29, 2015
DLMultiSectionControl
View DLMultiSelectionControl.h
//
// DLMultiSelectionControl.h
// DLMultiSelectionControl
//
// Created by Darcy Liu on 8/31/14.
// Copyright (c) 2014 Close To U. All rights reserved.
//
#import <UIKit/UIKit.h>
@darcyliu
darcyliu / theendoftheinternet.html
Created Sep 26, 2014
The End of the Internet.
View theendoftheinternet.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>The End of the Internet.</title>
<meta name="description" content="The End of the Internet.">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
::selection { background: #3399FF; color: #fff; text-shadow: none; }
body{
View cube.c
// 魔方是一种常见的玩具。2010年7月,美国加利福尼亚州科学家利用计算机证明任意组合的魔方均可以在20步之内还原。作为一个入门级的程序员
// ,我们决定先写一个验证魔方是否复原的程序。对于魔方的一个操作,我们用一个字母来表示。将魔方的一个面正对玩家,就有了前后上下左右六个面,
// 分别用F(Front),B(Back),U(Up),D(Down):,L(Left),R(Right)来表示将这个面顺时针旋转90度,
// 具体玩魔方的时候将右手覆盖到对应的面上,这六个操作时右手的旋转方向都是相同的。同时用X,Y, Z,表示顺时针旋转中间一层,分别对应U,
// R,F。具体情况可以参照下图。与这九个操作对应的还有f,b,u,d,l,r,x,y,z,表示逆时针旋转。
// http://i.imgur.com/hggwjka.png
// 现在我们给出一个操作序列,问在这么旋转之后,魔方是否和原来的时候完全一样。比如UXd被认为是不一样。
// 输入为一个长度不超过200的字符串,仅包含之上定义的18个字母。 如果能复原,输出Yes,否则输出No。
@darcyliu
darcyliu / phonenumber.c
Last active Aug 29, 2015
电话号码问题
View phonenumber.c
// 电话号码问题
// 商业单位需要容易记忆的电话号码,有一些方法可以让电话号码变得更容易记忆。譬如,可以把电话号码写成单词或短语,如 MON-GLOP
// 可以代表滑铁卢大学的电话。有时仅仅是把号码的一部分写成单词,如打 310-GINO 便可向 GINO
// 比萨饼店定购比萨。另一种让电话号码容易记忆的方法是将数字用一种容易记的方式组合起来,譬如 3-10-10-10 也可以代表 GINO
// 比萨饼店。
// 电话号码的标准形式是七位十进制数字,在它的第三位和第四位之间用连字符连接(例如:666-1200)。电话的键盘提供了字符与数字之间的映
// 射关系,如下所示:
// 2 A、B和C 3 D、E和F 4 G、H和I 5 J、K和L 6 M、N和O 7 P、R和S 8 T、U和V 9
@darcyliu
darcyliu / ArrayOperationsChecker.cpp
Last active Aug 29, 2015
ArrayOperationsChecker
View ArrayOperationsChecker.cpp
#include "ClangSACheckers.h"
#include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
#include "clang/StaticAnalyzer/Core/Checker.h"
#include "clang/StaticAnalyzer/Core/CheckerManager.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
#include <cstdio>
#include <iostream>
@darcyliu
darcyliu / manifest.plist
Created Oct 28, 2014
iOS Application Ad hoc distribution manifest
View manifest.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>items</key>
<array>
<dict>
<key>assets</key>
<array>
<dict>
@darcyliu
darcyliu / result.txt
Created Oct 29, 2014
text height calculation
View result.txt
size: {102.804, 486.74399999999957}
rect: {{0, 0}, {102.804, 486.74399999999957}}
suggestedSize: {98.6953125, 480}
rect: {{0, 0}, {100, 487}}
@darcyliu
darcyliu / NSString+AppStore.h
Created Nov 5, 2014
Short links to the App Store for your apps and company
View NSString+AppStore.h
//
// NSString+AppStore.h
// NSString+Additions
//
// Created by Darcy Liu on 11/5/14.
// Copyright (c) 2014 Darcy Liu. All rights reserved.
//
#import <Foundation/Foundation.h>
View gist:918878
class HomeHandler(BaseRequestHandler):
def get(self):
nodes = memcache.get('nodes')
if nodes is None:
nodes = Node.all()
nodes.fetch(100)
nodes = self.snippet('nodes.html',{'nodes':nodes})
memcache.set('nodes', nodes, 1800)
topics = memcache.get('topics')
You can’t perform that action at this time.