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 / 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.
- 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 Oct 20, 2016
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 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)) {
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 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;
niczak / numToStr.php
Created Jan 8, 2014
Convert numbers to words.
View numToStr.php
function numToStr($val) {
$aLookup = array(
0 => "zero",
1 => "one",
2 => "two",
3 => "three",
4 => "four",
5 => "five",
You can’t perform that action at this time.