Skip to content

Instantly share code, notes, and snippets.

View cbiggins's full-sized avatar

Christian Biggins cbiggins

View GitHub Profile
@jenter
jenter / Headless Lightning + BLT + DrupalVM
Last active November 20, 2018 05:15
Quick steps to create a new headless lightning project using BLT and DrupalVM
# {{PROJECTNAME}} is name of project with standard machine naming conventions (ie. no spaces or uppercase)
> composer create-project --no-interaction acquia/blt-project {{PROJECTNAME}}
> cd {{PROJECTNAME}}
> composer run-script blt-alias
> source ~/.bash_profile
> composer require acquia/headless_lightning:~1.1.0
# Edit blt/project.yml and change the project:profile:name key to 'headless_lightning'
> blt vm
# You may need to update the 'php_version' to match your local environment in box/config.yml
> blt setup
var webviewProvider = (function() {
if (/\/FBIOS/i.test(navigator.userAgent) === true) {
return 'facebook';
}
if (/Twitter for/i.test(navigator.userAgent) === true) {
return 'twitter';
}
if (/Pinterest\//.test(navigator.userAgent) === true) {
return 'pinterest';
}
@paulferrett
paulferrett / abn_validator.php
Created December 27, 2013 01:45
Here is a PHP validation class to validate Australian Business Numbers (ABN) and Australian Company Numbers (ACN)
<?php
/**
* ABN and ACN Validator Class
* @author Paul Ferrett, 2009 (http://www.paulferrett.com)
*/
class AbnValidator {
/**
* Return true if $number is a valid ABN
@jaygooby
jaygooby / percona-xtrabackup.sh
Last active May 9, 2022 15:43
Call via crontab on whatever schedule suits you; keep n full mysql Percona xtrabackups of your mysql database, with binary logs applied. Also does a full mysqldump that can then have the binary logs applied to restore to a point-in-time backup via the binlogs. Copy all of this (backup, mysqldump, binlogs) to S3.
#!/bin/bash
#
# Carries out a full mysqldump, calls percona-xtrabackup and then
# copies the sql dump, the percona backup and your mysql bin logs
# to S3 using s3cmd http://s3tools.org/s3cmd
#
# TODO: extract out the S3 backup stuff to make it optional, and so
# other s3 programs can replace the s3cmd call.
# TODO: the if [ $? == 0 ] alert blocks should be a function
# TODO: make the if [ $? == 0 ] if [ $? != 0 ] more consistent - test
@jmather
jmather / deploy.rb
Created September 13, 2012 16:25
Spiffy capistrano config for composer based projects
after "deploy", "deploy:cleanup"
after "deploy:update_code", "composer:install"
before "composer:install", "composer:copy_vendors"
after "composer:install", "phpunit:run_tests"
namespace :composer do
desc "Copy vendors from previous release"
task :copy_vendors, :except => { :no_release => true } do
run "if [ -d #{previous_release}/vendor ]; then cp -a #{previous_release}/vendor #{latest_release}/vendor; fi"
end
@benhosmer
benhosmer / udp-port-scanning.txt
Created April 20, 2012 15:31
UDP Port Troubleshooting using netcat
Using the nc command you can scan a port or a range of ports to verify whether a UDP port is open and able to receive traffic.
This first command will scan all of the UDP ports from 1 to 65535 and add the results to a text file:
$ nc -vnzu server.ip.address.here 1-65535 > udp-scan-results.txt
This merely tells you that the UDP ports are open and receive traffic.
Perhaps a more revealing test would be to actually transfer a file using UDP.
@bru
bru / texmate_dot_filter
Created June 12, 2010 09:14
TextMate dotfiles filter
# TextMate dotfiles filter
# use this filter in Preferences -> Advanced -> Folder References -> File Pattern
# to show .gitignore, .gems (useful for Heroku), .bundle in your project
!(/\.(?!(htaccess|gitignore|gems|bundle))[^/]*|\.(tmproj|o|pyc)|/Icon\r|/svn-commit(\.[2-9])?\.tmp)$
@mrrooijen
mrrooijen / Capistrano-Deployment-Recipe.rb
Created July 29, 2009 09:34
a "base" Capistrano Rails Deployment Recipe. Use it to deploy your Rails application. It is also easily expandable. So feel free to grab this Recipe and add your own tasks/customization!
# Guide
# Configure the essential configurations below and do the following:
#
# Repository Creation:
# cap deploy:repository:create
# git add .
# git commit -am "initial commit"
# git push origin master
#
# Initial Deployment: