Skip to content

Instantly share code, notes, and snippets.

View matt-hensley's full-sized avatar

Matt Hensley matt-hensley

View GitHub Profile
@matt-hensley
matt-hensley / web.config
Created February 8, 2014 22:44
kirby rewrite rules
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpErrors errorMode="Detailed" />
<asp scriptErrorSentToBrowser="true" />
<rewrite>
<rules>
<rule name="Block text files" stopProcessing="true">
@matt-hensley
matt-hensley / Rollbar.targets
Last active November 2, 2017 03:47
MSBuild target to notify Rollbar of a publish. Requires RollbarSharp web.config entries and git on user's path.
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="NotifyRollbarOfDeploy" AfterTargets="MSDeployPublish;CopyAllFilesToSingleFolderForPackage">
<XmlPeek XmlInputPath="$(_PackageTempDir)\web.config"
Query="//appSettings/add[@key='Rollbar.AccessToken']/@value">
<Output TaskParameter="Result" ItemName="RollbarAccessToken" />
</XmlPeek>
<XmlPeek XmlInputPath="$(_PackageTempDir)\web.config"
Query="//appSettings/add[@key='Rollbar.Environment']/@value">
<Output TaskParameter="Result" ItemName="RollbarEnvironment" />
@matt-hensley
matt-hensley / gist:d86c279aa66a5aa5ee30
Last active January 11, 2016 15:25
Ansible sshd/ufw
---
- hosts: all
tasks:
- ufw: rule=allow port={{ item.port }} proto={{ item.proto }}
with_items:
- { port: 22, proto: tcp }
- { port: 80, proto: tcp }
- { port: 8080, proto: tcp }
- { port: 1953, proto: tcp }
- ufw: policy=deny state=enabled
@matt-hensley
matt-hensley / nginx init.d
Last active January 11, 2016 15:26 — forked from vdel26/nginx
#!/bin/sh
#
# chkconfig: 2345 55 25
# Description: Nginx init.d script, put in /etc/init.d, chmod +x /etc/init.d/nginx
# For Debian, run: update-rc.d -f nginx defaults
# For CentOS, run: chkconfig --add nginx
#
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
@matt-hensley
matt-hensley / index.js
Created July 3, 2016 16:53
requirebin sketch
// Welcome! require() some modules from npm (like you were using browserify)
// and then hit Run Code to run your code on the right side.
// Modules get downloaded from browserify-cdn and bundled in your browser.
const sheetRouter = require('sheet-router')
const yo = require('yo-yo')
// default to `/404` if no path matches
const router = sheetRouter('/404', function (route) {
return [
route('/', (params) => yo`<div>Welcome to router land!</div>`),
@matt-hensley
matt-hensley / hash.ts
Created September 12, 2016 18:12
hash of promises
export function hash(o: Object): Promise<any> {
var keys = Object.keys(o);
var promises = keys.map(key => Promise.resolve(o[key]));
return Promise.all(promises).then(function (values) {
return keys.reduce(function (hash, key, i) {
hash[key] = values[i];
return hash;
}, {});
});
var SuppressWarningPlugin = function (warningName, moduleName) {
this.warningName = warningName;
this.moduleName = moduleName;
};
SuppressWarningPlugin.prototype.apply = function (compiler) {
var warningName = this.warningName;
var moduleName = this.moduleName;
compiler.plugin("emit", function (compilation, callback) {
@matt-hensley
matt-hensley / index.d.ts
Last active December 14, 2016 20:14
ko-computer-router types
interface KoComponentRouterMiddlewareContext {
element: Node;
router: any;
route: any;
path: string;
pathname: string;
params: Object;
}
interface KoComponentRouterContext extends KoComponentRouterMiddlewareContext {
function reverse_route(ctx) {
var paths = [];
var router = ctx;
var params = ctx.params || {};
paths.unshift(router.route.path);
while (!router.isRoot && router.$parent) {
router = router.$parent;
Object.assign(params, router.params);
if (router) paths.unshift(router.route.path);
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
//using Dapper.FastCrud;
//using Dapper.FastCrud.Configuration;
using Dapper.FastCrud.Configuration.StatementOptions;
//using Dapper.FastCrud.Configuration.StatementOptions.Builders;