Skip to content

Instantly share code, notes, and snippets.

View niczak's full-sized avatar

Nicholas Kreidberg niczak

  • Exacta Systems
  • Minneapolis, MN
  • LinkedIn in/niczak
View GitHub Profile
@niczak
niczak / ExplorerHotKey.ahk
Created September 17, 2019 16:05
Very handy if you want to use a different file manager and have used Win+E for over a decade to launch Explorer.
*#e::
Run C:\Program Files (x86)\XYplorer\XYplorer.exe
return
@niczak
niczak / 020_add_android_permissions.js
Created June 28, 2017 15:25 — forked from tomysmile/020_add_android_permissions.js
Add permissions to AndroidManifest.xml with cordova hook for Ionic 2
/*
This script uses as a cordova hook and provides ability to add android permissions to AndroidManifest.xml on the fly. It also
checks and computes which of provided permissions are already added and didn't rewrite AndroidManifest.xml if no permissions provided.
Executes only for android platform.
Prerequirements:
- node 4.2+
- npm modules: lodash, xml2js
Distributed under the MIT license.
@echo off
DOSKEY clear=cls
DOSKEY ls=dir
navigator.geolocation.getAccurateCurrentPosition = function (geolocationSuccess, geolocationError, geoprogress, options) {
var lastCheckedPosition,
locationEventCount = 0,
watchID,
timerID;
options = options || {};
var checkLocation = function (position) {
lastCheckedPosition = position;
@niczak
niczak / template.html
Last active October 20, 2016 15:44
Barebones Bootstrap
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Meta yo -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>My Boostrap Page</title>
@niczak
niczak / sortObject.js
Created March 7, 2016 00:20
Sort JS Object Alphabettically
// for OCD people or if an API requires this, in my case it was both
function sortObject(o) {
var sorted = {},
key, a = [];
for (key in o) {
if (o.hasOwnProperty(key)) {
a.push(key);
}
function formatBytes($size, $precision = 2)
{
$base = log($size, 1024);
$suffixes = array('', 'k', 'M', 'G', 'T');
return round(pow(1024, $base - floor($base)), $precision) . $suffixes[floor($base)];
}
<DirectoryMatch ^.*/wp-admin/>
AuthType Basic
AuthName "Restricted Area"
AuthUserFile /etc/httpd/.wppass
Require valid-user
</DirectoryMatch>
@niczak
niczak / gist:9677281
Created March 21, 2014 00:49
Fix Airplay Audio
sudo kill `ps -ax | grep 'coreaudiod' | grep 'sbin' |awk '{print $1}'`
function getRow(id) {
var dfd = Q.defer();
var query = db.query('SELECT * FROM table WHERE lookUp = ?', id, function(err, result) {
if(err) { dfd.reject(err); }
else { dfd.resolve(result); }
});
return dfd.promise;
}