Skip to content

Instantly share code, notes, and snippets.

View ifthenelse's full-sized avatar
🏎️
LIFE BE LIKE

Andrea Collet ifthenelse

🏎️
LIFE BE LIKE
View GitHub Profile
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Page title</title>
<link rel="stylesheet" type="text/css" href="css/style.css" />
</head>
<body>
@ifthenelse
ifthenelse / post-checkout
Last active August 29, 2015 14:04
A hook script to switch between parameters files when checking out different branches of the same Symfony2 repo
#!/bin/sh
#
# A hook script to switch between parameters files when checking out different branches of the same Symfony2 repo
#
# To enable this hook, rename this file to "post-checkout".
PREVIOUS_HEAD=$1
NEW_HEAD=$2
BRANCH_SWITCH=$3
@ifthenelse
ifthenelse / sticky.js
Last active August 29, 2015 14:10 — forked from chriskoelle/sticky.js
Add an affix behavior to an element, by keeping it sticky between 2 elements.
;(function($) {
$.fn.extend({
stickyWidget: function(options) {
// Exit if there are no elements to avoid errors:
if (this.length === 0) {
return this;
}
var settings = $.extend({
@ifthenelse
ifthenelse / _equal-display-inline-block-width.scss
Created May 14, 2015 15:04
Dynamically set inline-block elements equal width based on items length
@for $i from 1 through 10 {
/* #{$i} item(s) */
.box-ballooned-item:first-child:nth-last-child(#{$i}),
.box-ballooned-item:first-child:nth-last-child(#{$i}) ~ .box-ballooned-item {
max-width: floor(100% / $i);
}
}
{
"folders":
[
{
"follow_symlinks": true,
"path": ".",
"folder_exclude_patterns": [
".sass-cache",
".bundles",
"node_modules",
@ifthenelse
ifthenelse / shell_snippets.sh
Created July 7, 2015 13:15
List of shell snippets
# Assuming the existence of a list of url, in a text file, get the file size of each url target (in Kb)
cat urls.txt | xargs -n 1 curl -sI | grep Content-Length | awk '{print $2/1000}'
@ifthenelse
ifthenelse / setCSSClasses
Created July 9, 2012 09:47
A function to set CSS classes to an html element such as "first", "last", "odd", "even" and "active"
<?php
/* Sets classes such as "first", "last", "odd", "even" and "active"
* @param $articles An array of articles to count
* @param $index The index to watch for
* @param $currentArticle The index of the current article
* @return string
**/
function setCSSClasses($index = null, $articles = null, $currentArticle = null) {
@ifthenelse
ifthenelse / gist:3974067
Created October 29, 2012 15:08
CSS Cross-browser opacity
opacity: .75;
filter: alpha(opacity=75);
-ms-filter: "alpha(opacity=75)";
-khtml-opacity: .75;
-moz-opacity: .75;
@ifthenelse
ifthenelse / whichTransitionEvent.js
Last active December 16, 2015 12:18
Use modernizr to check CSS transitions events support: * 'WebkitTransition':'webkitTransitionEnd' (Chrome / Safari) * 'MozTransition':'transitionend' (Mozilla) * 'OTransition':'oTransitionEnd' (Opera) * 'transition':'transitionend' (Internet Explorer)
function whichTransitionEvent(){
var t;
var el = document.createElement('fakeelement');
var transitions = {
'transition':'transitionend',
'OTransition':'oTransitionEnd',
'MozTransition':'transitionend',
'WebkitTransition':'webkitTransitionEnd'
}
/**
* This casper scipt checks for 404 internal links for a given root url.
*
* Usage:
*
* $ casperjs 404checker.js http://mysite.tld/
* $ casperjs 404checker.js http://mysite.tld/ --max-depth=42
*/
/*global URI*/