Skip to content

Instantly share code, notes, and snippets.

View ElijahLynn's full-sized avatar
😎
All Your DevOps Belong To Us

Elijah Lynn ElijahLynn

😎
All Your DevOps Belong To Us
View GitHub Profile
@ElijahLynn
ElijahLynn / pagination.md
Created February 2, 2016 12:18 — forked from mislav/pagination.md
"Pagination 101" by Faruk Ateş

Pagination 101

Article by Faruk Ateş, [originally on KuraFire.net][original] which is currently down

One of the most commonly overlooked and under-refined elements of a website is its pagination controls. In many cases, these are treated as an afterthought. I rarely come across a website that has decent pagination, and it always makes me wonder why so few manage to get it right. After all, I'd say that pagination is pretty easy to get right. Alas, that doesn't seem the case, so after encouragement from Chris Messina on Flickr I decided to write my Pagination 101, hopefully it'll give you some clues as to what makes good pagination.

Before going into analyzing good and bad pagination, I want to explain just what I consider to be pagination: Pagination is any kind of control system that lets the user browse through pages of search results, archives, or any other kind of continued content. Search results are the o

@ElijahLynn
ElijahLynn / purge-ban-domain-varnish.md
Created January 21, 2016 19:50 — forked from aderowbotham/purge-ban-domain-varnish.md
Purge (ban) an entire domain in Varnish Cache 3

How to purge ('ban') an entire domain in Varnish Cache 3

#####EDIT: NB Ban is technically different from Purge. Banned objects remain in memory but banning is faster than purging. Read the Varnish 3 documentation here and here.

Purge may be a more appropriate action for your use-case; although the examples in the gist below work, it's not necessarily the best way of doing this.


@ElijahLynn
ElijahLynn / pdfcrop.sh
Created January 13, 2016 00:03
Replacement of the Perl pdfcrop, this one is in Bash.
#!/bin/bash
# http://tex.stackexchange.com/questions/42236/pdfcrop-generates-larger-file/42259#42259
function usage () {
echo "Usage: `basename $0` [Options] <input.pdf> [<output.pdf>]"
echo
echo " * Removes white margins from every page in the file. (Default operation)"
echo " * Trims page edges by given amounts. (Alternative operation)"
echo
function throttle( fn, time ) {
var t = 0;
return function() {
var args = arguments, ctx = this;
clearTimeout(t);
t = setTimeout( function() {
fn.apply( ctx, args );
}, time );
};
@ElijahLynn
ElijahLynn / new_gist_file_0
Created November 25, 2013 21:20
Run Drupal Simpletests from Drush and avoid permission errors by running as www-data (the server) and also preserve environment variables (-E). Preserving environment variables is really only needed when you enable xdebug on the command line.
sudo -E -u www-data drush @pub7.local test-run ActionsConfigurationTestCase --uri=loc.example.com
@ElijahLynn
ElijahLynn / springer-free-maths-books.md
Created December 29, 2015 03:23 — forked from bishboria/springer-free-maths-books.md
Springer have made a bunch of maths books available for free, here are the direct links
@ElijahLynn
ElijahLynn / SassMeister-input-HTML.html
Created November 14, 2013 22:03 — forked from Snugug/SassMeister-input-HTML.html
Generated by SassMeister.com.
<div class="crosshair"></div>
@ElijahLynn
ElijahLynn / new_gist_file
Created September 19, 2013 15:46
Pub7 Tag Instructions
open new hotfix branch off of tag
merge branch into master
tag the branch SPECIAL
* cd into root of clone
* ./builds/scripts/pub-tag.sh 7.23.1 (example, don't use v prefix, script does it for us)
* ./builds/scripts/pub-tag2.sh
* git checkout master --force
* ./builds/scripts/pub-tag3.sh
NOTE: If pub-tag2.sh and pub-tag3.sh don't work or you get confused that is okay. pub-tag.sh is the one that really does the tag but contact Sam Boyer and let him know about it. If all you can ever do is the first script, that is fine.
@ElijahLynn
ElijahLynn / battery
Created September 11, 2013 16:46
Battery info Manually forked from https://github.com/richoH/dotfiles/blob/master/bin/battery Place in your ~/bin folder and now the command 'battery' will show you your battery percentage in Ubuntu. I have this set to always display in my Tmux pane with set -g status-right "#(~/bin/battery) | #[fg=cyan]%d %b %R" Modified so when charging it will…
#!/bin/sh
HEART_FULL=♥
HEART_EMPTY=♡
[ -z "$NUM_HEARTS" ] &&
NUM_HEARTS=5
cutinate()
{
perc=$1
tions[] = l(t('Delete'), 'node/' . $node->nid . '/revisions/' . $vid . '/delete');
}
foreach ($state_events as $event_machine_name => $event) {
if (state_flow_access($state_node, $event_machine_name)) {
$state_actions[] = l($event->get_option('label'), 'node/' . $node->nid . '/revisions/' . $vid . '/workflow/' . $event_machine_name) . ' ';
}
}
$state_actions_str = implode(' | ', $state_actions);
$item = array(
l($vid, $path_view),