Skip to content

Instantly share code, notes, and snippets.

View sidonaldson's full-sized avatar
🐢
I like turtles

Simon Donaldson sidonaldson

🐢
I like turtles
View GitHub Profile
@sidonaldson
sidonaldson / Stylus override margin and padding with default variables
Last active December 30, 2015 21:01
This stylus mixin overrides the default CSS margin and padding properties so that you can pass size strings such as 'xl' etc
margin-xs := 0.2rem
margin-s := 0.4rem
margin-m := 0.6rem
margin-l := 1rem
margin-xl := 10rem
padding-xs := 0.2rem
padding-s := 0.4rem
padding-m := 0.6rem
padding-l := 1rem
padding-xl := 1.5rem
@sidonaldson
sidonaldson / tame-tinymce.php
Created October 30, 2015 11:36
This snippet will tame TinyMCE within Wordpress and prevent it trying to clean up the code and reformat it. Specifically helps to prevent wordpress strip p tags and line-breaks and stops it from inserting nbsp etc
function mce_mod( $init ) {
$init['forced_root_block'] = 'p';
$init['apply_source_formatting'] = false;
$init['preformatted'] = true;
$init['force_br_newlines'] = true;
$init['wpautop'] = false;
return $init;
}
add_filter('tiny_mce_before_init', 'mce_mod', 99);
@sidonaldson
sidonaldson / sample.jshintrc
Created September 8, 2015 11:50
Generic .jshintrc file
{
"node": true, // Enable globals available when code is running inside of the NodeJS runtime environment.
"browser": true, // Standard browser globals e.g. `window`, `document`.
"esnext": true, // Allow ES.next specific features such as `const` and `let`.
"bitwise": false, // Prohibit bitwise operators (&, |, ^, etc.).
"camelcase": false, // Permit only camelcase for `var` and `object indexes`.
"curly": false, // Require {} for every new block or scope.
"eqeqeq": true, // Require triple equals i.e. `===`.
"immed": true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );`
"latedef": true, // Prohibit variable use before definition.
@sidonaldson
sidonaldson / sample.editorconfig
Last active November 23, 2015 17:33
Generic .editorconfig file
# This is the root editor config file
root = true
# Apply rules to all files
[*]
# Use unix line endings
end_of_line = lf
insert_final_newline = true
@sidonaldson
sidonaldson / disable_overscroll.css
Last active August 29, 2015 14:27
Disable 'overscroll'
html {
overflow: hidden;
height: 100%;
}
body {
height: 100%;
overflow: auto;
}
@sidonaldson
sidonaldson / dabblet.css
Last active August 29, 2015 14:09
SVG and CSS Gradient background
/**
* SVG and CSS Gradient background
*/
html,body{
padding:0;
margin:0;
height:100%;
background-color:#000;
}
body{
div{
height:300px;width:300px;background:red;
-webkit-mask-position: 0 0;
-webkit-mask-size: 100%;
-webkit-mask-image: -webkit-gradient(linear, left top, right bottom,
color-stop(0.00, rgba(0,0,0,1)),
color-stop(0.50, rgba(0,0,0,1)),
color-stop(0.50, rgba(0,0,0,0)),
color-stop(1.00, rgba(0,0,0,0)));
}
div{
height:300px;width:300px;background:red;
-webkit-clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 50%);
clip-path: polyg-webkit-on(0% 0%, 100% 0%, 100% 100%, 0% 50%);
}
div{
height:300px;width:300px;background:red;
-webkit-clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 50%);
clip-path: polyg-webkit-on(0% 0%, 100% 0%, 100% 100%, 0% 50%);
}
div{
height:300px;width:300px;background:red;
-webkit-clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 50%);
clip-path: polyg-webkit-on(0% 0%, 100% 0%, 100% 100%, 0% 50%);
}