Skip to content

Instantly share code, notes, and snippets.

View msikma's full-sized avatar
🐛
Writing bugs

Michiel Sikma msikma

🐛
Writing bugs
View GitHub Profile
@msikma
msikma / set-states.scss
Last active August 29, 2015 14:08
Set container pseudo-selector states
@mixin set-states($states) {
$selector: ();
@for $i from 1 through length($states) {
$selector: append($selector, unquote("&:#{nth($states, $i)}"), comma);
}
#{$selector} {
@content;
}
}
@msikma
msikma / select-php-var.php
Created November 3, 2014 13:20
Select PHP variable
<?php
// select php variable (more or less)
$sel_php_var = '\$([^\s,.;=*+\-&~%-+|)]*)';
@msikma
msikma / gmail-colors.txt
Created November 3, 2014 13:23
Old Gmail label color swatches
light blue green #DEF9F2
light blue 2 #E0ECFF
light blue 3 #DFE2FF
lavender #E0D5F9
light pink #FDE9F4
light pink 2 #FFE3E3
gray blue #5A6986
bright blue #206CFF
blue #0000CC
purple #5229A3
@msikma
msikma / img-load-cb.js
Created November 3, 2014 13:27
jQuery Image load callback (IE6 compatible)
// requires jQuery 1.x
// image load callback that is compatible with IE6
var $img = $('.some-selector img');
var isIE6 = jQuery.browser.msie && parseInt(jQuery.browser.version) == 6;
$img.one("load", function()
{
/*
image load event code goes here
@msikma
msikma / aural-only.scss
Created January 12, 2015 22:07
CSS class to hide text for everything except screen readers
// Class to hide something except on aural browsers/screen readers.
// Just setting display: none does not work, since then it hides the item
// on aural browsers too.
// This set of attributes appear to have good results, but feedback
// from users of screen readers is always appreciated.
.aural-only {
height: 1px;
margin: -1px;
clip: rect(0px, 0px, 0px, 0px);
border: none;
@msikma
msikma / all_countries.json
Created January 13, 2015 09:56
List of all countries – as per ISO 3166-1, up-to-date as of 2015-01-13
{
"AT": "Austria",
"BE": "Belgium",
"BG": "Bulgaria",
"HR": "Croatia",
"CY": "Cyprus",
"CZ": "Czech Republic",
"DK": "Denmark",
"EE": "Estonia",
"FI": "Finland",
@msikma
msikma / jscs-without-es6-jsx.js
Created January 14, 2015 23:27
jscs configuration that excludes es6/jsx
// JSCS - for testing code style.
jscs: {
options: {
config: 'jscs.json',
},
gruntfile: {
src: ['gruntfile.js']
},
// es6 and jsx are not testable yet.
src: {
@msikma
msikma / SassMeister-input.scss
Created February 7, 2015 19:36
Generated by SassMeister.com.
// ----
// libsass (v3.1.0-beta)
// ----
@mixin pulsate($animation-name, $start-size: 0.75, $end-size: 1, $duration: 1.5s) {
@keyframes #{$animation-name} {
0% { transform: scale($start-size); }
50% { transform: scale($end-size); }
100% { transform: scale($start-size); }
}
@msikma
msikma / SassMeister-input.scss
Created June 23, 2015 14:42
Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
// Hide My Ass <https://www.hidemyass.com/>
// Copyright (C) 2005-2015, Privax Ltd.
$payments: "avangate_bank", "avangate_cashu", "avangate_webmoney", "avangate_qiwi", "avangate_boleto",
"avangate_sofort", "avangate_cc", "adyen_cc", "adyen_ideal", "onebip", "mopay", "bitpay", "paypal";
@msikma
msikma / es6-styles.js
Created July 22, 2015 11:38
Which of these styles is nicer?
/**
* Returns server environment information and copyright. This is intended
* only to be displayed inside of a terminal.
*
* @returns {String} Copyright and server environment information
*/
function getServerInfo() {
const engineName = process.title == 'node' ? 'Node.js'
: process.title == 'iojs' ? 'io.js' : '(unknown engine)';
const engineVersion = process.title + ' v' + process.versions.node;