Skip to content

Instantly share code, notes, and snippets.

View DarkoKukovec's full-sized avatar

Darko Kukovec DarkoKukovec

View GitHub Profile
@ebidel
ebidel / feature_detect_es_modules.js
Last active September 4, 2023 13:56
Feature detect ES modules: both static import and dynamic import()
<!--
Complete feature detection for ES modules. Covers:
1. Static import: import * from './foo.js';
2. Dynamic import(): import('./foo.js').then(module => {...});
Demo: http://jsbin.com/tilisaledu/1/edit?html,output
Thanks to @_gsathya, @kevincennis, @rauschma, @malyw for the help.
-->
// In v2/3 you did this:
import ReactDOM from 'react-dom'
import { Router, browserHistory, Route } from 'react-router'
ReactDOM.render(
<Router>
<Route path="/about" component={About}/>
<Route path="/:username" component={User}/>
</Router>
)
class TodoStore extends BaseStore {
// Constructor is executed in the config phase.
constructor(stores, initialState) {
super(stores, initialState) // ensures initial state loads for SSR
// Other store initialization...
}
// This is executed in the run phase, after all stores have initialized.
storeDidInitialize(stores) {
if (typeof Promise === 'undefined') {
require.ensure([], (require) => {
require('imports?this=>window!es6-promise')
})
}
if (typeof fetch === 'undefined') {
require.ensure([], (require) => {
require('imports?self=>window!whatwg-fetch')
})
@blackjid
blackjid / README.md
Last active June 11, 2023 15:15
How configure your raspberry pi with dashing to have a awesome dashboard

Raspberry pi dashboard

This is what we did to setup a few dashboards at platanus

You'll need

  • Raspberry Pi
  • Dashing Service
  • Wifi stick (optional)
@ejdyksen
ejdyksen / mini-console.html
Last active September 18, 2017 22:13
A tool for getting at a JS console when there is none available.
<div id="consolelog" style="font-family: 'Courier New', Courier, monospace; font-size: 12px; margin: 40px 30px 0px; background-color: white; border: 2px solid black; padding: 10px;"></div>
<input type="text" id="consoleinput" style="margin: 0px 30px; width: 400px;" onkeypress="return evalConsoleInput(event, this.value);" />
<script type="text/javascript">
var appendConsole = function(message, type) {
var color = "black";
if (type === "error") {
color = "red";
} else if (type === "debug") {
if("undefined" === typeof document.currentScript){
(function(){
/***************************************************************************/
/* document.currentScript polyfill + improvements */
/***************************************************************************/
var scripts = document.getElementsByTagName('script');
document._currentScript = document.currentScript;
// return script object based off of src
var getScriptFromURL = function(url) {
@dpavlin
dpavlin / jmbag.pl
Last active April 30, 2017 20:48
JMBAG checksum validator/calculator
#!/usr/bin/perl
use warnings;
use strict;
sub jmbag_check {
my $jmbag = shift;
$jmbag = sprintf "%09d", $jmbag if length $jmbag < 9;
my $sum = 0;
my $pos = 0;