Skip to content

Instantly share code, notes, and snippets.

Avatar

Rogier van den Berg rogiervandenberg

View GitHub Profile
@rogiervandenberg
rogiervandenberg / main.go
Created Oct 5, 2020
Basis Golang HTTP REST server - Best practices interpreted
View main.go
/*
Based on the video's and blogposts of Mat Ryer (@matryer)..
- https://pace.dev/blog/2018/05/09/how-I-write-http-services-after-eight-years.html
- https://www.youtube.com/watch?v=FkPqqakDeRY
- https://www.youtube.com/watch?v=rWBSMsLG8po
.. I derived the following starting point for a GO HTTP REST server. It can be used to add all explained (see above) concepts.
You could spread the code below in separate files as follows:
@rogiervandenberg
rogiervandenberg / readme.md
Last active Jul 22, 2019
Start Docker based Rails 6 project with Docker, without installing Ruby and/or Rails
View readme.md

Create new Rails 6 project with Docker

If you want to set-up a new Rails (6) project, but you don't want to go through the hassle of setting op Ruby, node, Yarn, Rails itself, etc. you could do it with Docker.

Setup

Prerequisite: Have Docker installed

If not, install Docker first

Create the directory for your project

Open a terminal, create a project folder somewhere and go into that directory:

@rogiervandenberg
rogiervandenberg / cloudSettings
Last active Jul 2, 2020
Visual Studio Code Settings Sync Gist
View cloudSettings
{"lastUpload":"2020-07-02T10:09:58.225Z","extensionVersion":"v3.4.3"}
View keybase.md

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@rogiervandenberg
rogiervandenberg / resque_on_heroku_rails4.md
Last active Jul 11, 2016
Setup Resque with Rails 4 on Heroku and locally
View resque_on_heroku_rails4.md

Setup Resque on Heroku for Rails 4

Resque depends on Redis, so first install Redis locally to be able to work on your project...

Install Redis locally on Mac

To install Redis locally, use the following approach on Mac OS X (using Homebrew). $ brew install redis

To test your install, firstly ensure that the Redis server is running. $ redis-server

@rogiervandenberg
rogiervandenberg / gmail_to_omnifocus.js
Last active Mar 23, 2016
Bookmarklet to make a link in Omnifocus to the current Gmail e-mail. The body of the mail is added as note, when hightlighting text in the e-mail only that part is added as note. There is always a link included to the original e-mail.
View gmail_to_omnifocus.js
javascript:(function(){var enc=encodeURIComponent,w=window,frames=w.frames,d=document,tn=w.getSelection?w.getSelection():(d.getSelection)?d.getSelection():(d.selection?d.selection.createRange().text:0),pu=w.location.href,isGMail=w.location.host.match(/mail\.google\.com/),tt=pt=d.title,subjSpans=d.getElementsByClassName("hP"),i,url;if(isGMail){if(subjSpans){tt=subjSpans[0].innerText}else{tt=d.title.substring(d.title.indexOf("-")+1,d.title.lastIndexOf("-")).replace(/^ +/,"").replace(/ +$/,"")};if(tn!="")tn+="\n\n";tn+="From email subject:("+tt+")\n"+pu;pu="https://mail.google.com/mail/u/0/?qs=true&search=query&q=subject:("+enc(tt)+")"};url='omnifocus:///add?note='+enc(tn+"\n"+pu)+'&name='+enc(tt);w.location.href=url})();
View OneName
Verifying that +rogiervandenberg is my blockchain ID. https://onename.com/rogiervandenberg
@rogiervandenberg
rogiervandenberg / getLocalTimeStamp.js
Created Nov 18, 2015
Returns a timestamp corrected for the current timezone, instead of getting the UTC timezone. This can be useful for tracking timed-events in the perception of a user/visitor of your application/website in e.g. Google Tag Manager.
View getLocalTimeStamp.js
function getLocalTimeStamp () {
var currentDate = new Date();
var currentTime = currentDate.getTime();
var localOffset = (-1) * currentDate.getTimezoneOffset() * 60000;
var stamp = Math.round(new Date(currentTime + localOffset).getTime() / 1000);
return stamp;
}
@rogiervandenberg
rogiervandenberg / FrontdoorSensorReedSensor.ino
Created Apr 21, 2015
Checks my front door status. Sends status over RF-communication.
View FrontdoorSensorReedSensor.ino
//To make more serial ports
#include <SoftwareSerial.h>
SoftwareSerial remoteSerial(2, 3); //Use pins 2 and 3 to connect the Serial connection
const int light = 13; //output and light
const int reedPin = 5; //read info from the Reed
//vars
int output = LOW;
@rogiervandenberg
rogiervandenberg / FrontdoorSensorPushover.ino
Created Apr 21, 2015
Listens for incoming RF-communication about the status of my front door. The Internet Arduino sends API calls to Pushover.
View FrontdoorSensorPushover.ino
#include <SPI.h>
#include <Ethernet.h>
#include <HttpClient.h>
#include <SoftwareSerial.h>
// MAC address for your Ethernet shield
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
// Pushover settings
char pushoversite[] = "api.pushover.net";
You can’t perform that action at this time.