Skip to content

Instantly share code, notes, and snippets.

View jgatjens's full-sized avatar
🏠
working from home!

Jairo Gätjens jgatjens

🏠
working from home!
View GitHub Profile
@jgatjens
jgatjens / require-conf.js
Created December 17, 2013 16:22
Using the shim for non-AMD libraries and cdn calls.
require.config({
paths: {
// use cdn default | fall back local copy
"jquery": [
'//cdnjs.cloudflare.com/ajax/libs/jquery/2.0.0/jquery.min.js',
'lib/jquery'
]
"backbone": "vendor/backbone",
"underscore": "vendor/underscore"
},
@jgatjens
jgatjens / direcory_tag.rb
Created February 10, 2014 22:03
jekyll-plugin loop_directory
#usage:
#{% loop_directory directory:images iterator:image filter:*.jpg sort:descending %}
# <img src="{{ image }}" />
#{% endloop_directory %}
module Jekyll
class LoopDirectoryTag < Liquid::Block
include Liquid::StandardFilters
Syntax = /(#{Liquid::QuotedFragment}+)?/
#!bash
#
# bash/zsh completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <[email protected]>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
#!bash
#
# git-flow-completion
# ===================
#
# Bash completion support for [git-flow](http://github.com/nvie/gitflow)
#
# The contained completion routines provide support for completing:
#
# * git-flow init and version
@jgatjens
jgatjens / server.js
Created September 22, 2014 02:13
server.js
'use strict';
var gulp = require('gulp');
var browserSync = require('browser-sync');
var httpProxy = require('http-proxy');
/* This configuration allow you to configure browser sync to proxy your backend */
var proxyTarget = 'http://server/context/'; // The location of your backend
var proxyApiPrefix = 'api'; // The element in the URL which differentiate between API request and static file request
@jgatjens
jgatjens / watchers.js
Created October 4, 2014 20:53
Angular total watchers
(function() {
var root = $(document.getElementsByTagName('body'));
var watchers = [];
var f = function(element) {
if (element.data().hasOwnProperty('$scope')) {
angular.forEach(element.data().$scope.$$watchers, function(watcher) {
watchers.push(watcher);
});
}
angular.forEach(element.children(), function(childElement) {
@jgatjens
jgatjens / gist:ac0a43d03cd35e111cb7
Last active July 17, 2016 21:41
lowercase filenames
for f in *; do mv "$f" "`echo $f | tr "[:upper:]" "[:lower:]"`"; done
@jgatjens
jgatjens / hook_xhr.js
Last active August 29, 2015 14:11
hook XHR object
// Modified XMLHttpRequest to add a listener for start and stop the progress bar
//
// Save the real open
var oldOpen = XMLHttpRequest.prototype.open;
function onStateChange() {
// fires on every readystatechange ever
// use `this` to determine which XHR object fired the change event
if (this.readyState === 1) {
@jgatjens
jgatjens / .htaccess
Last active August 29, 2015 14:17 — forked from ScottPhillips/.htaccess
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@jgatjens
jgatjens / config.json
Created March 21, 2015 16:05
Sublime Config
{
"caret_extra_bottom": 3,
"caret_extra_top": 3,
"caret_extra_width": 2,
"font_size": 13,
"highlight_line": true,
"ignored_packages":
[
"Vintage"
],