This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from 'react'; | |
import gql from 'graphql-tag'; | |
import { Query } from 'react-apollo'; | |
import { GetSystemLogsQuery } from '../generated/schema'; | |
const GET_SYSTEM_LOGS = gql` | |
query GetSystemLogs { | |
system { | |
logs // INTELISENSE NOT WORKING HERE :( | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const cacheMiddleware = store => next => action => { | |
if(action.type !== 'GET_SOMETHING') { | |
return next(action); | |
} | |
const data = getFromLocalstorage() | |
if(!data) { | |
// Fetch and put to localstorate for later use | |
const data = fetchFromServer() | |
return next({ type: 'SERVER_RESULT', data }) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Open BROWSER CONSOLE (F12) and place inside this content | |
// This will open source file... | |
// You need to save it manually with `ctrl + s` | |
(function openVideoFile() { | |
const downa = document.createElement('a'); | |
downa.id = 'videofileClickme' | |
downa.href = document.querySelector("meta[property=\"og:video:secure_url\"]").content | |
downa.download = 'MyRide'; | |
document.body.appendChild(downa) | |
videofileClickme.click(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://stackoverflow.com/questions/42773892/wrong-components-rendered-by-preact | |
// https://facebook.github.io/react/docs/lists-and-keys.html | |
import * as React from 'react'; | |
class Component extends React.Component<any, any> { | |
constructor() { | |
super(); | |
this.state = { listing: ['First', 'Second', 'Last'] }; | |
setInterval(() => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function tracePrototypeChainOf(object) { | |
let proto = object.constructor.prototype; | |
let result = ''; | |
while (proto) { | |
result += ' -> ' + proto.constructor.name; | |
proto = Object.getPrototypeOf(proto) | |
} | |
return result; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
Compiled, mashed and generally mutilated 2014-2015 by Denis Pleic | |
Made available under GNU GENERAL PUBLIC LICENSE | |
# Modified Python I2C library for Raspberry Pi | |
# as found on http://www.recantha.co.uk/blog/?p=4849 | |
# Joined existing 'i2c_lib.py' and 'lcddriver.py' into a single library | |
# added bits and pieces from various sources | |
# By DenisFromHR (Denis Pleic) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head><meta charset="utf-8" /></head> | |
<body> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/immutable/3.8.1/immutable.min.js"></script> | |
<script> | |
const TIMES = 10000; | |
window.onload = function(){ | |
console.time('time'); | |
let initial = Immutable.List.of(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://stackoverflow.com/questions/16201656/how-to-swap-two-variables-in-javascript | |
a = b + (b = a, 0) | |
// (b=a, 0) sets b to the old value of a and yields 0 | |
// a = b + 0 sets a to the old value of b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Check if request is secure (https) | |
* http://stackoverflow.com/questions/85816/how-can-i-force-users-to-access-my-page-over-https-instead-of-http | |
* @return bool | |
*/ | |
function isRequestSecure() { | |
return ( | |
(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') | |
|| $_SERVER['SERVER_PORT'] == 443 | |
|| ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<body> | |
<script> | |
// Alternative fetch('http://biz.jurosh.local/packages/test.php', {headers: {'Content-Type': 'application/json'}}) | |
fetch('http://biz.jurosh.local/packages/test.php', {method: 'PUT'}) | |
.then(data => console.log('DATA!')); | |
// Accept is like: Here is my request and I would like (to Accept) this response format |