Skip to content

Instantly share code, notes, and snippets.

View jindrichsirucek's full-sized avatar

jindrichsirucek

View GitHub Profile
@jindrichsirucek
jindrichsirucek / try connect to one of wifi saved networks.ino
Last active May 8, 2018 11:05
ESP8266 - There is list of saved wifi credentials, it tries to connect one by one to them until success - on next boot it remembers last network and try to connect first to it.. if unsucsefull look throw all list of saved networks
struct WiFiCredential{
const char *ssid;
const char *pass;
};
bool wifiConnect()
{
if(isWifiConnected())
return true;
WiFi.mode(WIFI_STA);
@jindrichsirucek
jindrichsirucek / Esp8266 wifi radio off and on again
Last active January 23, 2018 08:54
100% working example. It saves battery life greatly, but ESP can still operate (except wifi)..
extern "C" {
#include "user_interface.h"
}
void turnWifiOn()
{
if(MAIN_DEBUG) DEBUG_OUTPUT.println(E("WiFi Radio: Turning ON"));
wifi_fpm_do_wakeup();
wifi_fpm_close();
wifi_set_opmode(STATION_MODE);
wifi_station_connect();
function toggleTabs()
{ if(jQuery(".seminarInfoCestaHrdiny").toggleClass("selectedTab").hasClass("selectedTab"))
jQuery(".seminarInfoCestaHrdiny").closest(".row").show();
else
jQuery(".seminarInfoCestaHrdiny").closest(".row").hide();
if(jQuery(".seminarInfoProfil").toggleClass("selectedTab").hasClass("selectedTab"))
jQuery(".seminarInfoProfil").closest(".row").show();
else
jQuery(".seminarInfoProfil").closest(".row").hide();
@jindrichsirucek
jindrichsirucek / Jqeury, Ajax list order change
Created December 31, 2017 06:11
jqeury Api sortable needed
$(function() {jQuery( "#sortable" ).sortable({
update: function( event, ui ) {onOrderChange(event, ui)}
});
function onOrderChange(event, ui)
{
jQuery.ajax({ url: 'https://77prani.cz/posun_prani.php?pozice='+ui.item.index()+'&id='+ui.item.attr("id"),
data: {action: 'test'},
type: 'post',
success: function(output) {
//Succesfully saved
function sortUlozenkaSelect()
{
function localeCompareSupportsLocales() {
try {
'foo'.localeCompare('bar', 'i');
} catch (e) {
return e.name === 'RangeError';
}
return false;
}
@jindrichsirucek
jindrichsirucek / Randomly fill form values
Created December 31, 2017 06:06
Javascript + jquery
$("#newOrderFormElement").keydown(function (e) {
//console.log(e.keyCode);
if (e.metaKey && e.keyCode === 68) //Command + Alt + d
{
fillFormByDebugValues();
event.preventDefault();
}
});
function fillFormByDebugValues()
@jindrichsirucek
jindrichsirucek / LCD16x2 Wifi animate.ino
Last active March 16, 2017 12:11
Animation function for LCD 1602 connected to ESP8266 (arduino) written in C/C++
#include <ESP8266WiFi.h>
#include <LiquidCrystal_I2C.h>
#include <Wire.h> //I2C communication
#define LCD_DISPLAY_ADDRESS 0x27
#define AP_SSID "wifiAP"
#define AP_PASSWORD "password"
LiquidCrystal_I2C lcd(LCD_DISPLAY_ADDRESS, 16, 2); // set the lcd address to 0x27 for a 16 chars and 2 line display
byte newCharWifiSending[][8] =
@jindrichsirucek
jindrichsirucek / schortuct to debug in GAS.js
Last active October 30, 2020 01:52
schortuct to start and stop debug in GAS for tampermonkey
// ==UserScript==
// @name schortuct to debug in GAS
// @namespace http://tampermonkey.net/
// @version 0.1
// @description ctr+alt+d - run debug in google apps script
// @author You
// @match https://script.google.com/*
// @grant none
// ==/UserScript==
@jindrichsirucek
jindrichsirucek / Highlite long exectuion times in GAS.js
Last active January 24, 2017 21:49
Script for tampermonkey. Highlites long exectuion times in execution transcript in google apps script browser editor
// ==UserScript==
// @name Highlite long exectuion times in GAS
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Highlite long exectuion times in execution transcript in google apps script
// @author You
// @match https://script.google.com/*
// @grant none
// ==/UserScript==
@jindrichsirucek
jindrichsirucek / Word highliter for programers.js
Last active January 8, 2017 19:41
It highlights all words based on selection on whole html page. Im using it for online google apps script editor. its similar function to sublimetext.
// ==UserScript==
// @name Selection highliter
// @namespace http://tampermonkey.net/
// @version 0.1
// @description It highlights all words based on selection on whole html page. Im using it for online google apps script editor. its similar function to sublimetext.
// @author jindrich.sirucek@gmail.com
// @match https://script.google.com/macros/*
// @grant none
// ==/UserScript==