Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View pdaoust's full-sized avatar

Paul d'Aoust pdaoust

View GitHub Profile
@pdaoust
pdaoust / SassMeister-input.scss
Created May 18, 2014 23:02
Generated by SassMeister.com.
// ----
// Sass (v3.3.7)
// Compass (v1.0.0.alpha.18)
// ----
@mixin extend($name) {
@if $extend and ($extend == advanced or length($corral-stack) == 0) {
$placeholder-name: "";
@if not map-has-key($placeholders, $name) {
$placeholders: map-merge($placeholders, ($name: ())) !global;
@pdaoust
pdaoust / SassMeister-input.scss
Created September 19, 2014 20:52
Generated by SassMeister.com.
// ----
// Sass (v3.4.4)
// Compass (v1.0.1)
// ----
@mixin corral($selector) {
$context: &;
$new-context: $context;
$root-context: '';
$selector-is-root-context: false;
@pdaoust
pdaoust / gist:1390208
Created November 23, 2011 23:11
augmenting Resourceful's Couchdb engine to allow insertion of new records without ID
Couchdb.prototype.post = function (doc, callback) {
return this.request('post', doc, function (e, res) {
if (e) return callback(e);
res.status = 201;
callback(null, res);
});
};
Couchdb.prototype.save = function (id, doc, callback) {
@pdaoust
pdaoust / gist:6055186
Created July 22, 2013 16:15
A simple radix(n) encoding function
var toRadix = (function () {
var chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_";
return function(N, radix) {
var HexN = "", Q = Math.floor(Math.abs(N)), R;
while (true) {
R = Q % radix;
HexN = chars.charAt(R) + HexN;
Q = (Q - R) / radix;
if (Q == 0) break;
}
@pdaoust
pdaoust / gist:6055193
Created July 22, 2013 16:16
Murmur hash in JavaScript
function murmurhash(key, seed) {
var remainder, bytes, h1, h1b, c1, c1b, c2, c2b, k1, i;
remainder = key.length & 3; // key.length % 4
bytes = key.length - remainder;
h1 = seed;
c1 = 0xcc9e2d51;
c2 = 0x1b873593;
i = 0;
@pdaoust
pdaoust / gist:6345649
Last active December 21, 2015 18:09
Unexpected behaviour with Sass nested selectors.
@mixin mini-link-reset {
&, &:hover, &:focus, &:active, &:visited {
color: inherit;
text-decoration: none;
}
}
a {
@include mini-link-reset;
color: red; /* Whoa, buddy, how did you get up there? */
@pdaoust
pdaoust / gist:7087521
Last active December 26, 2015 03:39
Example SVG file for Fontello
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
x="0px"
y="0px"
width="16"
height="16"
viewBox="0 0 16 16"
@pdaoust
pdaoust / warn.scss
Created November 15, 2013 17:27
Very very long SCSS file with two warnings for each rule -- testing Koala's error reporting
@mixin warn-mixin {
@warn "warning";
color: green;
}
@function warn-func() {
@warn "warning ";
@return null;
}
@pdaoust
pdaoust / SassMeister-input.scss
Created December 5, 2013 23:03
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.1)
// Compass (v0.13.alpha.10)
// ----
// Filter items from a list. Each function takes an item (and additional
// arguments) and returns a boolean value indicating whether the item passed the
// filter.
@function f-filter($func, $list, $args...) {
$new-list: ();
@pdaoust
pdaoust / SassMeister-input.scss
Created December 5, 2013 23:09
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.1)
// Compass (v0.13.alpha.10)
// ----
@function f-fold($func, $list, $initial, $args...) {
$start: 1;
@if $initial == null {
// If there's no initial value, use the first in the list.
$start: 2;