Skip to content

Instantly share code, notes, and snippets.

View Voles's full-sized avatar

Niels Dequeker Voles

  • Belgium
  • 01:43 (UTC +02:00)
View GitHub Profile
@Voles
Voles / bump-patch.sh
Last active August 20, 2020 10:10
Bump patch file and push to origin
#!/usr/bin/env bash
bp () {
git fetch
latestTag=$(git tag | tail -n1)
versionParts=($(echo "$latestTag" | tr '.' '\n'))
newTag="${versionParts[1]}.${versionParts[2]}.$(($versionParts[3] + 1))"
echo "new patch version is: $newTag"
@Voles
Voles / main.go
Created October 28, 2019 12:51
BizzBuzz attempt
package code_kata
import "testing"
import "strconv"
//func TestLineCount(t *testing.T) {
// buffer := fizbuzz()
//
// if len(buffer) != 100 {
// t.Fail("expected 100 lines")

Keybase proof

I hereby claim:

  • I am voles on github.
  • I am voles (https://keybase.io/voles) on keybase.
  • I have a public key ASAOjePk0T8yqrP3FMKPX0gakD5aAM6ySU5I1IMPGrMqRQo

To claim this, I am signing this object:

@Voles
Voles / main.go
Created March 4, 2019 20:37
Go channel experiment
// Directory maps every file from a directory into an API model
func Directory(directory string) ([]models.API, error) {
files, err := ioutil.ReadDir(directory)
workerQueue := make(chan string)
APImodelsChan := make(chan result)
output := []models.API{}
if err != nil {
@Voles
Voles / .gitlab-ci.yml
Created February 2, 2017 20:20
GitLab configuration for Protractor
image: kkarczmarczyk/node-yarn:6.9
cache:
paths:
- webapp/node_modules/
- vendor/apt
e2e_tests:
before_script:
# install chrome
@Voles
Voles / index.js
Created May 22, 2018 20:59
Recursive Promise
function fetchResultsWithPagination(options, page, resultList) {
resultList = resultList || [];
page = page || 1;
return new Promise((resolve, reject) => {
makeHttpRequestPromise(Object.assign({}, options, { page: page }))
.then(payload => {
const newResultList = resultList.concat(payload);
if (payload.length >= options.per_page) {
@Voles
Voles / datefilter.js
Created April 25, 2013 12:41
AngularJS daterange filter
RB.filter('daterange', function ()
{
return function(conversations, start_date, end_date)
{
var result = [];
// date filters
var start_date = (start_date && !isNaN(Date.parse(start_date))) ? Date.parse(start_date) : 0;
var end_date = (end_date && !isNaN(Date.parse(end_date))) ? Date.parse(end_date) : new Date().getTime();
@Voles
Voles / README.md
Created January 22, 2018 10:04
MySQL with phpMyAdmin setup using Docker Compose
@Voles
Voles / App.elm
Created November 10, 2017 16:29
My First Elm App
-- Read more about this program in the official Elm guide:
-- https://guide.elm-lang.org/architecture/user_input/buttons.html
import Html exposing (beginnerProgram, div, button, text, input)
import Html.Attributes exposing (class)
import Html.Events exposing (onClick, onInput)
import String exposing (toInt)
{-
import Result exposing (..)
-}
@Voles
Voles / the-bind-problem.jsx
Last active March 23, 2017 14:09 — forked from Restuta/the-bind-problem.jsx
React, removeEventListener and bind(this) gotcha
/* Sometimes it's pretty easy to run ito troubles with React ES6 components.
Consider the following code: */
class EventStub extends Component {
componentDidMount() {
window.addEventListener('resize', this.onResize.bind(this)); //notice .bind
}
componentWillUnmount() {
window.removeEventListener('resize', this.onResize.bind(this));