Skip to content

Instantly share code, notes, and snippets.

View jpsirois's full-sized avatar
🤙

Jean-Philippe Sirois jpsirois

🤙
View GitHub Profile
@jpsirois
jpsirois / real_document_root.php
Created June 3, 2010 15:53
Always Return the current file "real document root" in PHP
<?
# This return the current file "real document root"
$root = str_replace($_SERVER['SCRIPT_NAME'],'',$_SERVER['SCRIPT_FILENAME']).'/';
?>
@jpsirois
jpsirois / jquery.clearTypeFix.fade.js
Created June 24, 2010 13:29
jQuery Fade ClearType Fix
/*******************************************************************************************************************
@file jquery.clearTypeFix.fade.js
@function Custom FadeIn/FadeOut/FadeTo : Fix IE ClearType
@source http://blog.bmn.name/2008/03/jquery-fadeinfadeout-ie-cleartype-glitch/comment-page-1/#comment-123
********************************************************************************************************************/
jQuery.fn.clearTypeFadeTo = function(options) {
if (options)
$(this)
.show()
@jpsirois
jpsirois / custom-initial-and-blockquote.html
Created December 16, 2010 15:13
Custom Initial and Blockquote (Cross-Browser except IE8 and lower)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Custom Initial and Blockquote (Cross-Browser except IE8 and lower)</title>
<style>
/* Reset {{{ */
/*
html5doctor.com Reset Stylesheet
@jpsirois
jpsirois / remove-bom-signature.zsh
Created January 25, 2012 14:28
Recursive Bom Signature Finder/Remover with Vim
alias findbom="grep -orHbm1 \"^`echo -ne '\xef\xbb\xbf'`\" . | sed '/:0:/!d;s/:0:.*//'"
alias removebom="grep -orHbm1 \"^`echo -ne '\xef\xbb\xbf'`\" . | sed '/:0:/!d;s/:0:.*//' | xargs vim -u NONE +'argdo se nobomb | wq'"
@jpsirois
jpsirois / plain-text-parser.php
Created June 1, 2012 15:36
Render any URL as Text/HTML (proof of concept)
<?
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, htmlspecialchars($_GET['URL']));
curl_exec($ch);
curl_close($ch);
?>
@jpsirois
jpsirois / index.html
Created August 21, 2012 19:18
Dead Simple CSS Only Custom-Select (fallback to standard <select> for IE7 and below)
<!DOCTYPE html>
<!--[if lt IE 8]><html class="lt-ie8" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--><html lang="en"><!--<![endif]-->
<head>
<meta charset="UTF-8" />
<title>Dead Simple Cross-Browser Custom-Select</title>
<style>
body {
@jpsirois
jpsirois / fiddle.css
Created August 22, 2012 12:16
CSS :before without getting the text-decoration
body {
margin: 2em;
}
a {
display: inline-block;
margin-bottom: 1em;
position: relative;
border-bottom: 1px solid black;
text-decoration: none;
@jpsirois
jpsirois / fiddle.css
Created August 22, 2012 12:28
CSS Only cross-browser element Height proportional scale based on Width
h1,h2,h3{ font-weight: bold; font-family: Helvetica, Arial, sans-serif; margin: 0 0 .25em; }
h1 { font-size: 30px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p { margin: 0 0 1em; }
#container {
width:100%;
max-width:600px;
}
@jpsirois
jpsirois / Guardfile
Last active October 11, 2015 04:07
Guardfile Exemple
guard 'shell' do
watch(/(^src\/haml\/(.+)\.haml)/) do |match|
puts match[0] + " changed at " + Time.now.strftime("%H:%M:%S") +". Re-generating HTML from HAML"
`haml #{match[1]} #{match[2]}.html`
`terminal-notifier -group 'haml' -title 'Regenerating Coffeescript' -message '#{match[0]}'`
end
watch(/(^src\/sass\/.+)/) do |match|
puts match[0] + " changed at " + Time.now.strftime("%H:%M:%S") +". Re-generating CSS from SASS."
`Compass compile`
@jpsirois
jpsirois / compass-retina-sprites.scss
Created October 24, 2012 18:45 — forked from michsch/compass-retina-sprites.scss
Using Compass to generate normal and retina sprite maps
$sprites: sprite-map("sprites/*.png");
$sprites-retina: sprite-map("sprites-retina/*.png");
@mixin sprite-background($name) {
background-image: sprite-url($sprites);
background-position: sprite-position($sprites, $name);
background-repeat: no-repeat;
display: block;
height: image-height(sprite-file($sprites, $name));
width: image-width(sprite-file($sprites, $name));