Skip to content

Instantly share code, notes, and snippets.

View ucheng's full-sized avatar
💭
😄

Yu-Cheng Wang ucheng

💭
😄
View GitHub Profile
int diam = 10;
float centX, centY;
void setup() {
size(400, 400);
frameRate(24);
smooth();
centX = width/2;
centY = height/2;
stroke(0);
int diam = 10;
float centX, centY;
void setup() {
size(400, 400);
frameRate(24);
smooth();
centX = width/2;
centY = height/2;
stroke(0);
void setup() {
size(400, 400);
background(180);
strokeWeight(4);
strokeCap(SQUARE);
for(int h = 0; h <= height; h += 10) {
stroke(0, 255-h);
line(0, h, width, h);
@ucheng
ucheng / mydiff.diff
Created May 16, 2013 07:31
generate svn diff file
svn diff -x -p > mydiff.diff
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '160568050794239', // App ID
channelUrl : '//127.0.0.1/channel.html', // Channel File
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
<?php
// Global settings
if (array_key_exists('REQUEST_SCHEME', $_SERVER)) {
$cors_location = $_SERVER["REQUEST_SCHEME"] . "://" . $_SERVER["SERVER_NAME"] .
dirname($_SERVER["SCRIPT_NAME"]) . "/spectator/assets/cloudinary_cors.html";
} else {
$cors_location = "http://" . $_SERVER["HTTP_HOST"] . "/spectator/assets/cloudinary_cors.html";
};
$api_params = array("timestamp"=>time(), "callback"=>$cors_location);
@ucheng
ucheng / order_number.sql
Last active August 29, 2015 14:02
Create a order number by date
-- Function: get_day_order(character varying)
-- DROP FUNCTION get_day_order(character varying);
CREATE OR REPLACE FUNCTION get_day_order(restaurant_key character varying)
RETURNS character varying AS
$BODY$
DECLARE lastDate VARCHAR;
DECLARE currDate VARCHAR;
DECLARE configKey VARCHAR;
require 'bundler/capistrano'
default_run_options[:pty] = true
ssh_options[:forward_agent] = true
set :user, "<<your webfaction user>>"
set :domain, "#{user}@<<your domain>>"
set :application, "<<your application>>"
set :repository, "<< your ssh repository link >>"
set :deploy_to, "/home/#{user}/webapps/#{application}"
@ucheng
ucheng / gmap.html
Last active March 8, 2023 06:51
Get current location and show marker on Google Map
<!DOCTYPE html>
<html lang="en">
<head>
<!--https://developers.google.com/maps/documentation/javascript/tutorial?hl=zh-tw#HelloWorld-->
<meta charset="UTF-8">
<title>Google Map</title>
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#location-map { height: 300px; }
@ucheng
ucheng / clearfix.css
Created October 24, 2014 06:18
clearfix
.clearfix:before,
.clearfix:after {
content: " ";
display: table;
}
.clearfix:after {
clear: both;
}