Skip to content

Instantly share code, notes, and snippets.

View lukaswhite's full-sized avatar

Lukas White lukaswhite

View GitHub Profile
@lukaswhite
lukaswhite / FoundationPresenter.php
Created December 13, 2013 09:52
Foundation-friendly pagination for Laravel 4
<?php namespace Lukaswhite\Pagination;
use Illuminate\Pagination\Paginator;
class FoundationPresenter {
/**
* The paginator instance being rendered.
*
* @var \Illuminate\Pagination\Paginator
@lukaswhite
lukaswhite / Tipsum.php
Created January 23, 2014 20:07
T'Ipsum - a Yorkshire Lorum Ipsum alternative, inspired by http://tlipsum.appspot.com/ by @tonyblundell
/**
* T'ipsum, a dead simple class for generating Yorkshire t'ipsum.
*
* Based on http://tlipsum.appspot.com/ by @tonyblundell.
*/
class Tipsum {
/**
* The actual text
*/
@lukaswhite
lukaswhite / ClearBeanstalkdQueueCommand.php
Last active March 20, 2023 08:11
Clear a Beanstalkd Queue in Laravel
<?php
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class ClearBeanstalkdQueueCommand extends Command {
/**
@lukaswhite
lukaswhite / create-project.sh
Created March 2, 2014 18:33
A Bash Script for New projects
# CONFIGURATION
#MYSQL credentials
MYSQL_USER="root"
MYSQL_PASS=""
# The user Apache runs as - e.g. _www, www-data
APACHE_RUNAS="_www"
#Bitbucket credentials
@lukaswhite
lukaswhite / elasticsearch-on-homestead.txt
Created August 3, 2014 08:58
Installing Elasticsearch on Laravel Homestead
# Install Java
sudo apt-get install openjdk-7-jre-headless -y
# Download & install the Public Signing Key
wget -qO - http://packages.elasticsearch.org/GPG-KEY-elasticsearch | sudo apt-key add -
# Add the following to /etc/apt/sources.list
deb http://packages.elasticsearch.org/elasticsearch/1.3/debian stable main
# Update Aptitude
@lukaswhite
lukaswhite / gist:467a91d62b5d66d82341
Created October 3, 2014 13:14
Getting a list of routes from an Express 4 application
var _ = require('lodash')
var routes = _.map(_.filter(app._router.stack, function(item){
return (item.route != undefined)
}), function(route){
return {
path: route.route.path,
method: Object.keys(route.route.methods)[0]
}
})
### Keybase proof
I hereby claim:
* I am lukaswhite on github.
* I am lukaswhite (https://keybase.io/lukaswhite) on keybase.
* I have a public key whose fingerprint is 71E9 57B9 7336 A635 0B44 E769 5136 FCD6 881C 9CDA
To claim this, I am signing this object:
@lukaswhite
lukaswhite / ordinalized_date.rb
Created November 19, 2014 16:33
Ordinalized Dates in Jekyll
require 'date'
module Jekyll
module OrdinalizedDate
def ordinalized_date(input)
d = input.strftime("%e")
input.strftime("%A ") + self.ordinalize(d.to_i) + input.strftime(" %B, %Y")
end
def ordinalize(number)
if (11..13).include?(number % 100)
@lukaswhite
lukaswhite / flush.php
Created February 17, 2015 18:06
Flush Drupal 7's cache, when all you have is FTP (!) access.
<?php
error_reporting(-1);
ini_set('display_errors', 'On');
define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
drupal_flush_all_caches();
print 'All caches cleared';
@lukaswhite
lukaswhite / gist:67e625d47b0a7f662238
Created March 21, 2016 12:20
Display numeric file permissions on 'Nix systems
ls -l | awk '{k=0;for(i=0;i<=8;i++)k+=((substr($1,i+2,1)~/[rwx]/) \
*2^(8-i));if(k)printf("%0o ",k);print}'