Skip to content

Instantly share code, notes, and snippets.

View andreaseriksson's full-sized avatar

Andreas Eriksson andreaseriksson

View GitHub Profile
@andreaseriksson
andreaseriksson / gist:5597863
Created May 17, 2013 08:57
RAILS Install from apptemplate
rails new blog -m https://raw.github.com/andreaseriksson/apptemplate/master/app_template.rb
@andreaseriksson
andreaseriksson / gist:5603829
Created May 18, 2013 09:17
RAILS Rest controller
class PagesController < ApplicationController
def index
@pages = Page.all
end
def show
@page = Page.find(params[:id])
end
@andreaseriksson
andreaseriksson / gist:5603840
Created May 18, 2013 09:20
RAILS helper is_active
def is_active?(page_name)
"active" if params[:controller] == page_name
end
@andreaseriksson
andreaseriksson / gist:5603841
Created May 18, 2013 09:21
RAILS Bootstrap Flash message
def flash_message(name,msg)
if name == :notice
box_class = "success"
name = "Success"
else
box_class = "error"
name = "Error"
end
@andreaseriksson
andreaseriksson / gist:5604140
Last active December 17, 2015 11:39
Borboun mixins
/*Linear-gradient*/
@include linear-gradient(#1e5799, #2989d8);
/*Radial-gradient*/
@include radial-gradient(#1e5799, #3dc3d1);
/*Tint & Shade*/
background: tint(red, 40%);
background: shade(blue, 60%);
@andreaseriksson
andreaseriksson / gist:5604156
Created May 18, 2013 11:48
JQUERY UI Autocomplete
$(function() {
$("#birds").autocomplete({
source: "search.php",
minLength: 2,
select: function( event, ui ) {
alert(ui.item.value);
}
});
});
@andreaseriksson
andreaseriksson / gist:5604168
Last active December 17, 2015 11:39
JQUERY UI Dialog
<script>
$(function() {
$( "#dialog-modal" ).dialog({
height: 140,
modal: true,
autoOpen: false,
draggable: false,
resizable: false,
position: { my: "left top", at: "left bottom", of: button }
});
@andreaseriksson
andreaseriksson / gist:5604179
Created May 18, 2013 11:57
BOOTSTRAP Modal
<!-- Button to trigger modal -->
<a href="#myModal" role="button" class="btn" data-toggle="modal">Launch demo modal</a>
<!-- Modal -->
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Modal header</h3>
</div>
<div class="modal-body">
@andreaseriksson
andreaseriksson / gist:5604189
Created May 18, 2013 12:01
BOOTSTRAP Button-group
<div class="btn-group">
<button class="btn">Left</button>
<button class="btn">Middle</button>
<button class="btn">Right</button>
</div>
@andreaseriksson
andreaseriksson / gist:5604195
Created May 18, 2013 12:03
BOOTSTRAP Horizontal form
<form class="form-horizontal">
<div class="control-group">
<label class="control-label" for="inputEmail">Email</label>
<div class="controls">
<input type="text" id="inputEmail" placeholder="Email">
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputPassword">Password</label>
<div class="controls">