Skip to content

Instantly share code, notes, and snippets.

View abovedave's full-sized avatar

David Longworth abovedave

View GitHub Profile
@abovedave
abovedave / gist:7034147
Last active December 25, 2015 20:19
nginx server configuration for Symphony CMS
server {
server_name www.example.com;
rewrite ^ $scheme://example.com$uri permanent;
}
server {
listen 80;
server_name example.com;
root /srv/www/example.com/public_html/;
@abovedave
abovedave / gist:7043573
Created October 18, 2013 15:51
mysqldump all databases on a given host as separate .zip files
#!/usr/bin/env bash
destination="/path/to/save/sql"
mysql_host="localhost"
mysql_user="readaccount"
mysql_pass="password"
databases=`mysql -h$mysql_host --user=$mysql_user -p$mysql_pass -e "SHOW DATABASES;" | grep -Ev "(Database|information_schema)"`
for db in $databases;
@abovedave
abovedave / gist:7397621
Created November 10, 2013 12:24
Rsync to copy from one host to local
rsync -r ssh remoteuser@remotehost:/copy/from /copy/to/
@abovedave
abovedave / s3backup.sh
Created November 11, 2013 17:16
Backup to an S3 bucket. Requires Python and s3cmd (https://github.com/s3tools/s3cmd) Optimised for Media temple but could be tweaked for any set-up
#!/usr/bin/env bash
# Media Temple account number
account="XXXXXX"
# A list of website directories to back up
websites="example.com"
homedir="/home/$account/users/.home"
@abovedave
abovedave / gist:62e96e03512775fd0458
Created August 4, 2014 16:50
Count up from a given number (jquery(
function numberWithCommas(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
$('.count ul li strong').each(function(){
var start = parseInt($(this).text(), 10);
var _self = $(this);
setInterval(function(){
var update = start++;
// ------------------------
// Syntax 'input:class:target' for toggling classes
// E.g., data-class="body:show-nav:header nav"
$('[data-class]').each(function(){
var self = $(this),
input = self.data('class').split(':'),
root = $(input[0]),
theclass = input[1],
target = $(input[2]),
@abovedave
abovedave / gist:ea846f79a2b139676bc9
Created August 21, 2014 09:23
Retina images replacement
if(window.devicePixelRatio >= 1.2){
var images = document.getElementsByTagName('img');
for(var i=0;i < images.length;i++){
var attr_2x = images[i].getAttribute('data-2x');
if(attr_2x){
images[i].src = attr_2x;
}
}
$lang['fr'] = [
"checkoutTitle" => "Purchase from La Pèira",
"subTotal" => "Subtotal",
"tax" => "Tax",
"total" => "Total",
"fullName" => "Full name",
"addressLineOne" => "Address line one",
"addressLineTwo" => "Address line two",
"cityOrTown" => "City/Town",
"postCode" => "Post code",
@abovedave
abovedave / jira.css
Last active March 9, 2016 15:09
Makes Jira look nicer
body {
font-size: 105%;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
body.ghx-scroll-columns {
overflow: auto !important;
}
#header {
position: fixed;
z-index: 100;

Keybase proof

I hereby claim:

  • I am abovedave on github.
  • I am djl (https://keybase.io/djl) on keybase.
  • I have a public key whose fingerprint is 41C3 3F81 6988 1E75 EF14 B6EA D13A 8253 2635 C319

To claim this, I am signing this object: