Skip to content

Instantly share code, notes, and snippets.

View sebald's full-sized avatar
☀️
^⨀ᴥ⨀^

Sebastian Sebald sebald

☀️
^⨀ᴥ⨀^
View GitHub Profile
@sebald
sebald / print_a.php
Created November 5, 2011 11:24
better print(_r) function for debugging
<?php
function print_a(){
$numargs = func_num_args();
if($numargs>1){
$out = '';
ob_start();
echo "<div style='background-color:#FFCC33;border:1px solid black;margin:3px;padding:5px;'>";
for($a=0;$a<$numargs;$a++)
print_a(func_get_arg($a));
@sebald
sebald / latex_xml_style.tex
Created July 17, 2012 17:53
Latex Listing XML Style
\usepackage{listings}
\usepackage{color}
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}
\definecolor{gray}{rgb}{0.4,0.4,0.4}
\definecolor{darkblue}{rgb}{0.0,0.0,0.6}
\definecolor{lightblue}{rgb}{0.0,0.0,0.9}
\definecolor{cyan}{rgb}{0.0,0.6,0.6}
@sebald
sebald / _box-shadow.scss
Created September 11, 2012 20:52
SASS Mixin box-shadow
@mixin box-shadow($shadow) {
-webkit-box-shadow: #{$shadow};
-moz-box-shadow: #{$shadow};
box-shadow: #{$shadow};
}
@include box-shadow(0 3px 3px -2px rgba(0,0,0,0.6));
@include box-shadow("inset 0 2px 4px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.20)");
@sebald
sebald / Preferences.sublime-settings
Last active October 10, 2015 15:37
Sublime Settings
{
"auto_complete_selector": "source - comment, meta.tag - punctuation.definition.tag.begin",
"bold_folder_labels": true,
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
"default_line_ending": "unix",
"ensure_newline_at_eof_on_save": true,
"show_full_path": true,
"file_exclude_patterns":
[
"*.sublime-workspace",
@sebald
sebald / isDecNumber.js
Created October 2, 2012 13:38
Function to only allow decimal input
if(typeof isDecNumber != 'function'){
window.isDecNumber = function(e) {
// backspace, tab, enter, end, home, left, right
// we don't support the del key in Opera because del == . == 46.
var controlKeys = [8, 9, 13, 35, 36, 37, 39, 46]
// IE doesn't support indexOf
var isControlKey = controlKeys.join(",").match(new RegExp(e.which))
// some browsers just don't raise events for control keys. Easy.
// e.g. Safari backspace.
if (!e.which || // control keys in most browsers. e.g. Firefox tab is 0
describe('Element "Dropdown":', function () {
var scope, dropdownScope, element, $compile;
beforeEach( module('html.element.dropdown') );
beforeEach( module('html/element/dropdown.tpl.html') );
beforeEach( inject( function ( _$rootScope_, _$compile_ ) {
scope = _$rootScope_.$new();
$compile = _$compile_;
@sebald
sebald / Robust-getter-Fn.markdown
Created September 25, 2013 14:36
A Pen by Sebastian.

Robust getter Fn

Get property of an object no matther if it is deeply nested or doesn't even exist.

A Pen by Sebastian on CodePen.

License.

@sebald
sebald / gist:7917136
Last active December 31, 2015 01:49 — forked from dmajda/gist:7688943
Content =
all:(Element / Text)* {
return all.join("").replace(/\n$/, '');
}
Element =
startTag:StartTag content:Content endTag:EndTag {
if (startTag != endTag) {
throw new Error(
"Expected </" + startTag + "> but </" + endTag + "> found."
@sebald
sebald / breakpoint-mixin
Last active January 2, 2016 11:39
Lazy breakpoints and IE8 fallback for SCSS.
// Vars (I put these in a _globals.scss with all my other variables)
// ------------------------
$breakpointTiny: 580;
$breakpointSmall: 790;
$breakpointNormal: 1200;
// Breakpoint Mixin
// ------------------------
$oldie: false !default;
<snippet>
<content><![CDATA[
/** @requirement ${1:missing} */
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<!-- <tabTrigger>hello</tabTrigger> -->
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<!-- <scope>source.python</scope> -->
<description>Insert Requirements Comment</description>
</snippet>