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
{
"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 / 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 {
@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 / 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 / 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 / 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 / index.js
Last active February 13, 2018 11:37
Javascript regex match images path in JSON or string.
var regMatch = new RegExp("http:\\/\\/\[^\"]+(.png|.jpg|.gif|.jpeg)","gi");
var str = JSON.stringify(data);
ARRAY_IMAGES = str.match(regMatch);
console.log(ARRAY_IMAGES);
@jgatjens
jgatjens / steps.js
Last active April 8, 2016 03:45
Format object with loadash and reduce, format by day, formay by month, groupby and sum by dates.
/*
weekly = [
['3/6 - 3/12', 10],
['3/12 - 3/19', 13]
];
day = [
['3/6', 10]
['3/8', 2]
];
@jgatjens
jgatjens / FTP - lftp
Created July 26, 2016 05:19
change permission to a group of files over FTP terminal using lftp command
#!/bin/bash
echo "---- UPDATE PERMISSION example.net IMAGES ----"
HOST="ftp.example.net"
USER="usernmae"
PASS="password"
FTPURL="ftp://$USER:$PASS@$HOST"
lftp <<EOF
set ftp:ssl-allow no
set ftp:passive-mode true
set ftp:list-options -a
@jgatjens
jgatjens / go prod ftp
Created July 26, 2016 05:22
Upload folder to a FTP using lftp command.
#!/bin/bash
read -p "Are you sure you want to go to production? <y/N> " prompt
if [[ $prompt =~ [yY](es)* ]]
then
echo "---- UPDATE example.net SITE ----"
HOST="ftp.example.net"
USER="username"
PASS="password"
FTPURL="ftp://$USER:$PASS@$HOST"
LCD="/Users/username/Sites/project-name"