Skip to content

Instantly share code, notes, and snippets.

View zigotica's full-sized avatar

Sergi Meseguer zigotica

View GitHub Profile

Creating a new element named picture or pic that mirrors the img element would allow for an easier responsive image element to polyfill.

When polyfilling srcN paired with the image element, legacy browsers which don't support srcN would download the image from the src attr and the matching srcN attr. This would result in dual downloads in legacy browser which need the srcN polyfill. These "legacy browsers" are every browser today.

A few ways around this would be to leave the img src attr empty. Or remove it all togher.

From Riloadr docs, Túbal Martín has some concerning notes about leaving the src attr empty on img elements.

Warning!: >Do not set an empty string for the value of src src="".

@dpup
dpup / if-github-up.sh
Created December 11, 2012 19:30
Script that checks if GitHub is up before running a command
#!/bin/bash
#
# Script that checks GitHub's status API before continuing. If GitHub does not return "good" then
# you will be prompted whether you want to continue.
#
# Information messages are echoed to stderr so it is still possible to pipe the results of stdout to
# a file.
#
# Example Usage:
# $ if-github-up make clean
@mrmamba
mrmamba / archive.sh
Created December 11, 2012 11:12
Archivado Drobpx
#!/bin/bash
retencion=31
fecha=`date +"%m%d%y"`
cd /root/Dropbox
/bin/tar cjf web.tar.bz2 web/
mv web.tar.bz2 archive/$fecha.bz2
find /root/Dropbox/archive/*.bz2 -mtime +$retencion -exec rm {} \;
@bomberstudios
bomberstudios / emoji-prompt.sh
Created October 4, 2012 09:32
El prompt de bash definitivo...
##### EXEC ###################################################################
# $ brew install bash-completion
if [ -f `brew --prefix`/etc/bash_completion ]; then
. `brew --prefix`/etc/bash_completion
fi
# brew git-completion
export GIT_PS1_SHOWDIRTYSTATE="true"
export GIT_PS1_SHOWSTASHSTATE="true"
export GIT_PS1_SHOWUNTRACKEDFILES="true"
@leostratus
leostratus / webkit-pseudo-elements.md
Created September 21, 2012 01:44
Webkit Pseudo-Element Selectors (Shadow DOM Elements)

An ongoing project to catalogue all of these sneaky, hidden, bleeding edge selectors as I prepare my JSConf EU 2012 talk.

Everything is broken up by tag, but within each the selectors aren't particularly ordered.

I have not tested/verified all of these. Have I missed some or got it wrong? Let me know. - A

A friendly reminder that you may need to set this property on your target/selected element to get the styling results you want:

-webkit-appearance:none;

@ctalkington
ctalkington / grunt.js
Created September 12, 2012 02:44
Grunt Glob to Multi Files Object
// gruntfile dropin used to build a grunt files object with 1:1 structure
function globToMultiFiles(glob, dest, options) {
var path = require('path');
grunt.util = grunt.util || grunt.utils;
dest = grunt.template.process(dest);
options = grunt.util._.defaults(options || {}, {
cwd: '',
@chriseppstein
chriseppstein / 0_selector_hacks.scss
Created September 14, 2011 04:27
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"); }
}
@scottjehl
scottjehl / anchorinclude.js
Created May 20, 2011 17:04
Anchor-include Pattern
/*
* anchor-include pattern for already-functional links that work as a client-side include
* Copyright 2011, Scott Jehl, scottjehl.com
* Dual licensed under the MIT
* Idea from Scott Gonzalez
* to use, place attributes on an already-functional anchor pointing to content
* that should either replace, or insert before or after that anchor
* after the page has loaded
* Replace: <a href="..." data-replace="articles/latest/fragment">Latest Articles</a>
* Before: <a href="..." data-before="articles/latest/fragment">Latest Articles</a>