Skip to content

Instantly share code, notes, and snippets.

def nav_link(link_text, controller, action = nil)
active = params[:controller] == controller.to_s &&
(action.nil? || params[:action] == action.to_s)
class_name = active ? "active" : nil
content_tag(:li, :class => class_name) do
link_to link_text, controller
end
end
@RelativeMedia
RelativeMedia / gist:3756318
Created September 20, 2012 14:40
bootstrap responsive layout example of side by side spans with borders and padding
<!DOCTYPE html>
<!--
Im using a secondary div container for my border
and adjusting padding accordingly. I did this
because one of the projects im working on uses
a css3 gradient instead of a regular border
you could use just a single content div within
the span6 and put your padding/border on that
element itsself.
-->
@RelativeMedia
RelativeMedia / gist:3453067
Created August 24, 2012 17:17
C9 error when creating a new project
Error: ssh process died with exit code 255 at ChildProcess.onError (/home/ubuntu/c9/node_modules/vfs-private/ssh/master.js:76:23) at ChildProcess.emit (events.js:70:17) at maybeExit (child_process.js:362:16) at Process.onexit (child_process.js:398:5) at createProjectImpl__3 (/home/ubuntu/c9/plugins-server/c9.api.project/tmp--390074386.js:275:16)
@RelativeMedia
RelativeMedia / gist:2242221
Created March 29, 2012 19:06
frontend-master css
/* =Sidebar Left
this is the styling for the left sidebar section of the
MapIt system.
------------------------------------------------------*/
/**
* Sidebar container styling
*/
#map_sidebar_controls_container{
position:relative;
@RelativeMedia
RelativeMedia / gist:2137223
Created March 20, 2012 15:40
boilerplate fix for console.log
// usage: log('inside coolFunc', this, arguments);
// paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/
window.log = function(){
log.history = log.history || []; // store logs to an array for reference
log.history.push(arguments);
if(this.console) {
arguments.callee = arguments.callee.caller;
var newarr = [].slice.call(arguments);
(typeof console.log === 'object' ? log.apply.call(console.log, console, newarr) : console.log.apply(console, newarr));
$(".text").labelify();
var menuLi = $('.home-top-navigation li');
var subMenu = $('.sub-menu');
if (menuLi.length){
menuLi.children('ul').hover(
function() {
$(menuLi).addClass('child-parent-hover-border');
},
function() {
$(menuLi).removeClass('child-parent-hover-border');