Skip to content

Instantly share code, notes, and snippets.

View poychang's full-sized avatar
🏠
Stay Home & Be Health

Poy Chang poychang

🏠
Stay Home & Be Health
View GitHub Profile
@poychang
poychang / angularjs-providers-explained.md
Created March 9, 2016 00:16 — forked from demisx/angularjs-providers-explained.md
AngularJS Providers: Constant/Value/Service/Factory/Decorator/Provider
Provider Singleton Instantiable Configurable
Constant Yes No No
Value Yes No No
Service Yes No No
Factory Yes Yes No
Decorator Yes No? No
Provider Yes Yes Yes

Constant

@poychang
poychang / angularPlugin.js
Created April 5, 2016 05:34 — forked from loicknuchel/angularPlugin.js
Angular MediaSrv : play audio with Cordova & Ionic apps
angular.module('my.cordova.plugins', ['ionic'])
// for media plugin : http://plugins.cordova.io/#/package/org.apache.cordova.media
.factory('MediaSrv', function($q, $ionicPlatform, $window){
var service = {
loadMedia: loadMedia,
getStatusMessage: getStatusMessage,
getErrorMessage: getErrorMessage
};
@poychang
poychang / addAndroidResource.js
Last active June 11, 2016 14:34
Create Android resource for app name
#!/usr/bin/env node
/* jshint esversion: 6 */
// ref: https://developer.android.com/training/basics/supporting-devices/languages.html
// Save hook under `project-root/hooks/after_compile/`
//
// Don't forget to install xml2js using npm
// `$ npm install xml2js`
@poychang
poychang / 010_increment_build_number.js
Created June 22, 2016 07:55
Increment build number for Cordova project
#!/usr/bin/env node
"use strict";
// Save hook under `project-root/hooks/before_compile/`
//
// Don't forget to install xml2js using npm
// `$ npm install xml2js`
// Modules
@poychang
poychang / 010_jshint.js
Last active July 1, 2016 07:58
Cordova hook with JSHint
#!/usr/bin/env node
var fs = require('fs');
var path = require('path');
var jshint = require('jshint').JSHINT;
var async = require('async');
var recursiveFolderSearch = true;
var foldersToProcess = [
'js'
@poychang
poychang / instcat.sql
Created July 19, 2016 03:18
解決從 64 位元 SQL Server 用戶端對連結 32 位元 SQL Server 伺服器執行分散式查詢時,可能會收到錯誤訊息
This file has been truncated, but you can view the full file.
/*
** INSTCAT.SQL
** Installs catalog stored procedures on the Microsoft SQL Server.
** Copyright Microsoft, Inc. 1994 - 2000
** All Rights Reserved.
**
** Owners:
**
** <owner current="true" primary="true">iliak</owner>
*/
@poychang
poychang / rename.bat
Created July 19, 2016 09:48
投影片另存成圖檔時,想將檔名變更為 001~999,可透過此批次檔做變更
@echo off
setlocal EnableDelayedExpansion
set/p key=確定要執行此更名工具?(y/n):
if /i "%key%"=="n" goto END
set i=0
rem 依序重新命名
for %%a in (投影片?.jpg) do (
set /a i+=1
@poychang
poychang / .gitignore
Last active September 19, 2016 06:59
This gitignore file is for a general web project
# -----------------------------------------------------------------
# Specifies intentionally untracked files to ignore when using Git
# http://git-scm.com/docs/gitignore
#
# This file is tailored for a general web project
#
# From the root of your project run
# curl -O https://gist.githubusercontent.com/poychang/128d62787f1bf5a60fcdafcb5d223b70/raw/.gitignore
# to download this file
#
@poychang
poychang / ClassModelGenerator.cs
Last active May 16, 2018 01:01
使用 LINQPad 快速產生對應 SQL 查詢結果的類別 #dotnet #linqpad
void Main()
{
// 資料表名稱
var nameOfTableAndClass = "TableName";
// 這邊修改為您要執行的 SQL Command
var sqlCommand = $@"SELECT * FROM {nameOfTableAndClass}";
// 在 DumpClass 方法裡放 SQL Command 和 Class 名稱
this.Connection.DumpClass(sqlCommand.ToString(), nameOfTableAndClass).Dump();
}
@poychang
poychang / uglify.js
Last active December 6, 2016 08:18
使用 cordova-uglify 時出現路徑問題,需增加 process.cwd() 取得執行路徑,才能正常運作
#!/usr/bin/env node
/*jshint latedef:nofunc, node:true*/
// Modules
var fs = require('fs');
var path = require('path');
var cwd = process.cwd();
var dependencyPath = path.join(cwd, 'node_modules', 'cordova-uglify', 'node_modules');
// cordova-uglify module dependencies