Skip to content

Instantly share code, notes, and snippets.

View mtso's full-sized avatar
shipping

Matthew mtso

shipping
View GitHub Profile
@mtso
mtso / .gitlab-ci.yml
Created November 12, 2017 22:35
GitLab CI config
stages:
- build
build_code:
stage: build
script:
- xcodebuild clean -project MesoBlog.xcodeproj -scheme MesoBlog
- xcodebuild test -project MesoBlog.xcodeproj -scheme MesoBlog -destination 'platform=iOS Simulator,name=iPhone 8'
# tags:
# - ios
function compareBy(key) {
return function(a, b) {
return a[key] === b[key]
}
}
@mtso
mtso / Sample.csproj
Created October 17, 2017 21:01
Dump environment variables after Visual Studio publish event.
<Project>
<!-- removed fields... -->
<Target
Name="DumpEnv"
AfterTargets="AfterPublish"
>
<Exec Command="set OUTPUT_PATH=$(PublishUrl) &amp;&amp; node dump-env.js AfterPublish"/>
</Target>
var util = require('util');
var Transform = require('stream').Transform;
util.inherits(RemoveBlockPlugin, Transform);
function RemoveBlockPlugin(options){
Transform.call(this, options);
}
function removeBlock(string, blockName) {
function assertExists(value, message) {
var isExists = value !== undefined && value !== null
if (!isExists) {
message = message || ('Expected value to exist')
throw new Error(message)
}
}
var util = require('util');
var Transform = require('stream').Transform;
util.inherits(RemoveBlockPlugin, Transform);
function RemoveBlockPlugin(options){
Transform.call(this, options);
}
function removeBlock(string, blockType) {
@mtso
mtso / fn.js
Created October 16, 2017 07:29
// Create a new object using values from an existing
// object accessed by given keys.
// @params keys (Array) list of property names
// @params obj (Object) object to take values from
function select(keys, old) {
return keys.reduce((obj, key) => {
obj[key] = old[key]
return obj
}, {})
}
@mtso
mtso / server.go
Created September 30, 2017 05:25
Golang worker channel to process toy data.
// Demo using a channel of workers to concurrently process an integer counter.
// Requests to the web server root adds 5 pieces of data to process.
package main
import (
"fmt"
"net/http"
"sync"
)