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

View fonts.json
[
{
"Extension":".abf",
"File Description":"Adobe Binary Screen Font File"
},
{
"Extension":".acfm",
"File Description":"Adobe Composite Font Metrics File"
},
{
View jquery.addrule.js
/*!
* jquery.addrule.js 0.0.1 - https://gist.github.com/yckart/5563717/
* Add css-rules to an existing stylesheet.
*
* @see http://stackoverflow.com/a/16507264/1250044
*
* Copyright (c) 2013 Yannick Albert (http://yckart.com)
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php).
* 2013/05/12
**/