Skip to content

Instantly share code, notes, and snippets.

@JonTheWhite
JonTheWhite / laravel_entity_gen.rb
Created March 4, 2012 19:02
Laravel Entity Generator
require 'ruble'
command 'Generate Entity Getter/Setters' do |cmd|
cmd.key_binding = 'M1+M2+G'
cmd.scope = 'source.php'
cmd.output = :replace_document
cmd.input = :document
cmd.invoke do |context|
file = context.TM_SELECTED_FILES.match(/([a-zA-Z0-9]+)\.php/)[1]
line = STDIN.read
columns = line.scan(/@Column\(name="([^"]+)", type="([^"]+)"/)
@JonTheWhite
JonTheWhite / entity_maker.rb
Created February 23, 2012 20:10
Generate Entity Getters/Setters
require 'ruble'
command 'Generate Entity Getter/Setters' do |cmd|
cmd.key_binding = 'M1+M2+G'
cmd.scope = 'source.php'
cmd.output = :replace_document
cmd.input = :document
cmd.invoke do |context|
file = context.TM_SELECTED_FILES.match(/([a-zA-Z0-9]+)\.php/)[1]
line = STDIN.read
columns = line.scan(/@Column\(name="([^"]+)", type="([^"]+)"/)
@JonTheWhite
JonTheWhite / gitBranchShell
Created January 16, 2012 14:52
git branch in shell
# Add this to bashrc.
__git_ps1 ()
{
local b="$(git symbolic-ref HEAD 2>/dev/null)";
if [ -n "$b" ]; then
printf " (%s)" "${b##refs/heads/}";
fi
}
PS1="\${debian_chroot:+(\$debian_chroot)}\[\033[01;32m\]\u\[\033[01;34m\] \w\[\033[35m\]\$(__git_ps1) \[\033[01;34m\]\$\[\033[00m\] "
@JonTheWhite
JonTheWhite / debug_here.rb
Created November 19, 2011 18:46
Aptana Command - debug
require 'ruble'
command 'Debug this line' do |cmd|
cmd.key_binding = 'M1+M2+Q'
cmd.scope = 'source.php'
cmd.output = :insert_as_snippet
cmd.input = :selection, :line
cmd.invoke do |context|
line = STDIN.read
space = line.match('^\s*')[0]
@JonTheWhite
JonTheWhite / snippets.rb
Created November 19, 2011 18:43
Aptana snippets
with_defaults :scope => 'source.php source.php.embedded.block.html' do
snippet 'Core_Debug::dumps ...' do |s|
s.trigger = 'dar'
s.expansion = '\Core_Debug::dumps($1);'
s.scope = 'source.php'
end
snippet 'Core_Debug::dumps ... exit' do |s|
s.trigger = 'edar'