Skip to content

Instantly share code, notes, and snippets.

View rogiervandenberg's full-sized avatar

Rogier van den Berg rogiervandenberg

View GitHub Profile
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-field/core-field.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-input/core-input.html">
<link rel="import" href="../google-map/google-map-search.html">
@rogiervandenberg
rogiervandenberg / SwitchLightsGetRF.ino
Last active August 29, 2015 14:19
Control lights with an Arduino remotely with 433Mhz, Simplified source using GET requests and without 7-segment LED display
#include <RemoteTransmitter.h>
#include <Ethernet.h>
#include <SPI.h>
#include <WebServer.h>
//Connections to the Arduino board
const int ledPin = 9;
const int transmitterPin = 8;
//Duration of a RF command
@rogiervandenberg
rogiervandenberg / SwitchLightsRFLearning.ino
Created April 21, 2015 15:42
Control lights with an Arduino remotely with 433Mhz, Source code as used in the video
#include <RemoteSwitch.h>
#include <RemoteReceiver.h>
#include <Ethernet.h>
#include <SPI.h>
#include <WebServer.h>
#include <EEPROM.h>
#include <EEPROMAnything.h>
//Connections to the Arduino board
const int ledPin = 9;
@rogiervandenberg
rogiervandenberg / FrontdoorSensorPushover.ino
Created April 21, 2015 16:40
Listens for incoming RF-communication about the status of my front door. The Internet Arduino sends API calls to Pushover.
#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";
@rogiervandenberg
rogiervandenberg / FrontdoorSensorReedSensor.ino
Created April 21, 2015 16:41
Checks my front door status. Sends status over RF-communication.
//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 / getLocalTimeStamp.js
Created November 18, 2015 11:05
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.
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;
}
Verifying that +rogiervandenberg is my blockchain ID. https://onename.com/rogiervandenberg
@rogiervandenberg
rogiervandenberg / gmail_to_omnifocus.js
Last active March 23, 2016 11:09
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.
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})();
@rogiervandenberg
rogiervandenberg / resque_on_heroku_rails4.md
Last active July 11, 2016 07:56
Setup Resque with Rails 4 on Heroku and locally

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 / keybase.md
Created August 4, 2016 15:06
Keybase Proof

Keybase proof

I hereby claim:

To claim this, I am signing this object: