Skip to content

Instantly share code, notes, and snippets.

View stoeffel's full-sized avatar
🦔

Christoph Hermann stoeffel

🦔
View GitHub Profile
/*
* Copyright (c) 2010 Tobias Schneider
* This script is freely distributable under the terms of the MIT license.
*/
(function(){
var UPC_SET = {
"3211": '0',
"2221": '1',
"2122": '2',
@stoeffel
stoeffel / gist:5362083
Created April 11, 2013 09:47
matte and recessed background gradient mixin for compass. Like Sencha uses it.
@mixin matte-bg($color,$direction:"top") {
$experimental-support-for-svg: true;
@include background(linear-gradient($direction, color_stops(lighten($color, 3%), darken($color, 4%))));
}
@mixin reccessed-bg($color,$direction:"top") {
$experimental-support-for-svg: true;
@include background-image(linear-gradient($direction, color_stops(darken($color, 10%), darken($color, 5%) 10%, $color 65%, lighten($color, .5%))));
}
@stoeffel
stoeffel / switch between folders
Last active August 29, 2015 14:00
switch between folders (i.e between view and controller in a MVC app)
" Example
" app/view/User.js
" switch to app/controller/User.js
function! SwitchBetween(from, to)
" TODO check if file exists
let firstPath = RemoveWDFromPath(expand('%:p'))
if match(firstPath, '\/'.a:from.'\/') != -1
let first = a:from
let sec = a:to
@stoeffel
stoeffel / javascript function text-object for vim
Created May 9, 2014 15:17
javascript function text-object for vim
function! TextObjectFunction()
normal! ]}%
execute "normal ?function\<CR>"
normal! vf{%
endfunction
vnoremap af :<C-U>silent! :call TextObjectFunction()<CR>
omap af :normal vaf<CR>
@stoeffel
stoeffel / extjs5-bind-emptyText.js
Last active August 29, 2015 14:02
extjs5 bind emptytext (ViewModel)
// bind needs a getter to update the property.
// emptytext has no setter. So you need to create one
Ext.define('Override.Textfield', {
override: 'Ext.form.field.Text',
setEmptyText: function(emptyText) {
this.emptyText = emptyText;
this.applyEmptyText();
}
});
@stoeffel
stoeffel / isCleanRepo.sh
Created August 6, 2014 06:55
check if repos are up to date
#!/bin/bash
find . -type d 2>/dev/null | grep -v node_modules | while read d; do
if [ -d "$d/.git" ]; then
if [ ! -z "$(git -C $d status --porcelain)" ]; then
echo $d;
fi
fi
done
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
function one() {
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
function one() {
<!DOCTYPE html>
<html>
<head>
<script src="http://jashkenas.github.io/underscore/underscore-min.js"></script>
<script type="text/javascript">
!function(e,n){"use strict";function r(e,n){var r,t,u=e.toLowerCase();for(n=[].concat(n),r=0;n.length>r;r+=1)if(t=n[r]){if(t.test&&t.test(e))return!0;if(t.toLowerCase()===u)return!0}}var t=n.prototype.trim,u=n.prototype.trimRight,i=n.prototype.trimLeft,l=function(e){return 1*e||0},o=function(e,n){if(1>n)return"";for(var r="";n>0;)1&n&&(r+=e),n>>=1,e+=e;return r},a=[].slice,c=function(e){return null==e?"\\s":e.source?e.source:"["+g.escapeRegExp(e)+"]"},s={lt:"<",gt:">",quot:'"',amp:"&",apos:"'"},f={};for(var p in s)f[s[p]]=p;f["'"]="#39";var h=function(){function e(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}var r=o,t=function(){return t.cache.hasOwnProperty(arguments[0])||(t.cache[arguments[0]]=t.parse(arguments[0])),t.format.call(null,t.cache[arguments[0]],arguments)};return t.format=function(t,u){var i,l,o,a,c,s,f,p=1,g=t.length,d="",m=[];f
(function() {
"use strict";
var lib$helpers$to_string$$toString = Object.prototype.toString;
function lib$helpers$str_repeat$$strRepeat(str, qty) {
if (qty < 1) return '';
var result = '';
while (qty > 0) {
if (qty & 1) result += str;
qty >>= 1, str += str;
}