Skip to content

Instantly share code, notes, and snippets.

View paulredmond's full-sized avatar
🏴‍☠️

Paul Redmond paulredmond

🏴‍☠️
View GitHub Profile
@paulredmond
paulredmond / php-lint.sh
Created March 15, 2017 06:12
Lint all php files in a given path
#!/usr/bin/env bash
find . -type f -name '*.php' -exec php -l {} \;
@paulredmond
paulredmond / publish.sh
Last active February 15, 2017 04:16
A bash script to publish my Atom text editor plugins. See a working version here https://github.com/paulredmond/atom-larasnippets/blob/master/publish
#!/usr/bin/env bash
TYPE=${1:-minor}
npm run docs
# Commit documenation changes if they exist
# @see http://stackoverflow.com/a/5143914/599230
if ! git diff-index --quiet HEAD --; then
echo "The documentation has changes..."
@paulredmond
paulredmond / docs.js
Last active May 21, 2017 23:04
Generate Atom snippet documentation from a package's CSON files
/**
* Convert cson snippets into a Markdown document for reference
*/
const cson = require('cson');
const glob = require ('glob');
const path = require('path');
const fs = require('fs');
const _ = require('lodash');
function Snippet(title, code, prefix, fileName, lang) {

System

uname -a     # Display Linux System Information
uname -r     # Display kernel release information
uptime       # Show how long the system has been running + load
hostname     # Show system host name
hostname -i  # Display the IP address of the host
last reboot  # Show system reboot history
date # Show the current date and time
@paulredmond
paulredmond / routes.php
Created February 20, 2016 15:51
Development Route for Debugging PHP Info in Lumen
<?php
if (
env('APP_DEBUG') === true
&& !preg_match('/(prd|production|prod)/', env('APP_ENV'))
) {
$app->get('_/phpinfo', function () {
ob_start();
phpinfo();
$response = ob_get_contents();
@paulredmond
paulredmond / integrate.sh
Created December 18, 2015 20:45
Rebuild an integration branch from master and reapply branches previously merged into integration but that have not been merged to master
#!/usr/bin/env bash
# Update the origin remote and prune it
updateOrigin()
{
git fetch origin
git remote prune origin
}
# List branches that are merged into integration, but not master
@paulredmond
paulredmond / remove-containers-before.sh
Created September 12, 2015 05:45
Remove all Docker containers with --before flag
docker rm $(docker ps -a --before 97b0b463468f | awk '{if (NR!=1) {print $1}}')
@paulredmond
paulredmond / git-hg-rosetta-stone.md
Last active August 29, 2015 14:06
Git / Mercurial Rosetta Stone

Note: this is from the sympy/sympy wiki

The sympy git server is at https://github.com/sympy/sympy . The main Sympy repository may be cloned with "git clone git://github.com/sympy/sympy.git".

The first and the most important thing is that you should understand that git is '''different'''. For example it uses staging area (so called index) for iteratively preparing commits. This and other great and unique features of git make it the preference of many developers, so go read its documentation - you would not regret!

@paulredmond
paulredmond / comment.rb
Created January 9, 2014 16:22
Need help figuring out submitting a form for polymorphic models from associated controller
# models/comment.rb
class Comment < ActiveRecord::Base
belongs_to :commentable, polymorphic: true
validates :name, presence: true
end
@paulredmond
paulredmond / functions.php
Created October 6, 2013 05:14
Custom author rewrite urls for WordPress
<?php
// Custom author URI structure even if the site
// is configured to use a custom structure, ie: /my-prefix/%postname%/
add_filter('init', function () {
global $wp_rewrite;
$wp_rewrite->author_structure = '/' . $wp_rewrite->author_base. '/%author%';
// Only uncomment the flush_rules() method call if things are not working.
// After the rules are flushed (refresh page), this can be commented out again.