Skip to content

Instantly share code, notes, and snippets.

View quoidautre's full-sized avatar

Dark Passenger quoidautre

View GitHub Profile
@quoidautre
quoidautre / gist:2192579
Created March 25, 2012 09:37
LESSCSS: background with LessCss
.backgrounds(@img,@w,@h,@t,@c,@repeat:no-repeat,@color:transparent, @folder:images) {
background : @color url("../@{folder}/@{img}") @t @c @repeat;
width : @w;
height : @h;
}
@quoidautre
quoidautre / gist:2203635
Created March 26, 2012 07:13
LESSCSS: font-face
@font-face {
font-family: 'OpenSans-Bold';
src: url('../fonts/OpenSans-Bold.ttf');
font-weight: normal;
font-style: normal;
}
.fonts (@the-font:"OpenSans-CondLight",@size:14px) {
font-weight: normal;
font-style: normal;
@quoidautre
quoidautre / gist:2203640
Created March 26, 2012 07:15
LESSCSS: Shadow border
.shadow-border(@background-color : #C5EFFD, @left : 3px , @bottom : 3px, @height : 2px ) {
box-shadow: @left @bottom @height @background-color;
-moz-box-shadow: @left @bottom @height @background-color;
-webkit-box-shadow: @left @bottom @height @background-color;
-o-box-shadow: @left @bottom @height @background-color;
}
@quoidautre
quoidautre / gist:2203642
Created March 26, 2012 07:15
LESSCSS: No shadow border
.no-shadow-border {
box-shadow: none;
-moz-box-shadow: none;
-webkit-box-shadow: none;
-o-box-shadow: none;
}
@quoidautre
quoidautre / gist:2203644
Created March 26, 2012 07:16
LESSCSS: Columns
columns(@nb-column : 3, @gap : 20px, @margintop : 10px, @rule-color : #ccc, @rule-style : dashed, @rule-width : 1px ) {
margin : @margintop 0;
-moz-column-count : @nb-column;
-moz-column-gap : @gap;
-webkit-column-count : @nb-column;
-webkit-column-gap : @gap;
-moz-column-rule-color: @rule-color;
-moz-column-rule-style: @rule-style ;
-moz-column-rule-width: @rule-width;
-webkit-column-rule-color: @rule-color;
@quoidautre
quoidautre / gist:2203648
Created March 26, 2012 07:17
LESSCSS: Rounded corner
.rounded(@radius: 7px) {
-webkit-border-radius: @radius;
-moz-border-radius: @radius;
-o-border-radius: @radius;
border-radius: @radius;
}
@quoidautre
quoidautre / gist:2308678
Created April 5, 2012 07:07
JS: SetInterval() with parameter(s)
if ($('.wrapper-slider-home').is('*')) {
setInterval( function() { slideSwitch(".wrapper-slider-home");}, 2000 );
};
function slideSwitch(wrapper) {
...
}
@quoidautre
quoidautre / gist:2308776
Created April 5, 2012 07:35
JS: Ajax pattern
var ajaxPattern = (function($){
return {
requestAjax: function(params){
var settings = $.extend({
url : '',
spinner : undefined,
form : '',
dataType : 'json',
cache : false,
type : 'POST',
@quoidautre
quoidautre / gist:2308786
Created April 5, 2012 07:36
JS: Add dynamic css file
function adddynamiccssfile(filename) {
if (filename != "") {
var headID = document.getElementsByTagName("head")[0];
var cssNode = document.createElement('link');
cssNode.type = 'text/css';
cssNode.rel = 'stylesheet';
cssNode.href = filename;
cssNode.media = 'screen';
headID.appendChild(cssNode);
}
@quoidautre
quoidautre / gist:2308788
Created April 5, 2012 07:37
JS: Remove dynamic css file
function removedynamicjscssfile(filename, filetype){
if (filename != "" && filetype != "" ) {
var targetelement=(filetype=="js")? "script" : (filetype=="css")? "link" : "none" //determine element type to create nodelist from
var targetattr=(filetype=="js")? "src" : (filetype=="css")? "href" : "none" //determine corresponding attribute to test for
var allsuspects=document.getElementsByTagName(targetelement)
for (var i=allsuspects.length; i>=0; i--){ //search backwards within nodelist for matching elements to remove
if (allsuspects[i] && allsuspects[i].getAttribute(targetattr)!=null && allsuspects[i].getAttribute(targetattr).indexOf(filename)!=-1)
allsuspects[i].parentNode.removeChild(allsuspects[i]) //remove element by calling parentNode.removeChild()
}
}