Skip to content

Instantly share code, notes, and snippets.

View glideranderson's full-sized avatar

Robin Hjelmeir glideranderson

View GitHub Profile
@glideranderson
glideranderson / fileupload.js
Created June 14, 2012 18:17
Unsure what return does for QQ Uploader (errors in ie9)
_isValidFileDrag: function(e){
var dt = e.dataTransfer,
// do not check dt.types.contains in webkit, because it crashes safari 4
isWebkit = navigator.userAgent.indexOf("AppleWebKit") > -1;
console.log(dt);
// dt.effectAllowed is none in Safari 5
// dt.types.contains check is for firefox
return dt && dt.effectAllowed != 'none' &&
(dt.files || (!isWebkit && dt.types.contains && dt.types.contains('Files')));
@glideranderson
glideranderson / full_payments_controller.rb
Created May 17, 2012 13:34
Full Payments Controller
class PaymentsController < ApplicationController
before_filter :authenticate_member!
autocomplete :company, :name, :full => true, :extra_data => [:address1, :address2, :city, :state, :zip, :business_category_id, :revenue_id], :scopes => [:inactive]
respond_to :json, :only => [:dues]
def index
end
def new
@payment = Payments.new(:member_id => current_member)
@glideranderson
glideranderson / payments.html
Created May 16, 2012 21:45
Horrible rails controller method, need help
[{:active=>"no", :start=>Tue, 15 May 2012 20:42:17 UTC +00:00, :amount=>"10.00", :card_type=>"Visa", :card_number=>"0195"}]
<p>Get this output at the end of my .each</p>
@glideranderson
glideranderson / tactic_loop
Created March 13, 2012 18:03
Rails Sidebar Tactic Loop
.sidebar
.sidebar-top.hide-on-phones
%dl.nice.vertical.tabs
- current_workplan.objectives.each do |o|
%dd.active
= link_to o, workplan_objective_path(current_workplan, o)
%span.arrows.hide-on-phones
%span.loop
%ul.children
- o.tactics.each do |t|
@glideranderson
glideranderson / wordpress loop
Created October 28, 2011 16:49
Wordpress loop within template file
<?php
$args = array( 'pagename' => 'contact');
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
?>
<h2><?= the_title();?></h2>
<p><?= the_content(); ?></p>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
@glideranderson
glideranderson / specials-ajax-issue.js
Last active September 27, 2015 16:37
Specials page grrr
/*
Specials Page
*/
if($j('.specials-wrapper').length > 0 ) {
$j('.specials-cat-nav li:first-child').addClass('active');
$j('.specials-page').find('.cat-wrapper').not(':first-child').hide();
$j('.specials-page .cat-wrapper:first-child').addClass('active');
// opening new section on click
$j('.specials-cat-nav li a').live('click', function(e) {
@glideranderson
glideranderson / jquery.counter-2.0-update.js
Created October 11, 2011 15:22
Update to jquery.counter-2.0.js
/*! jQuery.counter.js (jQuery Character and Word Counter plugin)
v2.0 (c) Wilkins Fernandez
MIT License
*/
(function($) {
$.fn.extend({
counter : function(options) {
var defaults = {
type : 'char', // {char || word}
count : 'down', // count {up || down} from or to the goal number