Skip to content

Instantly share code, notes, and snippets.

View lucafaggianelli's full-sized avatar

Luca Faggianelli lucafaggianelli

View GitHub Profile
@lucafaggianelli
lucafaggianelli / Activities.js
Last active November 1, 2020 23:09
Vue MC Firestore
import FirestoreCollection from './FirestoreCollection'
import Activity from './Activity'
export default class Activities extends FirestoreCollection {
model () {
return Activity
}
routes () {
return {
@lucafaggianelli
lucafaggianelli / Calendar.vue
Created September 27, 2018 09:28
Calendar sample
<template>
<v-layout>
<v-flex xs12>
<v-card>
<v-toolbar flat>
<!-- Today Button -->
<v-tooltip bottom>
<v-btn slot="activator"
flat
color="primary"
@lucafaggianelli
lucafaggianelli / rgb-led-fw.c
Last active April 10, 2016 20:37
PIC18 firmware for RGB LED driver
#define ST_CHAR 0xFE
#define ESC_CHAR 0xFD
#define MSG_LEN 6
unsigned char rxCounter = 0, escaped = 0, in_msg = 0, rxBuffer[MSG_LEN];
void parseSerialMsg(void) {
static unsigned char byte, status;
if (DataRdyUSART()) {
module Freebase
require 'rest-client'
NS = 'http://rdf.freebase.com/ns'
API_URL = 'https://www.googleapis.com/freebase/v1'
API_KEY = 'your_key_here'
RestClient.proxy = ENV['http_proxy']
MQLClient = RestClient::Resource.new(API_URL)
var Freebase = {
api: 'https://www.googleapis.com/freebase/v1',
key: '?key=' + 'your_key_here',
// Main image (icon) of a topic
img: function(mid) {
return this.api + '/image' + mid + this.key;
},
// MQL query with callback on success
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
<head>
<meta name="viewport" content="width=device-width" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Actionable emails e.g. reset password</title>
<style type="text/css">
img {
#!/usr/bin/env python
import sys
import requests
import logging
from jinja2 import Template
template = None
html = None
URL = "https://api.mailgun.net/v3/sandbox4a7ba08a09ec40b4a668b550607547a8.mailgun.org/messages"
KEY = "key-ed60f4288cb8b9c15d876ad2ae06c545"
@lucafaggianelli
lucafaggianelli / font_awesome_android.py
Created January 7, 2015 16:02
Font Awesome LESS to Android XML
import sys
import urllib2
import re
# LESS source file
FA_LESS_URL = 'https://raw.githubusercontent.com/FortAwesome/Font-Awesome/master/less/variables.less'
# REGEX
re_less_var = re.compile('.*:\s*"(.*)";')
re_fa_var = re.compile('^@fa-var-(.*):\s*"\\\\(.*)";')
#!/usr/bin/python
import SimpleHTTPServer
import SocketServer
from urlparse import urlparse, parse_qs
import cgi
import logging
from datetime import datetime
PORT = 8000
@lucafaggianelli
lucafaggianelli / pool-downloader.py
Created August 27, 2014 14:48
Download many files in parallel
import os
import time
import urllib2
from multiprocessing import Pool
BASE = 'http://images.philips.com/is/image/PhilipsConsumer/HD8761_01-P3D-global-{0:0>3}?$pngsmall$'
def millis():
return int(round(time.time() * 1000))