Skip to content

Instantly share code, notes, and snippets.

View leecade's full-sized avatar
🎯
Focusing

斯人 leecade

🎯
Focusing
View GitHub Profile
@leecade
leecade / clearfix.css
Created March 9, 2012 08:33
css:clearfix
.clearfix{ zoom: 1;}
.clearfix:before, .clearfix:after{ content: ""; display: table;}
.clearfix:after { clear: both;}
@leecade
leecade / tpl.html
Created March 9, 2012 08:41
html:tpl
<!DOCTYPE html>
<html>
<!-- <html lang="th"> -->
<head>
<meta charset="utf-8"/>
<!--
<meta name="keywords" content="key1, key2">
<meta name="description" content="des...">
<base target="_blank"></base>
-->
@leecade
leecade / hidetext.css
Created March 9, 2012 23:40
css:hidetext
.hidetext { text-indent: 100%; white-space: nowrap; overflow: hidden;}
.hidetext2 { font: 0/0 a; text-shadow: none; color: transparent;}
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal
@leecade
leecade / download.rb
Created March 26, 2012 02:38 — forked from jonforums/download.rb
Ruby HTTP/HTTPS/FTP file downloader
#!/usr/bin/env ruby
# An HTTP/HTTPS/FTP file downloader library/CLI based upon MiniPortile's
# HTTP implementation.
#
# Author: Jon Maken
# License: 3-clause BSD
# Revision: 2012-03-25 21:18:59 -0600
require 'net/http'
require 'net/https' if RUBY_VERSION < '1.9'
@leecade
leecade / perftimingdump.js
Created March 26, 2012 02:41 — forked from mattcg/perftimingdump.js
window.performance PerformanceTiming data dump
window.onload = function() {
window.setTimeout(function() {
var p = window.performance, t, output, ns;
if (!p || !p.timing) {
output = '<p>Sorry, you browser doesn\'t support the Navigation Timing API.</p>';
} else {
t = p.timing;
ns = t.navigationStart;
@leecade
leecade / README.md
Created March 27, 2012 13:06 — forked from necolas/README.md
Experimenting with component-based HTML/CSS naming and patterns

Template Components

Used to provide structural templates.

Pattern

t-template-name
t-template-name--modifier-name
t-template-name__subcomponent-name--subcomponent-modifier-name
@leecade
leecade / css-responsive-images.html
Created March 30, 2012 20:38 — forked from necolas/css-responsive-images.html
Idea for CSS-only responsive images using CSS3 generated content and attr() function. No browser implementation as of May 2011
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS responsive images</title>
<style>
/* Doesn't stop original source image being
downloaded too */
@media (min-device-width:600px) {

There seems to be a difference between longhand properties (e.g. background-color) and shorthand properties (e.g. background). Some CSS hacks only work for one or the other. I’ve updated my test case to test these separately, and there are some interesting results.

The following hacks target IE8 but not IE9:

  • longhandproperty: \0value\0;
  • longhandproperty: \0value;

In practice, you might use these like so:

  • background-color: \0red\0;
@leecade
leecade / gh-pages.md
Created April 7, 2012 19:00
Creating a clean gh-pages branch

Creating a clean gh-pages branch

This is the sequence of steps to follow to create a root gh-pages branch. It is based on a question at [SO]

cd /path/to/repo-name
git symbolic-ref HEAD refs/heads/gh-pages
rm .git/index
git clean -fdx
echo "My GitHub Page" &gt; index.html