Skip to content

Instantly share code, notes, and snippets.

def icon(style)
raw "<i class='icon-#{style}'></i>"
end
@bshelton229
bshelton229 / Gemfile
Last active December 16, 2015 19:30 — forked from mathias/Gemfile
source "https://rubygems.org"
gem 'rspec'
@bshelton229
bshelton229 / madison-osm
Created January 31, 2013 18:55
Download a real time OpenStreetMap data snapshot for Madison, WI, USA from the Overpass API.
wget --timeout=0 "http://www.overpass-api.de/api/xapi?map?bbox=-89.6037,42.9642,-89.1663,43.1799" -O madison-wi.osm
@bshelton229
bshelton229 / gist:3724148
Created September 14, 2012 19:27
Get stats from a wordpress directory
<?php
/**
* @version 0.2
*/
/**
* Some plugins create a session (Woo Commerce)
* so create a temporary session save path
*/
$session_path = sys_get_temp_dir();
@bshelton229
bshelton229 / gist:3626164
Created September 4, 2012 20:35
Word Destroyer
<ul>
<li><a href='vidal'>Vidal</a></li>
<li>
<a href='#subs'>Sub Vidals (TARGET ME)</a>
<ul class="children">
<li><a>Test</a></li>
</ul>
</li>
</ul>
@bshelton229
bshelton229 / example.rb
Created August 21, 2012 18:01
Generate bootstrap dropdown from a hash
menu = [
{
:title => 'Map Objects',
:link => admin_map_objects_path,
:controller => 'admin/map_objects',
:access => current_in_role(:admin)
},
{
:title => 'Tags',
:link => admin_tags_path,
/**
* GO F&(@)(#) yourself CSS
*/
function mapResize() {
var height = $(window).height();
var width = $(window).width();
console.log(height);
if ( width > 979 ) {
console.log('got here');
$("#map-div").height(height+'px');
def current_user
@current_user ||= ( session[:user_id] and ( user = User.find_by_id(session[:user_id]) ) ? user : nil )
end
<?php
/**
* Customise the events html for the <li> or each event
*/
function my_uwmadison_events_html($html, $event, $opts) {
// do a bunch of logic with the $event object to determine the
// ticket link
$ticket_link = '...logic for ticket link generation ...';
if ( $ticket_link ) {
<?php
class P {
public $user;
public function before() {
$this->user = 'bshelton2';
}
}