Skip to content

Instantly share code, notes, and snippets.

View mattcan's full-sized avatar

Matthew Cantelon mattcan

View GitHub Profile
@wbtuomela
wbtuomela / go1.3.1-install-deb.sh
Last active August 29, 2015 14:05 — forked from demofly/go1.3-install-deb.sh
Debian Packages for golang-1.3.1
apt-get install devscripts build-essential
apt-get build-dep golang-go
wget http://ftp.us.debian.org/debian/pool/main/g/golang/golang_1.3.1-1.dsc
wget http://ftp.us.debian.org/debian/pool/main/g/golang/golang_1.3.1.orig.tar.gz
wget http://ftp.us.debian.org/debian/pool/main/g/golang/golang_1.3.1-1.debian.tar.xz
dpkg-source -x golang_1.3.1-1.dsc
cd golang-1.3.1/
debuild -us -uc
@emmgfx
emmgfx / gist:4540222
Created January 15, 2013 17:16
IE=edge
<!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
#/bin/bash
STALE_SINCE=${STALE_SINCE:-"3 months"}
git for-each-ref --sort=-committerdate refs/remotes/origin --format='%(refname:short) %(committerdate:relative)' | \
while read REF RELDATE
do
if [ -z "$(git log -1 --since="${STALE_SINCE}" -s ${REF})" ]; then
echo $(echo ${REF} | grep --color=tty "${REF}"): ${RELDATE}
fi
// Include this after .AddMvc under ConfigureServices in Startup.cs
services.Configure<RazorViewEngineOptions>(options =>
{
options.ViewLocationExpanders.Add(new FeatureLocationExpander());
});
@Albert-IV
Albert-IV / .gitconfig
Created April 2, 2015 18:46
Add `revert-file` to your git config, reverting all changes done in a commit to a specific file.
[alias]
revert-file = !sh /home/some-user/git-file-revert.sh
@bitsandbooks
bitsandbooks / add-nginx-vhost.sh
Last active June 22, 2017 01:45
My custom script for adding a vhost to Nginx.
#!/usr/bin/env bash
#
# Nginx - new server block
# http://rosehosting.com
# Functions
ok() { echo -e '\e[32m'$1'\e[m'; } # Green
working() { echo -ne '\e[1;33m'$1'\e[m'; } # Yellow
die() { echo -e '\e[1;31m'$1'\e[m'; exit 1; }
@xiongjia
xiongjia / my_vim_plugin.py
Last active September 14, 2017 07:43
A simple Vim plugin with python #devsample #vim
#!/usr/bin/env python
import sys, os
# The test function for VIM plugin
def my_test(vim, vim_ver):
buf = vim.current.buffer
# append process id & python version info to the buffer
buf.append("VIM process %d; vim version: %s\n" % (os.getpid(), vim_ver))
buf.append("Py version: %s\n" % sys.version_info)
@Latz
Latz / testlisttable.php
Created March 21, 2012 14:27
Sample plugin for usage of WP_List_Table class (basic version)
<?php
/*
Plugin Name: Test List Table Example
*/
if( ! class_exists( 'WP_List_Table' ) ) {
require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
}
class My_Example_List_Table extends WP_List_Table {
@smoothdeveloper
smoothdeveloper / gist:6898062
Created October 9, 2013 08:29
dynamic transact-sql contingency table implementing http://stackoverflow.com/a/10404455 in a generic manner
create procedure dbo.dynamic_simple_contingency_table_query
@withExpression nvarchar(max) -- ^ optional with CTE expression
, @selectStatement nvarchar(max) -- ^ select statement, should return at least three columns, whose name matches following parameters
, @row_column_key nvarchar(max) -- ^ column name which identifies row keys (result will have as many distinct rows as found here)
, @column_column_key nvarchar(max) -- ^ column name which identifies column keys (result will have as many distinct values as found here)
, @fact_column_key nvarchar(max) -- ^ column name which contains facts
as
begin
declare @sql nvarchar(max)
set @sql = @withExpression
/* The Grid ---------------------- */
.lt-ie9 .row { width: 940px; max-width: 100%; min-width: 768px; margin: 0 auto; }
.lt-ie9 .row .row { width: auto; max-width: none; min-width: 0; margin: 0 -15px; }
.lt-ie9 .row.large-collapse .column,
.lt-ie9 .row.large-collapse .columns { padding: 0; }
.lt-ie9 .row .row { width: auto; max-width: none; min-width: 0; margin: 0 -15px; }
.lt-ie9 .row .row.large-collapse { margin: 0; }
.lt-ie9 .column, .lt-ie9 .columns { float: left; min-height: 1px; padding: 0 15px; position: relative; }
.lt-ie9 .column.large-centered, .columns.large-centered { float: none; margin: 0 auto; }