Skip to content

Instantly share code, notes, and snippets.

View rc1021's full-sized avatar
🏠
Working from home

許益銘 rc1021

🏠
Working from home
View GitHub Profile
@rc1021
rc1021 / change_field_type.php
Last active August 29, 2015 14:04
grocery crud example: how to use change_field_type function for true_false
<?php
/**
* table info:
* CREATE TABLE examples
* (
* `id` integer PRIMARY KEY,
* `enable` TINYINT(1) default 1,
* );
*
*/
<script type="text/javascript">
$(function () {
$("#user_success").on('submit', function(){
var message = "";
var emptyValue = false;
var name = $('[name="name"]', $(this)).val();
var area = $('select[name="area"] option:selected', $(this)).val();
var time = $('select[name="time"] option:selected', $(this)).val();
var email = $('[name="email"]', $(this)).val();
var phone = $('[name="phone"]', $(this)).val();
Fgplay::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
@rc1021
rc1021 / gist:3015379
Created June 29, 2012 02:49
get remote binary
require 'uri'
url = 'http://link.photo.pchome.com.tw/s08/emily13isme/30/134072486922/'
file = nil
open(URI.escape(url)) do |f|
file = File.open("tmp.png", "wb")
file.write(f.read) if file
end
@rc1021
rc1021 / gist:3016366
Created June 29, 2012 06:54
設定時間
# 記得先在 ec2 設定時間
# ls -F /usr/share/zoneinfo/
# ln -sf /usr/share/zoneinfo/Asia/Taipei /etc/localtime
# vi /etc/sysconfig/clock # 修改 clock 為台灣時間
ZONE="Asia/Taipei"
# config/application.rb
config.time_zone = 'Taipei'
config.active_record.default_timezone = :local
# See http://help.github.com/ignore-files/ for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile ~/.gitignore_global
# Ignore bundler config
/.bundle
# Ignore the default SQLite database.
@rc1021
rc1021 / gist:3736213
Created September 17, 2012 08:41
Issues with RMagick on RubyStack 3.2.1-1
// will be error.
$ sudo gem install rmagick -v '2.13.1'
// If you want to compile or install your own RMagick, you should install the following libraries in your system:
$ sudo apt-get install libbz2-dev libxt-dev libxext-dev
// Then remove the following file if exists:
$ sudo rm /opt/bitnami/common/lib/libbz2.a
// And finally you can install RMagick
@rc1021
rc1021 / User.php
Last active December 10, 2015 08:38
PHP Activerecord 多對多自我參照( has_many through[many to many] self referential ) Codeigniter How to solution
<?php
/**
* Alias 用戶關注的資料表
*/
class TargetUser extends User
{
static $table_name = "users";
}

介紹

歡迎加入Laravel大本營,本文提供入門者快速有效(沒癈話)的環境設定。

已經會裝環境的人可以跳過本文。

再強調一下,如果可以 最完整的中文說明文件還是在官網 https://laravel.tw/docs/5.2

開發環境如下:

### 城市搜尋器
link: https://github.com/rinvex/country
version: `5.1.*|5.2.*|5.3.*`