Skip to content

Instantly share code, notes, and snippets.

View maxisam's full-sized avatar
💭
I may be slow to respond.

Sam Lin maxisam

💭
I may be slow to respond.
View GitHub Profile
@maxisam
maxisam / app.js
Created November 5, 2013 22:43 — forked from auser/app.js
angular.module('myApp',
['ngRoute', 'myApp.services', 'myApp.directives']
)
.config(function(AWSServiceProvider) {
AWSServiceProvider.setArn('arn:aws:iam::<ACCOUNT_ID>:role/google-web-role');
})
.config(function(StripeServiceProvider) {
StripeServiceProvider.setPublishableKey('pk_test_YOURKEY');
})
.config(function($routeProvider) {
@maxisam
maxisam / decorator
Last active August 29, 2015 14:21 — forked from jhunken/decorator
angular.module('lib.decorators', [])
.config(['$provide', function($provide){
$provide.decorator('$rootScope', ['$delegate', function($rootScope) {
var _proto
, _new
, nextUid = function() {
return ++$rootScope.$id;
}
, Scope = function() {
@maxisam
maxisam / bookmarks.md
Last active August 27, 2015 21:35 — forked from boneskull/bookmarks.md
How to use Mercurial bookmarks

How to Use Mercurial Bookmarks

by Christopher Hiller

Mercurial branches are not "cheap". Unlike Git, to create or destroy a branch, you actually have to commit a changeset to the repository. Branches are great for…something…but whatever that is, we're not doing it.

Enter Bookmarks.

Bookmarks work similarly to the Git notion of branches. To create a bookmark, you do not create a changeset. A bookmark is simply a reference to a changeset. It ires repository meta-data, and by default stays "local" (in your working copy).

@maxisam
maxisam / InvalidModelException.cs
Last active September 11, 2015 19:35 — forked from jimbuck/InvalidModelException.cs
C# Validation Helper
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.Serialization;
namespace JimmyBoh.Common.Exceptions
{
public class InvalidModelException : Exception
{
@maxisam
maxisam / npm-cheat-sheet.md
Created January 24, 2017 18:05 — forked from AvnerCohen/npm-cheat-sheet.md
Node.js - npm Cheat Sheet

Node.js - npm Cheat Sheet

(Full description and list of commands at - https://npmjs.org/doc/index.html)

##List of less common (however useful) NPM commands

######Prepand ./bin to your $PATH Make sure to export your local $PATH and prepand relative ./node_modules/.bin/:

@maxisam
maxisam / .gitconfig
Created December 20, 2017 23:46 — forked from danny0838/.gitconfig
實用的 Git 配置值
[core]
quotepath = false # 中文檔名如實顯示而不轉碼
autocrlf = false # commit 及 checkout 時不根據作業系統轉換檔案的換行字元 (避免不小心改動原 repo 的換行字元)
safecrlf = false # 檢查文字類檔案是否混合了 CRLF 及 LF 換行字元 (搭配 autocrlf,這裡一起關閉)
ignorecase = false # 檔名大小寫不同時視為相異 (更動大小寫才能 commit)
whitespace = cr-at-eol # diff 時行尾 CRLF 不顯示 ^M
fileMode = false # 忽略檔案的 x 屬性 (for Windows)
symlinks = false # 忽略符號連結 (for Windows)
editor = /usr/bin/vim # 預設的文字編輯器 (for Linux)
[alias]
@maxisam
maxisam / Add-AspNetCoreEnvVarElems.ps1
Created February 20, 2018 16:28 — forked from markarnott/Add-AspNetCoreEnvVarElems.ps1
A powershell script to inject environmentVariable elements into aspNetCore Element in web.config for ASP.NET Core Module
#
# == Turn This ==
# <?xml version="1.0" encoding="utf-8"?>
# <configuration>
# <system.webServer>
# <handlers>
# <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
# </handlers>
# <aspNetCore processPath=".\MyCoreGizmo.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
# </system.webServer>
/* https://github.com/eisnerd/feedback-tool + github issues
Example:
$.feedbackGithub({
token: "16222221222128357fab95ec80b56a43c9a1868b429",
issues: {
repository: "tokland/feedback-test",
title: "feedback from user",
renderBody: (body) => "my own data\n" + body,
@maxisam
maxisam / resources.md
Created April 2, 2018 20:00 — forked from paladique/resources.md
Getting started with Angular and .NET Core Web API

Reading data before application startup in Angular 2

In this demonstration I will show you how to read data in Angular2 final release before application startup. You can use it to read configuration files like you do in other languages like Java, Python, Ruby, Php.

This is how the demonstration will load data:

a) It will read an env file named 'env.json'. This file indicates what is the current working environment. Options are: 'production' and 'development';

b) It will read a config JSON file based on what is found in env file. If env is "production", the file is 'config.production.json'. If env is "development", the file is 'config.development.json'.