Skip to content

Instantly share code, notes, and snippets.

@sclarson
sclarson / gist:9375931
Created March 5, 2014 20:29
All user activity YouTrack
created by: scl2 or commented: scl2 or updated by: scl2 or Assignee: scl2 or reported by: scl2
@sclarson
sclarson / output
Created March 7, 2014 21:29
Converting timezones to stupid abbreviations
US/Alaska, DOUBLECHECKPLZ
US/Aleutian, DOUBLECHECKPLZ
US/Arizona, DOUBLECHECKPLZ
US/Central, DOUBLECHECKPLZ
US/Eastern, DOUBLECHECKPLZ
US/Hawaii, DOUBLECHECKPLZ
US/Michigan, DOUBLECHECKPLZ
US/Mountain, DOUBLECHECKPLZ
US/Pacific, DOUBLECHECKPLZ
US/Samoa, DOUBLECHECKPLZ

Keybase proof

I hereby claim:

  • I am sclarson on github.
  • I am sclarson (https://keybase.io/sclarson) on keybase.
  • I have a public key whose fingerprint is 484B BD70 B867 5566 1432 D767 34C6 8AFA 2F03 7396

To claim this, I am signing this object:

@sclarson
sclarson / findDifferences.js
Created May 12, 2014 16:29
Modified deep compare of JS objects... definitely not as nice as the way clojurescript handle mutation...
function findDifferences(objectA, objectB, onlyOwnProperties) {
var propertyChanges = [];
var objectGraphPath = ["this"];
(function(a, b) {
if (a.constructor == Array) {
// BIG assumptions here: That both arrays are same length, that
// the members of those arrays are _essentially_ the same, and
// that those array members are in the same order...
for (var i = 0; i < a.length; i++) {
objectGraphPath.push("[" + i.toString() + "]");
@sclarson
sclarson / notSRP.js
Created June 10, 2014 15:54
Sometimes JS is beautiful, sometimes it is this.
function determineDateInYesMoveAndUpperCaseFirstWord(yesMove) {
var retVal = yesMove;
if (yesMove.charAt(0) != null
&& !isNaN(parseInt(yesMove.charAt(0),10))) {
var parsedTime;
if (yesMove.indexOf('/') > 0) {
if (yesMove.split('/').length < 3) { // split is one higher than the count of things split on
parsedTime = new moment(yesMove, 'MM/DD');
} else {
@sclarson
sclarson / sensitiveCd.ps1
Created September 21, 2014 13:18
Case sensitive cd/set-location in powershell 3
function GetCaseSensitivePath{
param($pathName)
$pathExists = Test-Path($pathName)
if (-Not $pathExists){
return $pathName
}
$directoryInfo = New-Object IO.DirectoryInfo($pathName)
if ($directoryInfo.Parent -ne $null){
function gco($branch){
git checkout $branch
}
app.service('ShortageItems', [
'$resource', function($resource) {
var host = document.location.hostname == "localhost" ? "/ShortageLines" : "/ShortageReport/ShortageLines";
return $resource(host + '/:action/:id', null, {
'save': { method: 'POST', params: { action: 'Save' } },
'update': { method: 'POST', params: { action: 'Update' } },
'get': { method: 'GET', params: { action: 'details' } },
'query': {
method: 'GET',
accountsservice install
acl install
acpi-support install
acpid install
adduser install
aisleriot install
alsa-base install
alsa-utils install
anacron install
apg install
@sclarson
sclarson / output
Created June 3, 2015 19:56
Unserialize link
phinas@trogdor$ php unserialize-link-maybe.php 20
Attach 8 MB shared memory segment
Memory after my_array creation: 524288 -> 25427968 (+24903680 +23.75 MB, initial +24903680 +23.75 MB)
Memory used by serialized my_array 1st element: 335 B, used by serialized my_array: 3.26 MB, 10000 elements
Memory after unset#001: 26214400 -> 26738688 ( +524288 +512 kB, initial +524288 +512 kB)
Memory after unset#003: 26738688 -> 27000832 ( +262144 +256 kB, initial +786432 +768 kB)
Memory after unset#004: 27000832 -> 26738688 ( -262144 -256 kB, initial +524288 +512 kB)
Memory after unset#005: 26738688 -> 27000832 ( +262144 +256 kB, initial +786432 +768 kB)
Memory after unset#006: 27000832 -> 27787264 ( +786432 +768 kB, initial +1572864 +1.5 MB)
Memory after unset#007: 27787264 -> 28573696 ( +786432 +768 kB, initial +2359296 +2.25 MB)