Skip to content

Instantly share code, notes, and snippets.

View mkober's full-sized avatar

Mark Koberlein mkober

View GitHub Profile
@mkober
mkober / gist:6889412
Created October 8, 2013 18:37
Maya X-Ray on Selected Objects
global proc r_superXray()
{
string $select[] = `ls -sl`;
int $sizes = `size$select`;
if ($sizes >= 1)
{
string $mySel[] = `ls -sl -dag -s`;
for ($s in $mySel)
@mkober
mkober / generate-php-ctags
Created December 12, 2012 04:00
Generate PHP ctags
ctags -f .tags \
-h \".php\" -R \
--exclude=\"\.git\" \
--totals=yes \
--tag-relative=yes \
--PHP-kinds=+cf \
--regex-PHP='/abstract class ([^ ]*)/\1/c/' \
--regex-PHP='/interface ([^ ]*)/\1/c/' \
--regex-PHP='/(public |static |abstract |protected |private )+function ([^ (]*)/\2/f/'
@mkober
mkober / gist:1820269
Created February 13, 2012 20:47
Ways to prevent SQL Injections in PHP (for LV PHP Meetup)
// Ways to prevent SQL Injections in PHP (http://php.net/manual/en/security.database.sql-injection.php)
1. "Never connect to the database as a superuser or as the database owner. Use always customized users with very limited privileges."
2. "Check if the given input has the expected data type. PHP has a wide range of input validating functions, from the simplest ones found in Variable Functions and in Character Type Functions" (e.g. is_numeric(), ctype_digit()
3. "Quote each non numeric user supplied value that is passed to the database with the database-specific string escape function" (e.g. mysql_real_escape_string(), sqlite_escape_string(), etc.). "If a database-specific string escape mechanism is not available, the addslashes() and str_replace() functions may be useful (depending on database type)."
<?php
@mkober
mkober / .tmux.conf
Created January 17, 2012 04:02
.tmux.conf
# Make it use C-a, similar to screen..
# unbind C-b
# unbind l
# set -g prefix C-a
# bind-key C-a last-window
# Reload key
bind r source-file ~/.tmux.conf
unbind Right
@mkober
mkober / .vimrc.after
Created January 17, 2012 03:59
.vimrc.after
color desert
hi Cursorline cterm=bold
set cursorline