Skip to content

Instantly share code, notes, and snippets.

View andreaseriksson's full-sized avatar

Andreas Eriksson andreaseriksson

View GitHub Profile
@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: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: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: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: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: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: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