Skip to content

Instantly share code, notes, and snippets.

View monkbroc's full-sized avatar

Julien Vanier monkbroc

View GitHub Profile
@sidwarkd
sidwarkd / twilio.json
Created December 10, 2016 07:58
Particle Webhook Config File Template for Twilio Integration
{
"eventName": "[EVENT TO LISTEN FOR]",
"url": "https://api.twilio.com/2010-04-01/Accounts/[ACCOUNT SID]/Messages",
"requestType": "POST",
"auth": {
"username": "[ACCOUNT SID]",
"password": "[AUTH TOKEN]"
},
"form": {
"From" : "[YOUR TWILIO NUMBER]",
@mohitbhoite
mohitbhoite / Pomodoro.cpp
Last active July 5, 2016 13:08
Super simple Pomodoro Timer via the Particle Internet Button!
// This #include statement was automatically added by the Particle IDE.
#include "InternetButton/InternetButton.h"
InternetButton b = InternetButton();
uint32_t workTime = 0;
uint32_t restTime = 0;
// Time definitions in milliseconds

Minimum Viable Async with Node 6

With the release of Node 6.0.0, the surface of code that needs transpilation to use ES6 features has been reduced very dramatically.

This is what my current workflow looks like to set up a minimalistic and fast microservice using micro and async + await.

The promise

@nrobinson2000
nrobinson2000 / update.md
Last active September 29, 2017 07:56
Particle Offline Utility: A handy script for installing and using the Particle Toolchain on Ubuntu-based Distros and OSX
@derwiki
derwiki / README.md
Last active September 27, 2023 17:50
Ruby module that you can use in a `before_action` on sensitive controllers for which you'd like a usage audit trail

Adding an audit log to your Rails app

If you have any sort of administrative interface on your web site, you can easily imagine an intruder gaining access and mucking about. How do you know the extent of the damage? Adding an audit log to your app is one quick solution. An audit log should record a few things:

  • controller entry points with parameter values
  • permanent information about the user, like user_id
  • transient information about the user, like IP and user_agent

Using the Rails framework, this is as simple as adding a before_action to your admin controllers. Here’s a basic version that I’m using in production.

@sentinelt
sentinelt / gist:3f1a984533556cf890d9
Created February 6, 2015 18:44
Program to set arbitrary speed
/*
* Allows to set arbitrary speed for the serial device on Linux.
* stty allows to set only predefined values: 9600, 19200, 38400, 57600, 115200, 230400, 460800.
*/
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
#include <asm/termios.h>
int main(int argc, char* argv[]) {
@hinok
hinok / SassMeister-input.scss
Last active April 7, 2017 10:45
Generated by SassMeister.com.
//
// I created standalone package, look here
//
// https://github.com/hinok/spejson
//
// ----
// libsass (v3.0.2)
// ----
@lapastillaroja
lapastillaroja / DividerItemDecoration.java
Last active November 17, 2023 23:06 — forked from akmalxxx/DividerItemDecoration.java
DividerItemDecoration. RecyclerView.ItemDecoration simple implementation
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.View;
@weapp
weapp / nginx.conf
Created August 4, 2014 17:21
Return common errors as json in Nginx
error_page 500 /500.html;
location /500.html{
return 500 '{"error": {"status_code": 500,"status": "Internal Server Error"}}';
}
error_page 502 /502.html;
location /502.html{
return 502 '{"error": {"status_code": 502,"status": "Bad Gateway"}}';
}
@eabait
eabait / charting.libraries.md
Last active July 13, 2017 04:34
Charting Libraries