Skip to content

Instantly share code, notes, and snippets.

View sjelfull's full-sized avatar

Fred Carlsen sjelfull

View GitHub Profile
@sjelfull
sjelfull / 0_selector_hacks.scss
Created December 21, 2011 01:34 — forked from chriseppstein/0_selector_hacks.scss
This gist demonstrates some uses of the new sass feature: Passing content blocks to mixins.
@mixin ie6 { * html & { @content } }
#logo {
background-image: url("/images/logo.png");
@include ie6 { background-image: url("/images/logo.gif"); }
}
@sjelfull
sjelfull / _grid-system.scss
Created December 21, 2011 01:37 — forked from chriseppstein/_grid-system.scss
Building Responsive Layouts with Sass
@import "compass/utilities/general/clearfix";
$gutter-width: 10px; // All grids systems have the same gutter width
$float-direction: left;
$left-gutter-width: ceil($gutter-width / 2) !default;
$right-gutter-width: $gutter-width - $left-gutter-width !default;
$base-line-height: 21px;
$show-grid-background: false;
@mixin centered {
@sjelfull
sjelfull / inline_example.scss
Created December 21, 2011 01:40 — forked from chriseppstein/inline_example.scss
generate an inline sprite.
@include "icon/*.png";
#{$icon-sprite-base-class} {
background-image: inline-sprite($icon-sprites);
}
@sjelfull
sjelfull / 1_sprite_input.css
Created December 21, 2011 01:43 — forked from chriseppstein/1_sprite_input.css
A snippet of sprites on my latest feature at work.
@import "local/provider/databar-icon/*.png";
#databar {
.data-field {
.icon {
@include databar-icon-sprite(default);
@include databar-icon-sprite-dimensions(default);
float: left;
margin: 9px 3px 0 0;
}
body > div {
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(5%, rgba(0, 0, 0, 0.5)), color-stop(5%, rgba(0, 0, 0, 0)), color-stop(100%, rgba(0, 0, 0, 0))), -webkit-gradient(linear, 0% 50%, 100% 50%, color-stop(0px, rgba(0, 0, 0, 0)), color-stop(0px, rgba(0, 0, 0, 0.25)), color-stop(40px, rgba(0, 0, 0, 0)), color-stop(50px, rgba(0, 0, 0, 0)), color-stop(60px, rgba(0, 0, 0, 0.25)), color-stop(100px, rgba(0, 0, 0, 0)), color-stop(110px, rgba(0, 0, 0, 0)), color-stop(110px, rgba(0, 0, 0, 0.25)), color-stop(150px, rgba(0, 0, 0, 0)), color-stop(160px, rgba(0, 0, 0, 0)), color-stop(160px, rgba(0, 0, 0, 0.25)), color-stop(200px, rgba(0, 0, 0, 0)), color-stop(210px, rgba(0, 0, 0, 0)), color-stop(210px, rgba(0, 0, 0, 0.25)), color-stop(250px, rgba(0, 0, 0, 0)), color-stop(260px, rgba(0, 0, 0, 0)), color-stop(260px, rgba(0, 0, 0, 0.25)), color-stop(300px, rgba(0, 0, 0, 0)), color-stop(310px, rgba(0, 0, 0, 0)), color-stop(310px, rgba(0, 0, 0, 0.25)), color-stop(350px, rgba(0, 0, 0, 0)), color-s
@sjelfull
sjelfull / config.rb
Created December 21, 2011 02:27 — forked from yatil/config.rb
My standard config.rb for compass
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "assets/css"
sass_dir = "assets/source/sass"
images_dir = "assets/images"
javascripts_dir = "assets/js"
# You can select your preferred output style here (can be overridden via the command line):
@sjelfull
sjelfull / 1_slower_sprite_file.scss
Created December 21, 2011 18:36 — forked from chriseppstein/1_slower_sprite_file.scss
This gist demonstrates how a generated sprite file can be optimized to shave some time off your compile.
@import "compass/utilities/sprites/base";
// General Sprite Defaults
// You can override them before you import this file.
$emblem-sprite-base-class: ".emblem-sprite" !default;
$emblem-sprite-dimensions: false !default;
$emblem-position: 0% !default;
$emblem-spacing: 0 !default;
$emblem-repeat: no-repeat !default;
@sjelfull
sjelfull / _icons.scss
Created December 21, 2011 18:36 — forked from chriseppstein/_icons.scss
This is an example of the generated stylesheet by compass for a set of sprites
@import "compass/utilities/sprites/base";
// General Sprite Defaults
// You can override them before you import this file.
$icon-sprite-base-class: ".icon-sprite" !default;
$icon-sprite-dimensions: false !default;
$icon-position: 0% !default;
$icon-spacing: 0 !default;
$icon-repeat: no-repeat !default;
@sjelfull
sjelfull / hideaddrbar.js
Created December 21, 2011 19:11 — forked from scottjehl/hideaddrbar.js
Normalized hide address bar for iOS & Android
/*
* Normalized hide address bar for iOS & Android
* (c) Scott Jehl, scottjehl.com
* MIT License
*/
(function( win ){
var doc = win.document;
// If there's a hash, or addEventListener is undefined, stop here
if( !location.hash && win.addEventListener ){
@sjelfull
sjelfull / gist:1933432
Created February 28, 2012 16:20 — forked from croxton/gist:1931841
JSONP with ExpressionEngine - core hack
Currently you're stuck if you need to return JSONP from a EE template, because appending callback=? to your uri will make EE throw an Invalid Get Date error. In case you didn't know, JSONP is a great way to do cross-domain AJAX and let your EE website function as a web service.
To get round this restriction in EE 2.4 amend line 116 of /system/expressionengine/core/EE_Input.php from:
elseif (preg_match("#(;|\?|exec\s*\(|system\s*\(|passthru\s*\(|cmd\s*\(|[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})#i", $val))
To:
elseif (preg_match("#(;|\?\S+|exec\s*\(|system\s*\(|passthru\s*\(|cmd\s*\(|[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})#i", $val))
This still gives you protection against the use of ? in query strings to pass arguments, but allows you to append a ? to the very end of your query only - which is all we need.