Skip to content

Instantly share code, notes, and snippets.

View chrisnharvey's full-sized avatar

Chris Harvey chrisnharvey

View GitHub Profile
@chrisnharvey
chrisnharvey / removePlaceholders.js
Created August 19, 2013 13:59
Remove HTML5 placeholders on focus
$(function() {
// Remove placeholders on focus
$("input, textarea").focus(function() {
var placeholder = $(this).attr('placeholder');
if (placeholder !== '') {
$(this).attr('placeholder', '');
$(this).attr('data-placeholder', placeholder);
} else {
$(this).attr('placeholder', placeholder);
@chrisnharvey
chrisnharvey / laravel-nginx.nginxconf
Last active December 25, 2015 17:19
nginx configuration for Laravel
location / {
root /path/to/laravel/public;
index index.php;
if (!-e $request_filename)
{
rewrite ^/(.*)$ /index.php?/$1 last;
break;
}
@chrisnharvey
chrisnharvey / install-cli.tools.sh
Created November 15, 2013 12:48
A simple tool to install AWS CLI tools on OS X
# Things will be here... Trust me!
@chrisnharvey
chrisnharvey / gist:7717051
Created November 30, 2013 09:35
wxphp XRC demo
<?php
class myApp extends wxApp
{
function pushBut()
{
exit('sdfsdf');
}
function OnInit()
{
@chrisnharvey
chrisnharvey / install_composer
Created January 22, 2014 13:04
Global composer installer
#!/usr/bin/env bash
curl -sS https://getcomposer.org/installer | php -- --install-dir=/tmp
/tmp/composer.phar global require composer/composer
echo '# Composer' >> ~/bash_profile
echo 'export PATH=~/.composer/vendor/bin:$PATH' >> ~/.bash_profile
rm /tmp/composer.phar
echo 'Composer installed globally.'
echo "You can now install global packages by running 'composer global require vendor/package'"
@chrisnharvey
chrisnharvey / solr
Created May 4, 2014 12:55
Solr init.d script
#!/bin/sh
# Starts, stops, and restarts Apache Solr.
#
# chkconfig: 35 92 08
# description: Starts and stops Apache Solr
SOLR_DIR="/var/solr"
JAVA_OPTIONS="-Xmx1024m -DSTOP.PORT=8079 -DSTOP.KEY=mustard -jar start.jar"
LOG_FILE="/var/log/solr.log"
@chrisnharvey
chrisnharvey / deploy.sh
Created July 8, 2014 19:49
Sculpin deploy script
#!/bin/bash
if [ "${VARIABLE}" = "1" ]; then
echo "This is a pull request, nothing to deploy"
exit
fi
echo skulpin-test.chrisnharvey.com > ./output_prod/CNAME
cd ./output_prod
@chrisnharvey
chrisnharvey / chroot.sh
Created October 7, 2015 23:08
Arch Linux Install Script
#!/bin/bash
locale-gen
ln -s /usr/share/zoneinfo/Europe/London /etc/localtime
pacman -S --noconfirm grub-bios
grub-install /dev/sda
@chrisnharvey
chrisnharvey / webtorrent-test.js
Created February 25, 2016 21:03
Webtorrent test
var WebTorrent = require('webtorrent')
var fs = require('fs')
var client = new WebTorrent()
var magnetURI = 'test.torrent'
client.download(magnetURI, function (torrent) {
// Got torrent metadata!
console.log('Torrent magnet link:', torrent.magnetURI)
#!/bin/bash
LOGFILE="/var/log/clamav/clamav-$(date +'%Y-%m-%d').log";
EMAIL_MSG="Please see the log file attached.";
EMAIL_FROM="server1@xxx.com";
EMAIL_TO="servers@xxx.co.uk";
DIRTOSCAN="/srv";
for S in ${DIRTOSCAN}; do
DIRSIZE=$(du -sh "$S" 2>/dev/null | cut -f1);