Skip to content

Instantly share code, notes, and snippets.

View dbilovd's full-sized avatar
💭
#StartingOver

David Lartey dbilovd

💭
#StartingOver
View GitHub Profile
var PackageLoader = function() {
this.cb = Math.random(0, 100000000000);
this.current = 0;
this.batches = [];
// Load kicks off the entire loading process.
this.load = function(config, loadMap, onload) {
var scope = this;
for(label in loadMap) {
scope.batches.push(new PackageBatch(label, loadMap[label]));
@dbilovd
dbilovd / Random bytes, ints, UUIDs in PHP.md
Created April 13, 2016 13:05 — forked from tom--/Random bytes, ints, UUIDs in PHP.md
PHP random bytes, integers and UUIDs

Random bytes, ints, UUIDs in PHP

Simple and safe random getters to copy-paste

string randomBytes( int $length )

int randomInt ( int $min , int $max )

string randomUuid ( void )
@dbilovd
dbilovd / UUID.php
Created April 13, 2016 13:05 — forked from dahnielson/UUID.php
Pure PHP UUID generator
<?php
/**
* UUID class
*
* The following class generates VALID RFC 4122 COMPLIANT
* Universally Unique IDentifiers (UUID) version 3, 4 and 5.
*
* UUIDs generated validates using OSSP UUID Tool, and output
* for named-based UUIDs are exactly the same. This is a pure
* PHP implementation.
@dbilovd
dbilovd / 0_reuse_code.js
Created June 8, 2016 12:31
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@dbilovd
dbilovd / iterm2-solarized.md
Created July 27, 2016 21:02 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + oh my zsh + solarized + Meslo powerline font (OS X / macOS)

Solarized

@dbilovd
dbilovd / updateObjectWithObject.js
Created August 6, 2016 10:21
Update object properties with values from another object.
var objA = {
"a" : 1,
"b" : 2
},
objB = {
"a" : 3,
"c" : 4
};
var updateObj = function (a, b) {
@dbilovd
dbilovd / ide-plugins.md
Last active February 1, 2019 20:52
IDE Plugins
@dbilovd
dbilovd / startOfWeek.js
Last active March 17, 2017 13:03
Get date of start of week
function startOfWeek (weekStart) {
var today = new Date();
var todayInWeek = today.getDay();
var todayDate = today.getDate();
var startOfWeekDate = (weekStart == "m") ?
todayDate - (todayInWeek - 1) : todayDate - todayInWeek;
var startOfWeek = new Date();
@dbilovd
dbilovd / post-commit.sample
Last active March 24, 2017 09:09
Git Hooks
#!/bin/sh
#
#
#
# To enable this hook, rename this file to "post-commit".
echo "Running Post-Commit hook: Push immediately to master after commits"
# Get current branch
branch=$(git rev-parse --abbrev-ref HEAD)
@dbilovd
dbilovd / countries.json
Created April 3, 2017 13:56 — forked from keeguon/countries.json
A list of countries in JSON
[
{name: 'Afghanistan', code: 'AF'},
{name: 'Åland Islands', code: 'AX'},
{name: 'Albania', code: 'AL'},
{name: 'Algeria', code: 'DZ'},
{name: 'American Samoa', code: 'AS'},
{name: 'AndorrA', code: 'AD'},
{name: 'Angola', code: 'AO'},
{name: 'Anguilla', code: 'AI'},
{name: 'Antarctica', code: 'AQ'},