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 / module.js
Created January 18, 2016 14:03
RequireJS, Node, as a plain script, and CommonJS
if (typeof module != 'undefined' && module.exports) {
module.exports = bbArray;
} else if (typeof define === "function" && define.amd) {
define("bbArray", [], function() {
return bbArray;
});
} else {
global.bbArray = bbArray;
}
@jgatjens
jgatjens / gulpfile.babel.js
Last active August 29, 2015 14:27
Include es6 in your gulpfile.babel.js
// npm install gulp-util --save
import gulpLoadPlugins from 'gulp-load-plugins';
import babelify from 'babelify';
import browserify from 'browserify';
import source from 'vinyl-source-stream';
var notifier = require('node-notifier');
// Standard handler
var standardHandler = function (err) {
@jgatjens
jgatjens / gulp.svg.js
Created August 10, 2015 15:51
Gulp - SVGs sprite generator - include content into html
// Combine svg files and inject it into index.html
gulp.task('svg', () => {
var svgs = gulp
.src('app/images/svg/*.svg')
.pipe($.svgmin())
.pipe($.svgstore({ inlineSvg: true }));
function fileContents (filePath, file) {
return file.contents.toString();
}
@jgatjens
jgatjens / db.js
Created July 23, 2015 16:42
Books Backend
{
"books": [
{
"id": 1,
"title": "Programming Ruby 1.9 & 2.0",
"author": "Dave Thomas",
"description": "Ruby is the fastest growing and most exciting dynamic language out there. If you need to get working programs delivered fast, you should add Ruby to your toolbox. ",
"img_url": "http://ecx.images-amazon.com/images/I/41gtODXuRlL._SX404_BO1,204,203,200_.jpg",
"user": {
"id": 1,
@jgatjens
jgatjens / core-icons.scss
Last active August 29, 2015 14:25
Decimal to hexadecimal - font icon map loop
// ----
// libsass (v3.2.5)
// ----
@function dec-to-hex($d) {
$hexVals: "A" "B" "C" "D" "E" "F";
$base: 16;
$quotient: $d;
$result: "";
@if $d == 0 {
{
"bold_folder_labels": true,
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
"font_face": "Source Code Pro",
"font_options":
[
"gray_antialias"
],
"font_size": 14,
"highlight_line": true,
@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"
],
@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 / 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 / gist:ac0a43d03cd35e111cb7
Last active July 17, 2016 21:41
lowercase filenames
for f in *; do mv "$f" "`echo $f | tr "[:upper:]" "[:lower:]"`"; done