View helpers.php
<?php
function uniqueMd5()
{
$length = 62;
$pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$crypto_rand_secure = function ($min, $max) {
$range = $max - $min;
if ($range < 0) {
View README.md

List of countries by continents

Support ISO 3166-1 (alpha-2, alpha-3, numeric).

View slim.php
<?php
$capsule = new \Illuminate\Database\Capsule\Manager;
$capsule->addConnection($container['settings']['db']);
$capsule->setAsGlobal();
$capsule->bootEloquent();
$container['db'] = function ($container) {
return $capsule;
};
View timezones.php
<?php
return [
'Africa' => [
'Africa/Abidjan' => 'Abidjan',
'Africa/Accra' => 'Accra',
'Africa/Addis_Ababa' => 'Addis Ababa',
'Africa/Algiers' => 'Algiers',
'Africa/Asmara' => 'Asmara',
'Africa/Bamako' => 'Bamako',
View dd.js
// Via browser console
// https://laracasts.com/discuss/channels/general-discussion/expanding-dd-vardumper-by-default
var compacted = document.querySelectorAll('.sf-dump-compact');
for (var i = 0; i < compacted.length; i++) {
compacted[i].className = 'sf-dump-expanded';
}
View gulpfile.js
gulp.task('html-clean', function() {
return gulp.src('./resources/views/**/*.php')
.pipe($.rimraf());
});
gulp.task('html', ['html-clean'], function () {
return gulp.src('./_development/html/views/**/*.php') // Your blade template
.pipe($.htmlmin({
collapseWhitespace: true,
minifyJS: true,
View app.js
/*
* /dashboard/ == /dashboard
* /user/kristories/ == /user/kristories
*/
app.use(function(req, res, next) {
(req.url.substr(-1) == '/' && req.url.length > 1)
? res.redirect(301, req.url.slice(0, -1))
: next();
});
View development-machine.sh
#!/bin/sh
# Laptop (https://github.com/thoughtbot/laptop)
echo 'Installing Laptop...'
curl --remote-name https://raw.githubusercontent.com/thoughtbot/laptop/master/mac
sh mac 2>&1 | tee ~/laptop.log
# Homebrew-Cask (https://github.com/caskroom/homebrew-cask)
echo 'Installing Homebrew-Cask...'
brew install caskroom/cask/brew-cask
View .htaccess
#INDONESIA, SINGAPORE
<Limit GET POST>
order deny,allow
allow from 5.10.73.192/29
allow from 14.102.152.0/22
allow from 27.50.16.0/20
allow from 27.111.32.0/20
allow from 27.111.48.0/20
allow from 27.112.64.0/21
allow from 27.112.76.0/22
View gist:35181f0054b6f452e758

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter