Skip to content

Instantly share code, notes, and snippets.

View ccschmitz's full-sized avatar

Chris Schmitz ccschmitz

View GitHub Profile
@ccschmitz
ccschmitz / pivotal_tracker_git_flow.rake
Last active December 18, 2015 23:19 — forked from jondkinney/pivotal_tracker_git_flow.rake
A Rake task that allows you to start/finish stories.
require "rubygems"
require "pivotal-tracker"
namespace :pt do
# In order to use these tasks you'll need to install the pivotal tracker gem:
#
# gem install pivotal-tracker
#
# Then setup your Pivotal Tracker information in your git config file:
#
@ccschmitz
ccschmitz / min-max-enforcement.js
Created March 11, 2013 14:46
Some JS to ensure that a user doesn't enter a value that is less than or greater than the min/max values allowed for a number input.
$('#element').change(function() {
var $this = $(this);
if ($this.val() > $this.attr('max')) {
$this.val($this.attr('max'));
} else if ($this.val() < $this.attr('min')) {
$this.val($this.attr('min'));
}
});
@ccschmitz
ccschmitz / ajax-load-more-posts.js
Last active December 11, 2015 07:28
An example of how to load WordPress posts via AJAX.
@ccschmitz
ccschmitz / wp_editor.php
Created December 16, 2012 23:43
An example of how to use wp_editor() on a custom WPAlchemy metabox.
<?
$mb->the_field( 'field_name' );
$content = apply_filters( 'meta_content', html_entity_decode( $mb->get_the_value() ) );
$id = $mb->get_the_name();
$settings = array(
'textarea_rows' => 3
);
wp_editor( $content, $id, $settings );
@ccschmitz
ccschmitz / generate-manifest.rb
Created December 12, 2012 04:26
A simple Ruby script for generating a cache manifest.
manifest = File.open('offline.appcache', 'a')
manifest.truncate(0)
manifest.puts 'CACHE MANIFEST'
Dir.glob('*/**/*.*') do |file_name|
manifest.puts file_name
end
@ccschmitz
ccschmitz / Default (OSX).sublime-keymap
Last active October 10, 2015 15:37
My Sublime Text settings
[
// Advanced new file
{"keys": ["super+alt+shift+n"], "command": "advanced_new_file"},
{"keys": ["super+alt+shift+r"], "command": "advanced_new_file", "args": {"rename": true}},
// Switch casing
{ "keys": ["super+k", "super+s"], "command": "swap_case" },
{ "keys": ["super+k", "super+t"], "command": "title_case" },
// Ruby tags
@ccschmitz
ccschmitz / ST2 Multiple Cursor Keybindings.md
Created August 11, 2012 18:33
Create keybindings for multiple cursors in Sublime Text

Create Multiple Cursors from the Keyboard in Sublime Text

The following keybindings will allow you to create multiple cursors (above or below the current cursor) with Command + Option + (Up|Down). On Windows it would be Control + Alt + (Up|Down).

{ "keys": ["super+alt+up"], "command": "select_lines", "args": {"forward": false} },
{ "keys": ["super+alt+down"], "command": "select_lines", "args": {"forward": true} }
@ccschmitz
ccschmitz / go_back_btn_helper.txt
Created July 11, 2012 20:14
An example go_back_btn Rails helper
def go_back_url(fallback, text = 'Go Back')
url = request.referer.blank?
url = fallback if url.blank?
link_to text, url, class: 'btn'
end
@ccschmitz
ccschmitz / Preferences.sublime-settings
Created April 26, 2012 20:40
Sublime Text 2: Settings - User
{
"close_windows_when_empty": true,
"color_scheme": "Packages/textmate-tomorrow-theme/Tomorrow-Night.tmTheme",
"font_face": "Monaco",
"font_size": 12,
"ignored_packages":
[
],
"open_files_in_new_window": false,
"theme": "Soda Light.sublime-theme"
@ccschmitz
ccschmitz / laravel-mamp-setup.md
Created January 28, 2012 17:16
Laravel MAMP Setup

Here's how I setup Laravel on MAMP:

1. Add a .htaccess file to the root of the application with the following rules:

<IfModule mod_rewrite.c>
	RewriteEngine on

	RewriteRule ^$ public/ [L]
	RewriteRule (.*) public/$1 [L]