Skip to content

Instantly share code, notes, and snippets.

View elct9620's full-sized avatar
💦
Level up!!!

蒼時弦也 elct9620

💦
Level up!!!
View GitHub Profile
@elct9620
elct9620 / gist:1345250
Created November 7, 2011 15:14
C++ sort array
void descArray(int *arr, int size){
int temp;
int loopRun = floor(size/2);
for(int i = 0; i < loopRun; i++){
temp = arr[size - i];
arr[size - i] = arr[i];
arr[i] = temp;
}
}
@elct9620
elct9620 / gist:1524052
Created December 27, 2011 15:39
PHP Switch 新用法
<?php
$array = array('type', 'apple');
switch(true){
case in_array('apple', $array):
echo 'Have Apple';
case in_array('mango', $array):
echo 'Have Mongo';
default:
}
@elct9620
elct9620 / gist:1534097
Created December 29, 2011 13:23
Flash AIR for iOS Tap Test
import flash.ui.Multitouch;
import flash.ui.MultitouchInputMode;
import flash.events.TouchEvent;
Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT; //設定觸控模式
Object(root).movie.stop(); //停止 movie 影片片段播放
Object(root).movie.addEventListener(TouchEvent.TOUCH_TAP, myPlay); //新增觸控事件偵測(點擊 Tap)
var playMode:Boolean = false; //播放模式,預設 stop ( FALSE 為 stop )
@elct9620
elct9620 / composer.json
Created January 21, 2013 04:20
Composer create a slim framework project, and integrate LazyRecord.
{
"name": "slim/slim-skeleton",
"description": "A Slim Framework skeleton application for rapid development",
"keywords": ["microframework","rest","router"],
"homepage": "http://github.com/codeguy/Slim-Skeleton",
"license": "MIT",
"authors": [
{
"name": "Josh Lockhart",
"email": "[email protected]",
@elct9620
elct9620 / aotoki.zsh-theme
Last active December 17, 2015 13:39
My oh-my-zsh theme
# ---------------------------------------------------------------
# Aotoki Theme for oh-my-zsh theme by Aotoki ([email protected])
# Home Page : http://frost.tw/
# --------------------------------------------------------------
# LS Color
LSCOLORS=xxbxcxxxxxdxBxxxxxCxExBhCh
#Color Shortcuts
R=$fg[red]
@elct9620
elct9620 / shortcode.php
Created June 20, 2013 06:56
WordPress Plugin Example
<?php
namespace Aotoki;
class YoutubeShortcode {
static private $_instance;
private function __construct()
{
<?php
class Nyan_Template
{
public $mode = null;
public function __construct($mode)
{
$this->mode = $mode;
}
@elct9620
elct9620 / Vagrantfile
Created January 29, 2014 12:49
Vagrant install Go via Shell
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
@elct9620
elct9620 / ruby_block.rb
Created February 28, 2014 03:08
A simple ruby block usage.
###
# Ruby Block
###
@buffer = ""
def test(description, &block)
if block_given?
puts "##{description}"
yield
@elct9620
elct9620 / example.rb
Created April 2, 2014 13:18
has many through with join table attributes when create or query
user = User.create()
user.logs << Log.new
user.send_logs << Log.new # join table "action" column will assign "send" as default
user.receive_logs << Log.new # join table "action" column will assign "receive" as default