Skip to content

Instantly share code, notes, and snippets.

@s5ot
s5ot / gist:8970149
Created February 13, 2014 05:19
Flot bar chart sample
<html>
<head>
<meta charset="UTF-8">
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script language="javascript" type="text/javascript" src="flot-flot-e2147c0/jquery.flot.js"></script>
<script language="javascript" type="text/javascript" src="flot-flot-e2147c0/jquery.flot.categories.js"></script>
</head>
<body>
<h1>Weather Statistics in Boston</h1>
<div id="placeholder" style="width:600px;height:300px"></div>
== View
<% require 'will_paginate/array' %>
<% p = (1..1000).to_a.paginate %>
<%= will_paginate(p, :renderer => CarsHelper::CustomRenderer) %>
== CustomClass
module CarsHelper
#
# See: https://github.com/mislav/will_paginate/wiki/Link-renderer
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
source /usr/local/Cellar/git/1.8.2.3/etc/bash_completion.d/git-completion.bash
source /usr/local/Cellar/git/1.8.2.3/etc/bash_completion.d/git-prompt.sh
#GIT_PS1_SHOWDIRTYSTATE=true
#export PS1='\[\033[32m\]\u@\h\[\033[00m\]:\[\033[34m\]\w\[\033[31m\]$(__git_ps1)\[\033[00m\]\$ '
hg_branch() {
hg branch 2> /dev/null | awk '{print " (hg:"$1""}'
@s5ot
s5ot / gist:1170346
Created August 25, 2011 09:49
Custom WillPaginate Renderer Class For Bootstrap
class BootstrapLinkRenderer < WillPaginate::ActionView::LinkRenderer
def page_number(page)
unless page == current_page
tag(:li, link(page, page, :rel => rel_value(page)))
else
tag(:li, link(page, "#"), :class => 'active')
end
end
def link(text, target, attributes = {})