Skip to content

Instantly share code, notes, and snippets.

View piffie's full-sized avatar

Christoph Richter piffie

View GitHub Profile
@piffie
piffie / gist:ac7b4e62bbe3f7c0db20ba1116540aee
Created November 13, 2023 16:19
Getting the git log format on windows in a CSV compliant manner - ready to import into a spreadsheet.
git log --all --pretty=format:'"%H","%an","%aD","%s"' --shortstat --no-merges |
ForEach-Object -Begin { $commitLine = $null } -Process {
if ($_ -match '^[0-9a-f"]{40}') {
if ($commitLine) { Write-Output $commitLine }
$commitLine = $_
} elseif ($_ -match '^\s+[0-9]+ files? changed') {
$commitLine += ',"' + $_.Trim() + '"'
}
} -End { Write-Output $commitLine } | Set-Content -Path app.mc2.fi-frontend.csv
@piffie
piffie / gist:d6cf057978a63efa6916
Last active August 29, 2015 14:14
Update google OAuth token
var http = require('http');
var https = require('https');
var uri = require('url');
module['exports'] = function updateToken (hook) {
if(hook.params.pwd !== hook.env.pwd) {
return hook.res.end('invalid pwd');
}
//hook.debug("getting url");
@piffie
piffie / gist:6d55a2810adc2a495a21
Last active August 29, 2015 14:14
Google Analytics Realtime API retrieval
var http = require('http');
var https = require('https');
var uri = require('url');
module['exports'] = function garealtime (hook) {
var auth = hook.params.authorization
run = function() {
var url = "https://www.googleapis.com/analytics/v3/data/realtime?ids="+hook.params.ga+"&metrics=rt%3AactiveUsers&key=" + hook.params.key
options = uri.parse(url)
@piffie
piffie / Meteor iOS private browsing fix
Created December 13, 2013 13:33
The Meteor LocalStorage implementation is not working on all iOS devices with private Browsing turned on. This is default in iOS 7. The reason is, that window.localStorage exists, but writing to window.localStorage.setItem throws an exception. This gist overrides the meteor implementation if this is the case.
@fix =
hasLocalStorage: ->
try
mod = new Date
localStorage.setItem mod, mod.toString()
result = localStorage.getItem(mod) == mod.toString()
localStorage.removeItem mod
return true
if $.browser.msie?