Skip to content

Instantly share code, notes, and snippets.

@jmas
jmas / Arduino 230v Light bulb dimming
Created May 22, 2016 21:50 — forked from ryanamaral/Arduino 230v Light bulb dimming
Arduino 230v Light Bulb Dimming (Portugal 220V 50 Hz)
//source: http://electronics.stackexchange.com/q/59615
int AC_LOAD = 3; // Output to Opto Triac pin
int dimming = 128; // Dimming level (0-128) 0 = ON, 128 = OFF
void setup()
{
pinMode(AC_LOAD, OUTPUT); // Set the AC Load as output
attachInterrupt(0, zero_crosss_int, RISING); // Choose the zero cross interrupt # from the table above
}
@jmas
jmas / object-to-form-data.js
Created May 15, 2016 08:19 — forked from ghinda/object-to-form-data.js
JavaScript Object to FormData, with support for nested objects, arrays and File objects. Includes Angular.js usage.
// takes a {} object and returns a FormData object
var objectToFormData = function(obj, form, namespace) {
var fd = form || new FormData();
var formKey;
for(var property in obj) {
if(obj.hasOwnProperty(property)) {
if(namespace) {
@jmas
jmas / nginx
Created October 18, 2015 09:08 — forked from serhiinkh/nginx
map $status $loggable {
~^[2,3] 0;
default 1;
}
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
server_name ~^(www\.)?(?<domain>.+?).loc$;