Skip to content

Instantly share code, notes, and snippets.

Jared Hoyt jaredhoyt

  • Goldstar Events
  • Portland, Oregon
Block or report user

Report or block jaredhoyt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am jaredhoyt on github.
  • I am jaredhoyt (https://keybase.io/jaredhoyt) on keybase.
  • I have a public key whose fingerprint is 58FF 2A64 9B63 53D3 C440 611F BC73 8EF8 EA27 3795

To claim this, I am signing this object:

View bug-report.rb
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
@jaredhoyt
jaredhoyt / pre-push
Last active Dec 24, 2015
git pre-push hook to prevent force push to master
View pre-push
#!/usr/bin/env ruby
# This script has been slightly adapted from:
# http://blog.bigbinary.com/2013/09/19/do-not-allow-force-pusht-to-master.html
class PrePushHandler
def handle
reject if force_pushing? && pushing_to_master?
end
@jaredhoyt
jaredhoyt / gist:5725338
Last active Dec 18, 2015
CheckBoxLabelExtension
View gist:5725338
namespace System.Web.Mvc.Html {
using System.Collections;
using System;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Linq.Expressions;
public static class CheckBoxLabelExtensions {
public static MvcHtmlString CheckBoxLabel(this HtmlHelper html, string expression) {
return CheckBoxLabel(html, expression, null);
View gist:932905
<?php
App::import('Core', 'Controller');
App::import('Component', 'Email');
class ReportsShell extends Shell {
var $uses = array('PaymentException');
/**
* Controller/EmailComponent instances.
*
* @var class
*/
View gist:896608
<?php
ini_set('max_execution_time', 90);
ini_set('memory_limit', '512M');
class Payment extends AppModel {
var $actsAs = array('SoftDeletable');
var $belongsTo = array('Payer', 'Procedure');
var $validate = array(
'import' => array(
'rule' => 'validImport',
'message' => 'Please submit a valid import document.'
@jaredhoyt
jaredhoyt / gist:895156
Created Mar 30, 2011
Submitting a form and reloading results via ajax (jQuery)
View gist:895156
<script type="text/javascript">
jQuery(function(){
$('form').submit(function(event){
$.post(form.action, $(form).serializeArray(), function(response){
$('table').html($(response).find('table').children());
});
event.preventDefault();
});
});
</script>
@jaredhoyt
jaredhoyt / gist:876242
Created Mar 18, 2011
Shell using Email Component
View gist:876242
<?php
App::import('Core', 'Controller');
App::import('Component', 'Email');
class ExampleShell extends Shell {
function main() {
$this->Controller =& new Controller();
$this->Email =& new EmailComponent(null);
$this->Email->initialize($this->Controller);
}
}
@jaredhoyt
jaredhoyt / prevent-cache.js
Created Mar 16, 2011
jQuery Cache Prevention
View prevent-cache.js
// This will affect all subsequent ajax calls made with jQuery
jQuery(function(){
$.ajaxSetup({
cache: false
});
});
@jaredhoyt
jaredhoyt / gist:826903
Created Feb 15, 2011
Example Permissionable usage
View gist:826903
<?php
# Controller
$job = $this->Note->Job->find('summary', array(
'conditions' => array('Job.id' => $job_id),
'contain' => array('Note.CreatedBy', 'TodoList.TodoItem.Note.CreatedBy', 'Submittal.Note.CreatedBy')
));
You can’t perform that action at this time.