Skip to content

Instantly share code, notes, and snippets.

View IngmarBoddington's full-sized avatar

Ingmar Boddington IngmarBoddington

View GitHub Profile
@IngmarBoddington
IngmarBoddington / exit
Created April 17, 2015 15:10
Exit Codes
1 Catchall for general errors let "var1 = 1/0" Miscellaneous errors, such as "divide by zero" and other impermissible operations
2 Misuse of shell builtins (according to Bash documentation) empty_function() {} Missing keyword or command, or permission problem (and diff return code on a failed binary file comparison).
126 Command invoked cannot execute /dev/null Permission problem or command is not an executable
127 "command not found" illegal_command Possible problem with $PATH or a typo
128 Invalid argument to exit exit 3.14159 exit takes only integer args in the range 0 - 255 (see first footnote)
128+n Fatal error signal "n" kill -9 $PPID of script $? returns 137 (128 + 9)
130 Script terminated by Control-C Ctl-C Control-C is fatal error signal 2, (130 = 128 + 2, see above)
255* Exit status out of range exit -1 exit takes only integer args in the range 0 - 255
@IngmarBoddington
IngmarBoddington / jboss
Created August 2, 2015 11:15
JBoss cli commands
sudo jboss_user
jbmgr status
jbmgr mdb <item> stop
- Stop mdb related to service
jbmgr restart <list>
- Restart list of services
@IngmarBoddington
IngmarBoddington / template-archive.php
Created August 15, 2012 12:17
Generic Archive Page WordPress Template
<?php
/**
Template Name: Archive
*/
get_header(); ?>
@IngmarBoddington
IngmarBoddington / curl.inc.php
Created September 27, 2012 18:50
PHP cURL Wrapper
<?php
namespace glowingminds;
/**
* Simple wrapper for cURL page fetching
* @author Ingmar Boddington (https://github.com/IngmarBoddington | http://www.glowingminds.co.uk/)
* @author Barry Parkin (https://github.com/barryparkin | http://ba.rrypark.in)
* @version 1.1
*
* ~ Improved security of https connections to prevent man-in-the-middle atacks.
@IngmarBoddington
IngmarBoddington / class_sessionhandler.inc.php
Created October 25, 2012 13:48
PHP Database Session Handler
<?php
/**
* SessionHandler Class - Uses DB for session handling (for multiserver environment)
*
* @package glowingminds
* @author Ingmar Boddington
*/
class SessionHandler {
const TABLENAME = 'sessions';
@IngmarBoddington
IngmarBoddington / gitflow
Created February 1, 2013 16:22
git flow commands (see: https://github.com/nvie/gitflow for resources)
git flow init
- Sets up 'proper' branch structure for repo
git flow feature
- List feature branches
git flow feature start <name>
- Begin a new feature branch from develop and switch to it
git flow feature finish <name>
@IngmarBoddington
IngmarBoddington / composer
Last active December 12, 2015 04:38
Composer PHP Dependency Manager notes - Full example json: http://composer.json.jolicode.com/
Composer Install
================
Download: curl -s https://getcomposer.org/installer | php
Install: mv composer.phar /usr/local/bin/composer
composer.json
=============
contains information of project dependencies
Example (Remember - no comments in json):
@IngmarBoddington
IngmarBoddington / phpTerminal
Last active December 12, 2015 09:39
Commands for using php and associated tools in terminal | Key: <value> type of value will be hinted by string when relevant | [<optionalValue>] | <file(s)> means single filename or multiple space delimited filenames | <int> means an integer | <int|range> means an integer or a range (two integers seperated by hyphen) | <string> means a quoted value
php
- Start interactive session
php -f <filename>
- Run specified script from cli
php -i
- Show PHP info
php -m
@IngmarBoddington
IngmarBoddington / perl
Last active December 12, 2015 12:19
Perl Notes (5.1+) - Linux | Key: <required>, [optional] | Full function reference: http://perldoc.perl.org/index-functions.html
Principles: There's more than one way to do it! / do what I mean!
GENERAL
=======
use <string>;
- Pragmas, intepreted before script runs
- Use 'strict' and 'warnings' to enforce good syntax
- Also used to import libraries
@IngmarBoddington
IngmarBoddington / twig
Created February 28, 2013 11:30
Twig Templating basics (in Symfony) | Key: <required_value>, [optional]
Template naming convention
<bundle>:<controller>:<template>
<bundle> translates to /src/BundleStart/BundleEnd/ (e.g. AcmeBlogBundle -> src/Acme/BlogBundle)
<controller> means template in /Resources/Views/<controller>
<template> is actual name of file in format <name>.<format>.<engine> e.g. index.html.php or smeg.xml.twig
::base.html.twig means template in application wide dir i.e. app/Resources/Views/
{{ <variable> }} - Output value