Skip to content

Instantly share code, notes, and snippets.

Nicholas Kreidberg niczak

Block or report user

Report or block niczak

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
@niczak
niczak / ExplorerHotKey.ahk
Created Sep 17, 2019
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
*#e::
Run C:\Program Files (x86)\XYplorer\XYplorer.exe
return
@niczak
niczak / 020_add_android_permissions.js
Created Jun 28, 2017 — 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.
Prerequirements:
- 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,
watchID,
timerID;
options = options || {};
var checkLocation = function (position) {
lastCheckedPosition = position;
@niczak
niczak / template.html
Last active Oct 20, 2016
Barebones Bootstrap
View template.html
<!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 Mar 7, 2016
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)) {
a.push(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
</DirectoryMatch>
@niczak
niczak / gist:9677281
Created Mar 21, 2014
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;
}
You can’t perform that action at this time.