Skip to content

Instantly share code, notes, and snippets.

View Zodiase's full-sized avatar

Xingchen Hong Zodiase

View GitHub Profile
@Zodiase
Zodiase / document.wflow
Created August 8, 2016 11:06
Zip Each - Automator Workflow
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AMApplicationBuild</key>
<string>419</string>
<key>AMApplicationVersion</key>
<string>2.6</string>
<key>AMDocumentVersion</key>
<string>2</string>
// Omit the last argument (the callback) of the original function and use promise instead.
function wrapAsPromise (func) {
var expectedArgCount = func.length - 1;
return function () {
// Only the last argument (the callback) can be missing.
switch (true) {
case arguments.length < expectedArgCount:
throw new Error('Not enough arguments given. Expecting ' + expectedArgCount + '.');
break;
case arguments.length < expectedArgCount:
/**
* @param {function} func - The function to call. The payload of the promise.
* @param {Array.<*>} args - The list of arguments for `func`.
* @param {*} ctx - The context for `func`.
*/
function makePromise(func, args, ctx) {
return new Promise(function (resolve, reject) {
try {
func.apply(ctx, Array.prototype.concat.call(args, function (err, result) {
if (err) { reject(err); } else { resolve(result); }
@Zodiase
Zodiase / .gitignore
Last active November 9, 2016 18:48
Selenium-Webdriver Example
node_modules
@Zodiase
Zodiase / style.css
Last active December 5, 2016 16:21
Github code printing CSS
@media print {
/* Hide everything other than code. */
body.page-blob .header[role=banner],
body.page-blob [role=main] .pagehead.repohead,
body.page-blob [role=main] .repository-content > :not(.file),
body.page-blob [role=main] .repository-content > .file > .file-header > .file-actions,
body.page-blob .site-footer-container {
display: none;
}
@Zodiase
Zodiase / any.js
Last active January 6, 2017 19:54
Blaze Useful Template Helpers
import { Template } from 'meteor/templating';
/**
* Returns true when any of the provided arguments is true.
* Example:
* > {{#if some varA varB varC}}
* > At least something is true.
* > {{/if}}
*/
Template.registerHelper('some', (...args) => args.some(Boolean));
@Zodiase
Zodiase / heroku-meteor-deploy-setup.sh
Last active July 20, 2018 09:36
Setup deploying Meteor app in existing Git repo to Heroku
#!/bin/bash
# Login to heroku CLI.
heroku login
# Create a new app project on heroku.
heroku create <appName> --stack cedar --region us --buildpack https://github.com/AdmitHub/meteor-buildpack-horse.git
# Add heroku remote to the git config file.
heroku git:remote -a meteor-mdc-demo
@Zodiase
Zodiase / helpers.js
Last active February 10, 2017 23:06
Functional JavaScript with Ramda
/**
* Runs a sub composition that is invisible to its parent composition.
* @param {...Function} funcs
* @return {a -> Promise(a)}
*/
const spyPipeP = (...funcs) => (val) => R.partialRight(R.pipeP, [() => val])(...funcs)(val);
/**
* Runs a sub composition that is invisible to its parent composition.
* @param {...Function} funcs
@Zodiase
Zodiase / notes.md
Last active May 19, 2017 23:12
Zelda: Breath of the Wild Notes

Repairing cost of the legendary weapons:

Gerudo Town (Buliara)

Scimitar of the Seven: diamond Daybreaker(shield): diamond

Goron City (Rohan)

Boulder Breaker: Cobble Breaker + diamond + Flint * 5

@Zodiase
Zodiase / notes.md
Last active May 25, 2017 11:00
Fire Emblem Echoes: Shadows of Valentina Notes

Forging

Here are the requirements for forging new weapons.

Left side is the minimum (tested) forging levels and money required. Right side is the outcome (with level 0, of course).

(no options) means after forging to the max level, the item disappears from the list, meaning it's impossible to further forge it.

(no options as of lv.4) means so far I've tested forging this weapon to level 4 and haven't seen any options appearing for new weapons. Note that it is possible for options to appear when the weapon reaches maximum level.