Skip to content

Instantly share code, notes, and snippets.

View adagio's full-sized avatar
👨‍💻
practicing Django / learning about blockchain

Edu F adagio

👨‍💻
practicing Django / learning about blockchain
  • HartasCuerdas
  • Lima, Peru
View GitHub Profile
@adagio
adagio / gist:9266676
Last active August 29, 2015 13:56
Script to simulate javascript hover function (Magento varien/menu.js)
<script type="text/javascript">
jQuery( document ).ready(function( $ ) {
$("li.level0.nav-4.level-top.parent").addClass("over");
$("li.level0.nav-4.level-top.parent > a").addClass("over");
$("li.level0.nav-4.level-top.parent > div").css({ display: "block" });
/*pancreas*/
/*
$("li.level1.nav-4-4.parent").addClass("over");
$("li.level1.nav-4-4.parent a").addClass("over");
$("li.level1.nav-4-4.parent ul").addClass("shown-sub");
@adagio
adagio / welcome_controller.erb
Last active August 29, 2015 14:05
Current date and time in RoR Controller
class WelcomeController < ApplicationController
def index
now = Time.now
@strdate = now.strftime('%b %d')
@strtime = now.strftime('%H:%M')
end
end
@adagio
adagio / index.html.erb
Created August 18, 2014 18:36
Current date and time on RoR
<div class="thisinstant">
<div class="date">Date: <%= @strdate %></div>
<div class="time">Time: <%= @strtime %><div>
</div>
@adagio
adagio / index.html.erb
Created August 18, 2014 18:39
Formatted date and time in RoR View
<div class="thisinstant">
<div class="date">Date: <%= @strdate %></div>
<div class="time">Time: <%= @strtime %><div>
</div>
@adagio
adagio / Gemfile
Created August 19, 2014 15:13
How to add Bootstrap-SASS to Rails
# Use bootstrap front-end framework
gem 'bootstrap-sass', '~> 3.2.0'
@adagio
adagio / index.html.erb
Created August 20, 2014 03:52
Executing action with Ajax in RoR, and modifying html without refreshing the page
...
<tr id="<%= day.id %>">
...
<td><%= link_to 'Total', total_day_path(day), :remote => true %></td>
...
@adagio
adagio / index.html.erb
Created August 20, 2014 15:15
Produce a link that triggers an Ajax action when clicked
...
<tr id="<%= day.id %>">
...
<td><%= link_to 'Total', total_day_path(day), :remote => true %></td>
...
@adagio
adagio / myaction.js.erb
Created August 20, 2014 15:16
Use JQuery to manipulate the dom and html elements with the powerful help of Rails bindings
$("tr#<%= @day.id %> td.oTotal").html("<%= @day.oTotal %>");
$("tr#<%= @day.id %> td.dTotal").html("<%= @day.dTotal %>");
@adagio
adagio / myentity_controller.erb
Created August 20, 2014 15:18
Indicate javascript respond in respond_to block
...
def myaction
...
respond_to do |format|
format.js {}
end
end
...
@adagio
adagio / myentity_controller.rb
Last active August 29, 2015 14:05
Handling params in Controller
#
@myparam = params[:myaram] ? params[:myparam]) : defaultValue
#