Skip to content

Instantly share code, notes, and snippets.

View ediblecode's full-sized avatar

Ian Routledge ediblecode

View GitHub Profile
@markembling
markembling / hosts.ps1
Created August 24, 2009 13:38
Powershell script for adding/removing/viewing entries to the hosts file.
#
# Powershell script for adding/removing/showing entries to the hosts file.
#
# Known limitations:
# - does not handle entries with comments afterwards ("<ip> <host> # comment")
#
$file = "C:\Windows\System32\drivers\etc\hosts"
function add-host([string]$filename, [string]$ip, [string]$hostname) {
@benfoster
benfoster / gist:3274578
Created August 6, 2012 13:51
Enforcing lower case routes in ASP.NET Web Api
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional },
constraints: new { url = new LowercaseRouteConstraint() }
);
@jonathantneal
jonathantneal / README.md
Created September 19, 2012 06:34
Polyfill the EventListener interface in IE8

EventListener Polyfill

Is IE8 your new IE6? Level the playing field with polyfills.

This script polyfills addEventListener, removeEventListener, and dispatchEvent. It is less than half a kilobyte minified and gzipped.

addEventListener

addEventListener registers a single event listener on a single target.

@stevenkuhn
stevenkuhn / gist:5062660
Last active March 7, 2023 16:03
This PowerShell script generates release notes for Octopus Deploy that contain the GitHub commits and JIRA issues from the current build to the latest production release. It will also create the Octopus release based on the TeamCity build number.
#
# Assumptions
#
# 1. If you have a Octopus release deployed, say 1.0.0.73, there is a git
# tag set for that commit in GitHub that is "v1.0.0.73".
#
# 2. You have TeamCity label each successful build in GitHub with the format
# "v{build number}. Sidenote: it appears that TeamCity only labels the
# default branch, but not feature branches.
#
@lavoiesl
lavoiesl / object.create.js
Created September 20, 2013 18:49
Javascript Object.create() polyfill
// http://jsperf.com/new-vs-object-create-including-polyfill
if (typeof Object.create !== 'function') {
Object.create = function(o, props) {
function F() {}
F.prototype = o;
if (typeof(props) === "object") {
for (prop in props) {
if (props.hasOwnProperty((prop))) {
F[prop] = props[prop];
@onestepcreative
onestepcreative / check_media_query.js
Last active March 27, 2020 07:41
Fast way to check media queries in javascript (based on Foundation 5 sizing)
// Each statement returns true or false based on current viewport
// The EM units are based on html, body { font-size: 100%; } CSS
window.MQ = {
// max-width 640px mobile-only styles
small : (matchMedia('only screen and (max-width: 40em)').matches),
// min-width 641px and max-width 1024px screen only
medium : (matchMedia('only screen and (min-width:40.063em) and (max-width:64em)').matches),
@marcusgadbem
marcusgadbem / index.js
Last active November 25, 2021 22:20
Middleware to minify HTML output for express template render engines in which supports callbacks
/* app/controllers/index.js */
module.exports.index = function(req, res) {
res.render('index.html');
};
@KittyGiraudel
KittyGiraudel / SassMeister-input.scss
Last active November 22, 2016 11:19
Generated by SassMeister.com.
// ----
// Sass (v3.4.9)
// Compass (v1.0.1)
// ----
@function is-number($value) {
@return type-of($value) == 'number';
}
@function is-time($value) {
@cvrebert
cvrebert / css_regression_testing.md
Last active May 28, 2024 17:42
Survey of screenshot-based CSS testing tools

Currently considering https://github.com/webdriverio/webdrivercss


Core Goals:

  • Can test in up-to-date versions of all major browsers
  • Can test on up-to-date versions of all major OSes
  • Can test in IE9 (because Bootstrap v4 will support IE9+)
  • Don't want to have to setup/maintain our own cluster of VMs running all the necessary OSes (and all the versions of Windows)
  • Workflow for management of reference/baseline/norm screenshots
@tjchaplin
tjchaplin / gist:621edccbfddc0d3526b5
Created January 23, 2015 11:00
Update Teamcity Build Number based on package.json - (Powershell <= 2)
# These are project build parameters in TeamCity
# Depending on the branch, we will use different major/minor versions
[System.Reflection.Assembly]::LoadWithPartialName("System.Web.Extensions")
$ser = New-Object System.Web.Script.Serialization.JavaScriptSerializer
$json = Get-Content "package.json" | Out-String
$obj = $ser.DeserializeObject($json)
$majorVerion = ($obj['version'] -split "\.")[0]
$minorVerion = ($obj['version'] -split "\.")[1]
$buildCounter = "%teamcity.build.counter%"
$buildNumber = "$majorVerion.$minorVerion.$buildCounter"