Skip to content

Instantly share code, notes, and snippets.

View mikedfunk's full-sized avatar

Mike Funk mikedfunk

View GitHub Profile
// ==UserScript==
// @name Userscript Name
// @namespace http://example.com/
// @description Userscript Description
// @match http://example.com/* (or @include * to include all pages)
// @version 1.0
// ==/UserScript==
// Inject JavaScript onto the page
function exec(fn) {
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
@mikedfunk
mikedfunk / gist:ed9c3a0622b6b13b2952
Created January 23, 2015 19:28
homebrew php 5.6 warnings
To enable PHP in Apache add the following to httpd.conf and restart Apache:
LoadModule php5_module /usr/local/opt/php56/libexec/apache2/libphp5.so
The php.ini file can be found in:
/usr/local/etc/php/5.6/php.ini
✩✩✩✩ PEAR ✩✩✩✩
If PEAR complains about permissions, 'fix' the default PEAR permissions and config:
chmod -R ug+w /usr/local/Cellar/php56/5.6.4/lib/php
@mikedfunk
mikedfunk / gist:9c8a16b6f11c8948be12
Created January 26, 2015 23:15
homebrew golang caveats
As of go 1.2, a valid GOPATH is required to use the `go get` command:
http://golang.org/doc/code.html#GOPATH
`go vet` and `go doc` are now part of the go.tools sub repo:
http://golang.org/doc/go1.2#go_tools_godoc
To get `go vet` and `go doc` run:
go get golang.org/x/tools/cmd/vet
go get golang.org/x/tools/cmd/godoc
<?php
$myvar = 1;
function myfunction()
{
// importing of globals is always by reference
global $myvar;
$myvar = 2;
}
@mikedfunk
mikedfunk / gist:667087d8e1cb5aaf21d7
Created February 11, 2015 19:15
check the request details in ASP.NET
// in an .aspx file...
<%= Request.ServerVariables["SCRIPT_NAME"] %>
// in the code behind file...
Response.Write(Request.ServerVariables["SCRIPT_NAME"]);
Response.end();
@mikedfunk
mikedfunk / gist:07fd8f0b150b1e5bc3a1
Created February 25, 2015 21:54
sql server 2005/2008 offset
-- MSSQL Server 2005/2008 offset example
DECLARE @RowsPerPage INT = 10, @PageNumber INT = 6
SELECT SalesOrderDetailID, SalesOrderID, ProductID
FROM (
SELECT SalesOrderDetailID, SalesOrderID, ProductID,
ROW_NUMBER() OVER (ORDER BY SalesOrderDetailID) AS RowNum
FROM Sales.SalesOrderDetail
) AS SOD
WHERE SOD.RowNum BETWEEN ((@PageNumber-1)*@RowsPerPage)+1
AND @RowsPerPage*(@PageNumber)
@mikedfunk
mikedfunk / gist:b3fae6d93248b4351954
Created February 26, 2015 07:00
C# log to file
// debug
System.IO.File.WriteAllText("/Users/Mike/code/trails-website/debuglog.txt", "hello world");
@mikedfunk
mikedfunk / gist:58b44181b10bca3a66d1
Last active August 29, 2015 14:16
Visual Studio Keyboard Shortcuts
shortcut action
c-k c-c comment (there is no toggle comment!!)
c-k c-c uncomment
c-. resolve current class
f7 switch to code behind
s-f7 switch to design view for this code behind (then click source to view source)
c-s-w view current page in browser
c-space trigger intellisense when it's closed
s-a-3, c-- navigate back
@mikedfunk
mikedfunk / gist:806ceabfd33d2873d412
Created March 19, 2015 21:38
msql pretty select
SELECT * FROM table_with_tons_of_columns\G
# will show column -> value in list format instead of messed up table format!