Skip to content

Instantly share code, notes, and snippets.

View easierbycode's full-sized avatar

▓▒░ ♔ Daniel ♔ ░▒▓ easierbycode

View GitHub Profile
@easierbycode
easierbycode / 0_reuse_code.js
Created July 5, 2014 05:17
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
exports.sensorHubEvent = (sensorHubEvent, eventResolved) ->
alertText = switch sensorHubEvent
when 1 then 'Water detect'
when 2 then 'Motion detect'
when 3 then 'Low temperature'
when 4 then 'High temperature'
when 5 then 'Low humidity'
when 6 then 'High humidity'
when 7 then 'Low light'
when 8 then 'High light'
{
sequenceNumber: '0100',
networkHubMAC: '533F15800700',
action: '01',
sensorHubMAC: '103E15800700',
nbrOfBytes: '10',
temperatureMax: '2000',
temperatureMin: '0000',
lightMax: '8403',
lightMin: '0100',
formatted = {
prefix: 'HC2',
sequenceNumber: '0100',
networkHubMAC: '533F15800700',
action: '01',
sensorHubMAC: '103E15800700',
nbrOfBytes: '10',
temperatureMax: '2000',
temperatureMin: '0000',
lightMax: 'ffff',
# A program to print a receipt after gas is pumped
# Import statements
import datetime
# Global variable declaration
numberOfGallons = 13.000
costPerGallon = 2.05
totalCost = numberOfGallons * costPerGallon
stationName = "Chevron"
fields = switch req.query.msgType
when '0' then ['timestamp', 'macAddress', 'gatewayBattery', 'rssi']
when '2' then ['timestamp', 'macAddress', 'gatewayBattery', 'gatewayEventCode', 'rssi']
when '4' then ['timestamp', 'macAddress', 'sensorEventStart', 'sensorEventEnd', 'rssi', 'sensorHubBattery', 'sensorHubMacAddress', 'sensorHubRssi']
when '5' then ['timestamp', 'macAddress', 'rssi', 'numberOfSensors', 'sensorHubBattery', 'sensorHubData1', 'sensorHubData2', 'sensorHubData3', 'sensorHubMacAddress', 'sensorHubRssi', 'sensorHubType']
<link rel="apple-touch-icon" sizes="57x57" href="/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="/android-icon-192x192.png">
{
"permissions": ["storage", "alarms", "notifications",
"webview", "<all_urls>"]
}
var fs = require("fs");
var fileName = "foo.txt";
fs.exists(fileName, function(exists) {
if (exists) {
fs.stat(fileName, function(error, stats) {
fs.open(fileName, "r", function(error, fd) {
var buffer = new Buffer(stats.size);
fs.read(fd, buffer, 0, buffer.length, null, function(error, bytesRead, buffer) {
@easierbycode
easierbycode / tamponsnow.css
Created November 5, 2015 18:51
fullscreen background in Cordova Chrome Apps using background-size: cover
html, body {
min-height: 100%;
}
body {
background-image: url('chrome-extension://kkdbagnomgggmhndoigmfkngichpnald/background.png');
background-repeat: no-repeat;
background-position: 0 0;
background-size: cover;
}