Skip to content

Instantly share code, notes, and snippets.

View niczak's full-sized avatar

Nicholas Kreidberg niczak

View GitHub Profile
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.
View ExplorerHotKey.ahk
Run C:\Program Files (x86)\XYplorer\XYplorer.exe
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
View 020_add_android_permissions.js
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.
- node 4.2+
- npm modules: lodash, xml2js
Distributed under the MIT license.
View DOSKEY.cmd
@echo off
DOSKEY clear=cls
DOSKEY ls=dir
View getAccurateCurrentPosition.js
navigator.geolocation.getAccurateCurrentPosition = function (geolocationSuccess, geolocationError, geoprogress, options) {
var lastCheckedPosition,
locationEventCount = 0,
options = options || {};
var checkLocation = function (position) {
lastCheckedPosition = position;
niczak / template.html
Last active October 20, 2016 15:44
Barebones Bootstrap
View template.html
<!DOCTYPE html>
<html lang="en">
<!-- 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 / sortObject.js
Created March 7, 2016 00:20
Sort JS Object Alphabettically
View sortObject.js
// 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)) {
View formatBytes.php
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)];
View gist:7043db98da78bc29023b
<DirectoryMatch ^.*/wp-admin/>
AuthType Basic
AuthName "Restricted Area"
AuthUserFile /etc/httpd/.wppass
Require valid-user
niczak / gist:9677281
Created March 21, 2014 00:49
Fix Airplay Audio
View gist:9677281
sudo kill `ps -ax | grep 'coreaudiod' | grep 'sbin' |awk '{print $1}'`
View promiseTest.js
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;