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
This can be used to bootsrap making reducers that only have to manage an array of data. | |
// crud-lib.js | |
import nanoid from 'nanoid'; | |
export function createActionTypes(reducerAlias) { | |
return { | |
add: Symbol(`CUD add in ${reducerAlias}`), | |
remove: Symbol(`CUD remove in ${reducerAlias}`), | |
update: Symbol(`CUD remove in ${reducerAlias}`), |
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
// Con, un-used catch, performance?, un-used catch is a codesmell | |
function findPage(pid, pages:IPage[]): IPage { | |
for(const page of pages) { | |
if (page.pageId === pid) return page; | |
if(page.subPages.length > 0) { | |
try { | |
return findPage(pid, page.subPages); | |
} catch {} |
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
// ---> custom filtered sub-store | |
function createContentObservable(store) { | |
const contentSubs = { | |
X: [] | |
} | |
const dispose = store.subscribe((cat) => { | |
if (store.getState().lastAction.type === 'content-change') { | |
const id = store.getState().lastAction.id; |
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
export function animate(cb, time) { | |
return new Promise((resolve, reject) => { | |
const startTime = performance.now(); | |
const endTime = startTime + time; | |
function run() { | |
const currentTime = performance.now(); | |
const deltaTime = currentTime - startTime; | |
const pctDone = deltaTime / time; |
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 scrollTo({ element = window, top = 0, left = 0, behavior = 'smooth' }) { | |
return new Promise((res) => { | |
const onScroll = function() { | |
// @ts-ignore | |
const scrollTop = element.scrollTop | |
if (scrollTop === top) { | |
element.removeEventListener('scroll', onScroll) | |
res(); | |
} |
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
#include <Wire.h> | |
#if defined(ARDUINO_SAM_DUE) | |
#define WIRE Wire1 | |
#else | |
#define WIRE Wire | |
#endif | |
//Settings: | |
#define _i2caddr 0x60 |
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
<div class="responsive-background" data-src="intro/introslide2.jpg"></div> | |
<script> | |
var resizeTimer; | |
var resizing = false; | |
var startWidth = 0; | |
var loadedImages = []; | |
var maxWidth = window.innerWidth; | |
$(window).on('resize', function(e) { |
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
var params = { | |
merchantnumber:"[TEST MERCHANTNUMBER]", | |
currency:"208", | |
mobile:"0", | |
windowState:"4", | |
"iframeheight": "100%", | |
"iframewidth": "100%" | |
}; | |
params.amount = 10; |
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
Remote Address:[::1]:80 | |
Request URL:http://localhost/help/dah/admin/notifications/add | |
Request Method:POST | |
Status Code:302 Found | |
Response Headers | |
view source | |
Access-Control-Allow-Origin:* | |
Connection:Keep-Alive | |
Content-Length:0 | |
Content-Type:text/html; charset=UTF-8 |
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
'use strict'; | |
function Boot() { | |
} | |
Boot.prototype = { | |
preload: function() { | |
this.load.image('preloader', 'assets/preloader.gif'); | |
}, | |
create: function() { |
NewerOlder