Skip to content

Instantly share code, notes, and snippets.

View spleenteo's full-sized avatar
😅
everything's fine!

Matteo Papadopoulos spleenteo

😅
everything's fine!
View GitHub Profile
module Railsyard::Backend
class FormBuilder < SimpleForm::FormBuilder
def group(group_name, options = {}, &block)
group_legend = template.link_to translate(:groups, group_name, group_name.to_s.titleize), "##{group_name}", data: { behaviour: "dom-toggle" }
group_hint = translate(:group_hints, group_name)
[
template.content_tag(:h3, group_legend, class: 'group-header', data: { translation_keys: translate_lookups(:groups, group_name, group_name.to_s.titleize) }),
template.content_tag(:div, id: group_name, class: 'group-content') do
@spleenteo
spleenteo / box bookrepublic
Created June 22, 2012 16:30
box bookrepublic
.box_{
/*
* un box non può avere caratteristiche se non il colore di sfondo
* niente border, niente margini o padding, nè altro che alteri al sua struttura
* tutto il contenuto deve stare dentro una section che eredita alcune proprietà
* dalla libreria LEGO
*/
background-color: $cBoxBackground;
$box_gap: 5px; // dare coerenza agli spazi
$fontFactor: 1.2; // fattore di scala per font, line-height ecc.
@spleenteo
spleenteo / clearfix.scss
Created June 3, 2012 00:57
clearfix in scss
.clearfix {
display: block;
&:after {
clear: both;
content: ' ';
display: block;
font-size: 0;
line-height: 0;
visibility: hidden;
width: 0;
@spleenteo
spleenteo / bash_path
Created April 17, 2012 08:48
bash function to build a path like this: ../jobs/mywebsite/www(git::master)>
# I like to have a PATH in my shell
# to show the last 3 dirs of the whole PATH and the git (or hg) repo at the end (if exists)
# here an example:
#
# ../jobs/mywebsite/www(git::master)>
#
# Put these few lines in your .bash_profile:
hg_ps1() {
hg prompt " [{rev}{;{rev|merge}}{ on {branch|quiet}}{ {status|modified}}]" 2> /dev/null
@spleenteo
spleenteo / meta facebook html
Created March 31, 2012 16:15
meta facebook og
<meta property="og:title" content="">
<meta property="og:type" content="website">
<meta property="og:url" content="http://">
<meta property="og:image" content="">
<meta property="og:site_name" content="">
<meta property="og:description" content="">
@spleenteo
spleenteo / ios_addressbar_remover.js
Created March 20, 2012 16:07
remove ios address bar
setTimeout(function(){
// Hide the address bar!
window.scrollTo(0, 1);
}, 100);
@spleenteo
spleenteo / device_orientation.js
Created March 20, 2012 16:06
Detect devices orientation
detectOrientation();
window.onorientationchange = detectOrientation;
function detectOrientation(){
if(typeof window.onorientationchange != 'undefined'){
if ( orientation == 0 ) {
//Do Something In Portrait Mode
}
else if ( orientation == 90 ) {
//Do Something In Landscape Mode
}
@spleenteo
spleenteo / safari_resize_bug_remover
Created March 20, 2012 16:04
remove safari bug on viewport resize
(function(doc) {
var addEvent = 'addEventListener',
type = 'gesturestart',
qsa = 'querySelectorAll',
scales = [1, 1],
meta = qsa in doc ? doc[qsa]('meta[name=viewport]') : [];
function fix() {
meta.content = 'width=device-width,minimum-scale=' + scales[0] + ',maximum-scale=' + scales[1];
doc.removeEventListener(type, fix, true);