Skip to content

Instantly share code, notes, and snippets.

@aristretto
aristretto / cssdevconf2014resources.md
Last active August 29, 2015 14:07
CSSDevConf 2014 Resources (a partial list).

Resources & cool Links

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23/12/2008
  • Revised date: 13/08/2014 by @aristretto
  • Original post

// Create REM values with PX fall back
//
// Generate a REM with PX fallback from
// $baseFontSize. Enter the desired size based
// on pixels in numerical form. Supports shorthand.
//
// Forked from: http://codepen.io/thejameskyle/pen/JmBjc
//
// @author Greg Rickaby
// @since 1.0
@aristretto
aristretto / mixin.transparent-bg-color.scss
Created April 23, 2014 21:06
sass - mixin - transparent background color with IE support
@mixin transparent($color, $alpha) {
$rgba: rgba($color, $alpha);
$ie-hex-str: ie-hex-str($rgba);
background-color: transparent;
background-color: $rgba;
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#{$ie-hex-str},endColorstr=#{$ie-hex-str});
zoom: 1;
}
@aristretto
aristretto / base 64 convert
Created April 10, 2014 05:46
cmd line convert image to base64 and copy to clipboard
cat /path/to/img.png | openssl base64 | tr -d '\n' | pbcopy
var arr = [1,1,2];
var arr = arr.filter(function (v, i, a) { return a.indexOf (v) == i }); // dedupe array
@aristretto
aristretto / clean.js
Created March 21, 2014 21:16
Array.prototype.clean
Array.prototype.clean = function(deleteValue) {
for (var i = 0; i < this.length; i++) {
if (this[i] == deleteValue) {
this.splice(i, 1);
i--;
}
}
return this;
};
@aristretto
aristretto / counters.css
Last active December 17, 2015 13:09
CSS Counters, basic tidbits
/*
* more helpful links
* http://www.w3.org/TR/CSS2/generate.html#scope
* http://quirksmode.org/css/css2/counter.html
* http://www.impressivewebs.com/css-counter-increment/
*/
/* decimal counters (basic, default) */
@aristretto
aristretto / placeholder.scss
Last active December 14, 2015 22:39 — forked from antsa/placeholder.scss
A mixin to style placeholders in HTML5 form elements. Requires Sass 3.2.
$placeholders: '-webkit-input-placeholder',
'-moz-placeholder',
'-ms-input-placeholder';
@mixin placeholder {
@each $placeholder in $placeholders {
@if $placeholder == "-webkit-input-placeholder" {
&::#{$placeholder} {
@content;
@aristretto
aristretto / truncateURI.js
Last active December 12, 2015 10:19
The purpose of this ditty is to truncate URIs in a more elegant way. ** I'm not a regex pro, be gentle :)
// truncate URIs in a more elegant way
String.prototype.truncateURI = function(n, backup){
var len = this.length;
var self = this.toString();
var max_len = (n||30);
var fallback = (backup||"website")
var patt = /^(https?\:\/\/)?(www\.)?([a-z0-9\-\_]+)([a-z\.]{2,})+([a-z0-9\-\_\#\/ ]+\/)?([a-z0-9\-\_\#\/]+\.?[a-z0-9]+)?/i
/*** PATTERN BREAKDOWN ***