Skip to content

Instantly share code, notes, and snippets.

Avatar

Eric D. Rohler edrohler

View GitHub Profile
View git-fetch-upstream-tags
Let [tag] = any tag in upstream repo
git fetch upstream --tags
git push origin --tags
@edrohler
edrohler / tasks.json
Created June 8, 2015 02:40
Various tasks.json samples for Visual Studio Code
View tasks.json
// Available variables which can be used inside of strings.
// ${workspaceRoot}: the root folder of the team
// ${file}: the current opened file
// ${fileBasename}: the current opened file's basename
// ${fileDirname}: the current opened file's dirname
// ${fileExtname}: the current opened file's extension
// ${cwd}: the current working directory of the spawned process
// A task runner that calls the Typescipt compiler (tsc) and
// Compiles a HelloWorld.ts program
@edrohler
edrohler / wp-config
Created May 11, 2017 11:36
Programmatically load configuration from environment
View wp-config
<?php
/**
* The base configuration for WordPress
*
* The wp-config.php creation script uses this file during the
* installation. You don't have to use the web site, you can
* copy this file to "wp-config.php" and fill in the values.
*
* This file contains the following configurations:
*
@edrohler
edrohler / web.BADBOT.config
Last active July 17, 2019 14:18
Web config section for bad bot blocking in asp.net
View web.BADBOT.config
<system.webServer>
<staticContent>
<clientCache httpExpires="Thur, 31 Mar 2020 00:00:00 GMT" cacheControlMode="UseExpires" />
</staticContent>
<httpProtocol>
<customHeaders>
<!-- Remove Excessive Header -->
<remove name="X-Powered-By"/>
<!-- Removes Azure non-HttpOnly Cookie -->
<add name="Arr-Disable-Session-Affinity" value="True" />
@edrohler
edrohler / revArray
Created March 4, 2016 21:03
Reverse an Array
View revArray
var myArray = [1, 2, 3, 4, 5];
function revArray(arr) {
var nArrr = new Array();
for (var i = 0; i <= arr.length; i++) {
nArrr.push(arr[arr.length - i]);
console.log(nArrr[i]);
}
}
@edrohler
edrohler / perlin-noise-classical.js
Created February 10, 2016 20:22 — forked from banksean/perlin-noise-classical.js
two Perlin noise generators in javascript. The simplex version is about 10% faster (in Chrome at least, haven't tried other browsers)
View perlin-noise-classical.js
// Ported from Stefan Gustavson's java implementation
// http://staffwww.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf
// Read Stefan's excellent paper for details on how this code works.
//
// Sean McCullough banksean@gmail.com
/**
* You can pass in a random number generator object if you like.
* It is assumed to have a random() method.
*/
@edrohler
edrohler / ef7sqlalterscripts.txt
Created July 31, 2015 22:10
EF7 migration sql alter scripts
View ef7sqlalterscripts.txt
migration.Sql("ALTER TABLE dbo.Availability ADD TotalHours AS DATEDIFF(SECOND,BeginTimeUtc,EndtimeUtc)/3600");
migration.Sql("ALTER TABLE dbo.PayRate ADD EstWeeklyRateLow AS HourlyRateLow*DesiredWeeklyHours");
migration.Sql("ALTER TABLE dbo.PayRate ADD EstWeeklyRateHigh AS HourlyRateHigh*DesiredWeeklyHours");
migration.Sql("ALTER TABLE dbo.Location ADD GeoPoint AS geography::Point(Latitude,Longitude, 4326)");
migration.Sql("ALTER TABLE dbo.ZipCodeLookup ADD GeoPoint AS geography::Point(Latitude,Longitude, 4326)");
migration.Sql("ALTER TABLE dbo.Contact ADD DisplayName AS FirstName + ' ' + LastName");
migration.Sql("ALTER TABLE dbo.Contact ADD LastNameFirst AS LastName + ', ' + FirstName");
migration.Sql("ALTER TABLE dbo.Contact ADD PublicName AS FirstName + ' ' + SUBSTRING(LastName, 1, 1) + '.'");
@edrohler
edrohler / efMigration_Sample.cs
Last active August 29, 2015 14:25
Entity Framework Migrations Computed Column for DbGeography Location, Tme and Cost
View efMigration_Sample.cs
Sql("ALTER TABLE dbo.Profile ADD DisplayName AS FirstName + ' ' + LastName");
Sql("ALTER TABLE dbo.Profile ADD LastNameFirst AS LastName + ', ' + FirstName");
Sql("ALTER TABLE dbo.Profile ADD PublicName AS FirstName + ' ' + SUBSTRING(LastName, 1, 1) + '.'");
Sql("ALTER TABLE dbo.Availability ADD TotalHours AS DATEDIFF(SECOND,BeginTime,Endtime)/3600");
Sql("ALTER TABLE dbo.Rate ADD EstWeeklyRateLow AS HourlyRateLow*DesiredWeeklyHours");
Sql("ALTER TABLE dbo.Rate ADD EstWeeklyRateHigh AS HourlyRateHigh*DesiredWeeklyHours");
Sql("ALTER TABLE dbo.LocationData ADD Location AS geography::Point(Latitude,Longitude, 4326)");
Sql("ALTER TABLE dbo.RefZipCode ADD Location AS geography::Point(Latitude,Longitude, 4326)");
View git_log_to_csv
git log --date=short --after "2015-06-14" --pretty="%h;%aN;%ad;%s" > commits.csv
@edrohler
edrohler / math.uuid.js
Created March 8, 2015 08:30
RFC Compliant GUID Module
View math.uuid.js
/*!
Math.uuid.js (v1.4)
http://www.broofa.com
mailto:robert@broofa.com
Copyright (c) 2010 Robert Kieffer
Dual licensed under the MIT and GPL licenses.
*/
/*