Skip to content

Instantly share code, notes, and snippets.

Patrick Galbraith patrickgalbraith

Block or report user

Report or block patrickgalbraith

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
patrickgalbraith /
Last active Mar 7, 2019
Kentico 12 routes created by `Kentico().MapRoutes()` found by decompiling
patrickgalbraith / resize-images.bat
Last active Feb 5, 2019
Resize all images in a folder
View resize-images.bat
@echo off
set "resolution=1080"
for /f "tokens=* delims=" %%G in ('dir /A-D /B *.jpg') do (
ffmpeg -y -i "%%~G" -vf "scale='min(%resolution%,iw)':min'(%resolution%,ih)':force_original_aspect_ratio=decrease" "%%~G"
for /f "tokens=* delims=" %%G in ('dir /A-D /B *.png') do (
patrickgalbraith / package-version.bat
Created Jan 28, 2019
Extract package.json version in Windows Batch (.bat) file
View package-version.bat
@echo off
setlocal EnableDelayedExpansion
set c=0
set version=""
for /f "tokens=1,2 delims=:, " %%a in (' find ":" ^< "package.json" ') do (
if "%%~a"=="version" (
set version=%%~b
View uint-power.cs
uint UIntPow(uint x, uint pow)
if (x == 0 || x == 1)
return x;
if (pow >= 32)
throw new OverflowException("Power exceeds allowed size for UInt32");
uint ret = 1;
View gist:6a619576bfa2067334d365824878f051
// WARNING - You should always ensure that the code cannot be updated
// using an anonymous function before using this
function createCallback($paramList, $code) {
$callback = create_function($paramList, $code);
return $callback;
patrickgalbraith / AutoHeightWebView.js
Last active Sep 19, 2018
Auto Height React Native WebView with custom link handling
View AutoHeightWebView.js
Copyright 2017 Patrick Galbraith
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
View AccelerometerTest2.c
const int analogPin = A0;
const int ledPin = 14;
int analogPinVal = 0;
void setup() {
pinMode(ledPin, OUTPUT);
patrickgalbraith / gist:9538b85546b4e3841864
Created Sep 4, 2014
Javascript dynamic getter, setter using defineProperty
View gist:9538b85546b4e3841864
var User = (function () {
function User (id, nam) {
var self = this; = id;
this.nam = nam;
this.__data = {};
for(var p in self) {
You can’t perform that action at this time.