Skip to content

Instantly share code, notes, and snippets.

View cristianferrarig's full-sized avatar

Cristian Ferrari cristianferrarig

  • VOLTΛ
  • Stgo, Chile
View GitHub Profile

Pure CSS content filter

I saw some JS filter setups, so naturally I had to see if I could make a CSS one. Pretty simple.

A Pen by Sam Gordon on CodePen.

License.

@hdragomir
hdragomir / index.html
Created July 7, 2014 09:48
IIFE version of SM Font Loading
<script type="text/javascript">
(function (css_href) {
"use strict";
// a simple event handler wrapper
function on(el, ev, callback) {
if (el.addEventListener) {
el.addEventListener(ev, callback, false);
} else if (el.attachEvent) {
el.attachEvent("on" + ev, callback);
@hdragomir
hdragomir / sm-annotated.html
Last active March 5, 2024 08:57
The deferred font loading logic for Smashing Magazine. http://www.smashingmagazine.com/
<script type="text/javascript">
(function () {
"use strict";
// once cached, the css file is stored on the client forever unless
// the URL below is changed. Any change will invalidate the cache
var css_href = './index_files/web-fonts.css';
// a simple event handler wrapper
function on(el, ev, callback) {
if (el.addEventListener) {
el.addEventListener(ev, callback, false);
@lttlrck
lttlrck / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@bomberstudios
bomberstudios / sketch-plugins.md
Last active February 26, 2024 07:02
A list of Sketch plugins hosted at GitHub, in no particular order.
@polarblau
polarblau / extract_colors.rb
Last active December 29, 2015 02:19
Extract all colors with Ruby from a stylesheet.
css = IO.read('application.css')
# find all hex color values
hex = css.scan(/#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})/).flatten.map(&:strip)
# convert the short code colors into long versions
hex.map! { |color| color.length == 3 ? (c = color.split('')).zip(c).join : color }
# find all rgb and rgba color values
rgb = css.scan(/(rgba?\(\d+,\s*\d+,\s*\d+(?:,\s*\d+(?:\.\d+)?)?\))/).flatten
@backflip
backflip / config.rb
Last active July 11, 2017 14:53
Using Redcarpet and Middleman Syntax for Markdown and HAML files
class CustomMarkdown < Middleman::Extension
$markdown_options = {
autolink: true,
fenced_code_blocks: true,
no_intra_emphasis: true,
strikethrough: true,
tables: true,
hard_wrap: true,
with_toc_data: true
}
@adamico
adamico / simple_form_bootstrap.rb
Created August 30, 2013 09:06
Twitter Bootstrap 3 initializer for Simple Form
# Use this setup block to configure all options available in SimpleForm.
SimpleForm.setup do |config|
# you need an updated simple_form gem for this to work, I'm referring to the git repo in my Gemfile
config.input_class = "form-control"
config.wrappers :bootstrap, tag: 'div', class: 'form-group', error_class: 'error' do |b|
b.use :html5
b.use :placeholder
b.use :label
b.use :input
@mrrooijen
mrrooijen / hackintosh-reminder.md
Last active December 21, 2015 06:38
My Hackintosh Requirements
@polarblau
polarblau / baseline.sass
Last active December 19, 2015 04:59
Simple Sass helper for baseline grid value calculations.
// set base font size if not set
// normalize.css standard value
$base-font-size: 16px !default
// define scope font size to make it available globally
$__scope: $base-font-size
@function relative($arguments)
// ensure that the scope size is set
$__scope: $base-font-size !default