Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@hannesfostie
hannesfostie / gist:2204819
Created March 26, 2012 12:43
Twitter Bootstrap - Collapse.js: data-parent not behaving as it should?
<nav id="menu" role="navigation">
<ul id="nav">
<li class="menuitem"><a href="#" data-toggle="collapse" data-target="#subnav1" data-parent="#nav">Deelnemers</a>
<ul class="subnav collapse" id="subnav1">
<li class="subnavitem"><a href="#">Cafetaria</a></li>
<li class="subnavitem"><a href="#">Cafetaria</a></li>
<li class="subnavitem"><a href="#">Cafetaria</a></li>
<li class="subnavitem"><a href="#">Cafetaria</a></li>
<li class="subnavitem"><a href="#">Cafetaria</a></li>
</ul>
2012-03-31T21:07:49+00:00 app[web.1]: !! Unexpected error while processing request: Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (pg is not part of the bundle. Add it to Gemfile.)
2012-03-31T21:07:49+00:00 heroku[router]: Error H13 (Connection closed without response) -> GET address.heroku.com/ dyno=web.1 queue= wait= service= status=503 bytes=
class Doctor < ActiveRecord::Base
attr_accessible :name, :phone, :province_id
has_many :schedules, :dependent => :destroy
has_one :province
end
@hannesfostie
hannesfostie / _form.html.erb
Created July 9, 2012 18:08
chosen troubles
<%= form_for @schedule, :html => { :class => 'form-horizontal' } do |f| %>
<fieldset>
<legend><%= controller.action_name.capitalize %> /Schedule</legend>
<div class="control-group">
<%= f.label :date, :class => 'control-label' %>
<div class="controls">
<%= f.date_select :date, :class => 'date_select' %>
</div>
</div>
def operations_for_company
@operations = []
offers.each do |offer|
@operations << offer.operations
end
@operations
end

Description

Simple Dashing widget that tracks time since a certain event. Time Since Last waits for request to be made to your instance of Dashing and will then reset the time since the last occurrence of whatever event you would like to track. An example could be the time since the last exception for one of your applications, or the time since the last accident on the workfloor (better keep that widget green)!

The widget was made by @hannesfostie for use @openminds. If you end up using this widget, please send me a tweet! I'd love to hear about it.

Dependencies

This widget requires HTML5's localStorage in order to keep track of the last time the event occurred in order for it to work across restarts and refreshes.

<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<style>
.graph { width: 150px; height: 150px; }
.graph path { stroke: steelblue; }
</style>
<div class="graph" data-discounts="-31.0,-31.0,-32.0,-32.0,-32.0,-32.0,-32.0,-31.0,-31.0,-32.0,-32.0,-32.0,-32.0,-32.0,-31.0,-31.14,-30.9,-30.93,-30.91,-30.66,-28.25,-30.91,-31.71,-31.11,-31.0,-31.16,-31.91,-31.63,-31.42,-31.24,-31.12,-31.23,-31.23,-31.1,-30.7,-30.62,-30.42,-30.61,-30.65,-30.46,-30.46,-30.46,-30.84,-30.73,-30.76,-29.51,-29.54,-29.54,-29.57,-29.83,-29.83,-29.83,-29.79,-29.75,-29.75,-29.5,-29.42,-30.12,-30.12,-30.22,-30.35,-30.36,-30.63,-30.68,-30.53,-29.59,-30.45,-30.52,-30.55,-30.55,-30.62,-30.33,-31.02,-31.02,-31.02,-31.02,-30.96,-30.96,-30.95,-30.43,-29.98,-29.98,-29.98,-30.02,-30.11,-30.05,-30.05,-31.16,-31.17,-31.14,-31.18,-30.88,-30.82,-30.39,-31.02,-31.09,-31.1,-31.12,-31.14,-30.04,-30.65,-30.02,-31.75,-31.75,-31.71,-32.07,-32.08,-32.12,-32.12,-32.1,-32.1
class DnsRecord < ActiveRecord::Base
# This is a model using the default database
belongs_to :powerdns_record #...
before_create :create_in_powerdns
private
def create_in_powerdns
{
"basics": {
"name": "Hannes Fostie",
"label": "Ruby Developer",
"picture": "profile.png",
"email": "hannes.fostie@gmail.com",
"phone": "+32 479 37 78 57",
"summary": "I am a Ruby developer based in Belgium with a passion for elegant code and beautiful interfaces (whether they be visual or not - such as command line tools and APIs). My love for the web started as a teenager creating gaming websites in <blink>Frontpage</blink> and DreamWeaver. I initially had a strong preference for design but I soon learned design can be found in so much more than the visual side of things.",
"location": {
"address": "Avondvrede 4",