Skip to content

Instantly share code, notes, and snippets.

🌸
π2 / 6

Jilles Soeters jillesme

🌸
π2 / 6
Block or report user

Report or block jillesme

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jillesme
jillesme / app.js
Created Nov 11, 2016
Little refactor
View app.js
function handlePossibleError(err) {
if (!err) return;
console.log('------- ERROR --------');
console.error(err);
console.log('----------------------');
}
function insertIntoDatabase(db, data) {
var tweets = db.collection('tweets');
var reg = /(https:\/\/.+)/g;
@jillesme
jillesme / App.jsx
Last active Aug 30, 2018
React, Redux and react-redux
View App.jsx
import React, { Component } from 'react';
import { createStore } from 'redux'
import { Provider, connect } from 'react-redux'
// create-react-app specific
import logo from './logo.svg';
import './App.css';
const FRAMEWORKS = ['React', 'Angular', 'Vue', 'Ember'];
@jillesme
jillesme / egghead-total-duration.js
Last active Feb 19, 2016
Egghead total duration of a course..
View egghead-total-duration.js
(function (s) {
return [~~(s / 3600), ~~((s % 3600) / 60), s % 60].map(v => v < 10 ? '0' + v : v).join(':');
})([].slice.call(document.querySelectorAll('.duration'))
.filter((e, i, a) => ++i <= (a.length / 3))
.map(h => {
var t = h.textContent.match(/[0-9]{1,2}:[0-9]{1,2}/);
var p = t[0].split(':').map(Number);
return (p[0] * 60) + p[1]
}).reduce((p, c) => p + c, 0));
View kebab_to_camel.py
def kebab_to_camel(string):
splitted = string.split('-')
result = [part.title() for part in splitted[1:]]
result.insert(0, splitted[0].lower())
return ''.join(result)
@jillesme
jillesme / .tmux.conf
Created Oct 16, 2015
Jilles' tmux configuration
View .tmux.conf
# allow pbcopy | pbpase on OSX
set-option -g default-command "reattach-to-user-namespace -l zsh"
# set colours
set -g default-terminal "screen-256color"
# use ctrl+a rather than ctrl+b (capslock == ctrl)
unbind C-b
set-option -g prefix C-a
bind C-a send-prefix
View gist:9a94fa012d65ad2552ce
setTimeout(function () {
document.location.reload();
}, 1000 * 60 * 5);
View .vimrc
source ~/.vundle
" -- DEFAULTS --
" UTF-8 encoding
set encoding=utf-8
" Default dir is sites
cd ~/Appsbroker
View .vimrc
source ~/.vundle
" -- DEFAULTS --
" UTF-8 encoding
set encoding=utf-8
" Default dir is sites
cd ~/Appsbroker
@jillesme
jillesme / timeparser.js
Created Oct 14, 2014
Parses seconds to a nice displayed time :)
View timeparser.js
function parseTime (initialTime) {
var time = parseInt(initialTime);
var result = '';
if (time <= 59) {
result = time > 9 ? '00:' + time : '00:0' + time;
} else if (time > 59 && time <= 3599) {
var minutes = 0;
while (time > 59) {
time -= 60;
minutes += 1;
@jillesme
jillesme / app.js
Last active Aug 29, 2015
Default Express App
View app.js
var express = require('express');
var path = require('path');
var favicon = require('serve-favicon');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var routes = require('./routes/index');
var users = require('./routes/users');
You can’t perform that action at this time.