Skip to content

Instantly share code, notes, and snippets.

View octopuss's full-sized avatar

Ivan Doležal octopuss

View GitHub Profile
@octopuss
octopuss / designer.html
Last active August 29, 2015 14:10
designer
<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-header-panel/core-header-panel.html">
<link rel="import" href="../core-ajax/core-ajax.html">
<link rel="import" href="../chart-js/chart-js.html">
<polymer-element name="my-element">
<template>
<style>
@octopuss
octopuss / gist:825946c8a2aad917a56c
Last active August 29, 2015 14:20
CoffeeCounter
#define LOGGING
// This #include statement was automatically added by the Spark IDE.
#include "HttpClient/HttpClient.h"
// This #include statement was automatically added by the Spark IDE.
#include "LiquidCrystal_I2C_Spark/LiquidCrystal_I2C_Spark.h"
/** include library */
#include "application.h"
@octopuss
octopuss / MaestroValidator.java
Last active August 29, 2015 14:26
RegexpValidator for Maestro
package sk.octopuss.test;
import junit.framework.Assert;
import org.apache.commons.validator.routines.CodeValidator;
import org.apache.commons.validator.routines.CreditCardValidator;
import org.apache.commons.validator.routines.RegexValidator;
import org.apache.commons.validator.routines.checkdigit.LuhnCheckDigit;
import org.junit.Test;
/**
public class LocalizedObject<T> {
private T object;
private Map<LanguageCode, List<Localization>> localizations;
public T getObject() {
return object;
}
public void setOobject(T object) {
this.object = object;
}
@octopuss
octopuss / status_timeout.js
Last active September 21, 2015 09:14
Get status of some process periodically or timeout
var set_delay = 1000;
var ticker = 0;
var limit = 10;
var status = false;
callout = function (callback) {
$.ajax({
url: "http://private-anon-ca0f912b9-mcrdataforpublic.apiary-mock.com/"
})
.done(function (response) {
console.log("requested");
console.log("Running sql blob exporter");
var mysql = require('mysql');
fs = require('fs');
var connection = mysql.createConnection({
host : 'localhost',
user : 'root',
password : '',
database :'arto'
});
@octopuss
octopuss / Cell.php
Created March 6, 2016 14:25
GOL php simple implementation
<?php
class Cell {
public $x;
public $y;
public $surroundings = [];
public function __construct($x, $y)
@octopuss
octopuss / asyncawait.js
Last active November 3, 2016 21:25
Just testing of js async await principle http://www.es6fiddle.net/iv2v00tn/
async function greet(who) {
try {
console.log("(2) Greet is beeing composed, and printed second because no await was present yet")
var greeting = await composeGreet(who);
console.log ("(5) Greet composed and promise fullfilled");
console.log("(6) " + greeting);
} catch(error) {
console.error(error);
}
}
@octopuss
octopuss / promises.js
Created November 3, 2016 21:39
Promises alternative to async await http://www.es6fiddle.net/iv2vj8jm/
console.log("First");
var p = new Promise((ok, reject) => {
try {
console.log("Second");
ok();
} catch (err) {
reject();
}
});
p.then(() => {console.log("Fourth")})
@octopuss
octopuss / 5minIOT.md
Last active August 18, 2017 08:21
Short description to my ReactiveLT talk