Skip to content

Instantly share code, notes, and snippets.

View eteubert's full-sized avatar

Eric Teubert eteubert

View GitHub Profile
ericteubert: /Volumes/ingame Portal Plugins [svn:]
➜ ack bootstrap
ingame_wpauth/ingame_wpauth.php
11:require_once 'bootstrap.inc.php';
test_dispatcher/test_dispatcher.php
11:require_once 'bootstrap.inc.php';
ingame_userconverter/user_converter.php
11:require_once 'bootstrap.inc.php';
simple_form (1.3.0) lib/simple_form/form_builder.rb:83:in `default_input_type'
simple_form (1.3.0) lib/simple_form/form_builder.rb:83:in `input'
app/views/users/new.html.haml:2:in `_app_views_users_new_html_haml___732771201_2202237740_0'
haml (3.0.24) lib/haml/helpers/action_view_mods.rb:167:in `call'
haml (3.0.24) lib/haml/helpers/action_view_mods.rb:167:in `form_for_without_haml_xss'
haml (3.0.24) lib/haml/helpers.rb:253:in `with_tabs'
haml (3.0.24) lib/haml/helpers/action_view_mods.rb:167:in `form_for_without_haml_xss'
actionpack (3.0.3) lib/action_view/helpers/capture_helper.rb:40:in `capture_without_haml'
actionpack (3.0.3) lib/action_view/helpers/capture_helper.rb:172:in `with_output_buffer_without_haml_xss'
haml (3.0.24) lib/haml/helpers/xss_mods.rb:109:in `with_output_buffer'
@eteubert
eteubert / Git Workflow
Created January 17, 2011 19:03
2 branches: master = live, dev = development
# start work on a new feature
# creates a new branch based on the latest stable version (which is master)
function gfnew () {
git checkout master
git checkout -b $*
}
# make the feature available in dev.ingame.de
# push changes to dev and then checkout featurebranch again
# so you can continue to work on it immediately
function gfnew () {
git checkout master
git checkout -b $*
}
# make the feature available in dev.ingame.de
# push changes to dev and then checkout featurebranch again
# so you can continue to work on it immediately
function gfdev () {
CURBRANCH=`git branch | grep \* | awk '{print $2}'`
@eteubert
eteubert / rcov.rake
Created April 18, 2011 12:38
A rake task to combine the rcov coverage reports of RSpec and Cucumber
require 'rspec/core/rake_task'
require 'cucumber/rake/task'
namespace :rcov do
rcov_options = %w{
--rails
--exclude osx\/objc,gems\/,spec\/,features\/,seeds\/
--aggregate coverage/coverage.data
}
@eteubert
eteubert / user_model_eteubert.rb
Created May 1, 2011 09:51
A simple user model with and without `has_secure_password` helper.
class User < ActiveRecord::Base
has_secure_password
attr_accessible :email, :password, :password_confirmation
validates_presence_of :email
validates_uniqueness_of :email
def self.authenticate(email, password)
find_by_email(email).try(:authenticate, password)
@eteubert
eteubert / Terminal
Created October 22, 2011 18:36
WordPress How To: Change the Admin Greeting
ericteubert: ~/Sites/wordpress-single
➜ ack Howdy
wp-admin/admin-header.php
154:$links[5] = sprintf( __('Howdy, %1$s'), $user_identity );
wp-admin/network.php
111: '<p>' . __('Once you add this code and refresh your browser, multisite should be enabled. This screen will keep an archive of the added code. You can toggle between Network Admin and Site Admin by clicking on the Howdy (Username) dropdown in the upper right of the administration area.') . '</p>' .
ericteubert: ~/Sites/wordpress-single
➜ awk 'NR >= 271 && NR <= 514' wp-includes/pluggable.php | grep apply_filters
extract( apply_filters( 'wp_mail', compact( 'to', 'subject', 'message', 'headers', 'attachments' ) ) );
$phpmailer->From = apply_filters( 'wp_mail_from' , $from_email );
$phpmailer->FromName = apply_filters( 'wp_mail_from_name', $from_name );
$content_type = apply_filters( 'wp_mail_content_type', $content_type );
$phpmailer->CharSet = apply_filters( 'wp_mail_charset', $charset );
@eteubert
eteubert / example.html
Created October 27, 2011 08:49
Clean 2 Column Page Layout for Plugins
<div class="wrap">
<div id="icon-options-general" class="icon32"></div>
<h2>My Awesome Plugin</h2>
<div class="metabox-holder has-right-sidebar">
<div class="inner-sidebar">
<div class="postbox">
@eteubert
eteubert / abstract-example.php
Created October 31, 2011 11:07
WordPress: Customize Page & Post Metaboxes
<?php
$wp_meta_boxes[ 'post' ][ 'normal' ][ 'core' ][ 'post excerpt' ][ 'title' ] = 'Abstract';
$wp_meta_boxes[ 'post' ][ 'normal' ][ 'core' ][ 'post excerpt' ][ 'id' ] = 'postabstract';