Skip to content

Instantly share code, notes, and snippets.

@winwu
winwu / nginx-laravel-with-apache-default
Last active January 24, 2021 17:09
laravel nginx config file with apache
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /var/www/YOUR_PROJECT/public;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name YOUR_IP_OR_DOMAIN;
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
'ftp-deploy': {
build: {
auth: {
host: 'XXX.com',
port: 21,
authKey: 'key1',
{
"landmark":[
{
"name":"熱門景點",
"ids":[
4,
11
]
}
],
@winwu
winwu / trip
Last active August 29, 2015 14:05
{
"banner":{
"back":[
{
"uid":"WyCE4MnL7sFqs9Vufh1jz9xDpfHD7Mag",
"src":"http://localhost:8080/banner/WyCE/4MnL/7sFq/s9Vu/586692876d5bd2b447731bae4394f57a",
"alt":"所以新圖都沒問提??"
}
]
},
@winwu
winwu / rootviewcontroller_sample.m
Created May 13, 2014 16:14
如何用程式顯示 ios facebook status, name profile picture
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
self.title = NSLocalizedString(@"Menu", nil);
self.menus = @[@"My Account", @"Menu 2", @"Menu 3", @"Menu 4"];
[self.view addSubview: self.nameLabel];
// Gulpfile.js
// Require the needed packages
var gulp = require('gulp');
var stylus = require('gulp-stylus');
var watch = require('gulp-watch');
// Get and render all .styl files recursively
gulp.task('stylus', function () {
gulp.src('app/views/assets/resources/stylus/**/*.styl')
.pipe(watch(function(files){
var fs = require("fs");
var file = "./test.db";
//載入 sqlite3
var sqlite3 = require("sqlite3").verbose();
//new 一個 sqlite 的 database,檔案是 test.db
var db = new sqlite3.Database(file);
db.serialize(function() {
//db.run 如果 Staff 資料表不存在,那就建立 Staff 資料表
@winwu
winwu / sass_demo_gruntfile.js
Last active December 26, 2015 12:19
有使用到 sass 基本的 gruntfile.js
module.exports = function(grunt){
grunt.initConfig({
pkg : grunt.file.readJSON('package.json'),
sass:{
dist: {
options:{
style: 'expanded'
},
files:{
'style.css': 'style.sass',
@winwu
winwu / sass_demo_package.json
Last active December 26, 2015 12:19
示範:當專案有使用 sass 時的基本 package.json
{
"name": "sass_test",
"version": "0.1.0",
"author": {
"name": "WinWu",
"url": "http://yiyingloveart.blogspot.tw/"
},
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-sass": "~0.5.0"
@winwu
winwu / img_onerror_detect_enhance.js
Created October 15, 2013 12:25
403 圖片偵測加強版(ajax偵測)
function detect_if_image_loaded(){
$('img').bind('error', function (e) {
var e = e.type;
switch(e){
case 'error':
$(this).attr('src','/images/no_img.png');
break;
}
});
}