Skip to content

Instantly share code, notes, and snippets.

@weiting-tw
weiting-tw / changelog.hbs
Last active July 14, 2021 14:07
auto-changelog template
# Changelog
{{#each releases}}
{{#if href}}
## [{{title}}]({{href}}){{#if tag}} - {{isoDate}}{{/if}}
{{else}}
## {{title}}{{#if tag}} - {{isoDate}}{{/if}}
{{/if}}
{{#if summary}}
@weiting-tw
weiting-tw / gist:3a29b1c7435d7f0462a3fd8812b1ab27
Created October 16, 2018 06:23
為 macOS 建立可開機安裝 USB 隨身碟

USB 隨身碟的容量必須要有 8 GB (含)以上

首先要有安裝包,例如: Install macOS Mojave.app (預設從 AppStore 下載會放在 /Applications 目錄下)

在安裝包所在路徑執行以下指令以建立可開機安裝 USB 隨身碟 (假設 USB 隨身碟掛載路徑在/Volumes/USB )

$ sudo ./Install\ macOS\ Mojave.app/Contents/Resources/createinstallmedia --volume /Volumes/USB --downloadassets
@weiting-tw
weiting-tw / promise-test.js
Created August 1, 2018 08:45 — forked from haroldtreen/promise-test.js
Testing promise rejection with Mocha
const { assert } = require('chai');
function isError(e) {
if (typeof e === 'string') {
return Promise.reject(new Error(e));
}
return Promise.resolve(e);
}
@weiting-tw
weiting-tw / change_author.sh
Last active September 10, 2018 06:05
Changing author info
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="[email protected]"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="[email protected]"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
public Stream ExportSheet(DocumentSearchCriteria criteria)
{
var sheets = SpreadsheetServiceFactory.CreateInstance();
var sheetList = new Dictionary<string, IList<IDictionary<string, object>>>();
IElapsedTimePagedList<Document> docList = Query(criteria);
docList.ToList<Document>().ForEach(x =>
{
var docAttrs = new ConcurrentDictionary<string, object>();
foreach (DocumentAttribute attr in x.Attributes)
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq.Expressions;
using GSS.Core.Domain;
using NHibernate;
using Spring.Stereotype;
using X.PagedList;
namespace GSS.Data.NHibernate
@weiting-tw
weiting-tw / Git_mergetool_commands
Last active January 11, 2018 03:29 — forked from RohanBhanderi/Git_mergetool_commands
Git Mergetool and difftool with Beyond Compare 4
//Git Mergetool and difftool with Beyond Compare 4
//For Windows
//IF running this command in git bash then escape $ with \
git config --global diff.tool bc4
git config --global difftool.bc4.cmd /usr/local/bin/bcomp \"\$LOCAL\" \"\$REMOTE\"
git config --global difftool.prompt false
git config --global merge.tool bc4
git config --global mergetool.bc4.cmd /usr/local/bin/bcomp \"\$LOCAL\" \"\$REMOTE\" \"\$BASE\" \"\$MERGED\"
git config --global mergetool.bc4.trustExitCode true