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
INSERT INTO `chapter` (`name`) VALUES ('Tjena'); | |
SET @chapter_id = LAST_INSERT_ID(); | |
INSERT INTO `user` (`email`) VALUES ('[email protected]'); | |
SET @user_id = LAST_INSERT_ID(); | |
INSERT INTO `membership` (`chapter_id`, `user_id`) VALUES (@chapter_id, @user_id); | |
--- repeat |
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 { useRef, useEffect } from 'react'; | |
const useEventListener = ( | |
eventName, | |
eventCallback, | |
eventTarget = window, | |
eventParams = null | |
) => { | |
const savedCallback = useRef(); |
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
/* @flow */ | |
/* @type-dependencies */ | |
import type MixedObjectType from './generics'; | |
export default function dissect( sourceObject : MixedObjectType, ...dissectKeys : Array<string> ) : [ MixedObjectType, MixedObjectType ] { | |
const remainingObject : MixedObjectType = {}; | |
const dissectedObject : MixedObjectType = {}; | |
for ( const [ key, value ] of Object.entries( sourceObject ) ) { |
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 zlatanify( string ) { | |
return string | |
.replace(/s/g, 'z') | |
.replace(/S/g, 'Z') | |
.replace(/ß/g, 'zz'); | |
} |
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( global ) { | |
var scriptRootNode; | |
var scriptNamespace = 'embed'; | |
var scriptNameRegex = /.*embed.js/; | |
var scriptPath = 'https://domain.tld/widget-app.js'; | |
var stylePath = 'https://domain.tld/widget-app.css'; | |
if ( ! global[ scriptNamespace ] ) | |
global[ scriptNamespace ] = {}; |
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
/* @flow */ | |
/** | |
* @type ComponentProperties | |
*/ | |
type ComponentProperties = { [ key : any ] : any } | |
/** | |
* @type ComponentNodeTree | |
*/ |
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
/* @flow */ | |
// The following three lines are from https://gist.github.com/nmn/b20a92e848c68d88f7fdb8353c71b1ca | |
type $Object<V> = { +[ key : string] : V } | |
type $ObjectValues<V, O : $Object<V>> = V | |
type $Values<O: Object> = $ObjectValues<*, O> | |
type Enumerables = { [ key : string ] : any } | |
const UserRoles : Enumerables = { |
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 int EVENT_MIN_LISTENERS | |
*/ | |
const EVENT_MIN_LISTENERS = 1; | |
/** | |
* @const int EVENT_MAX_LISTENERS | |
*/ | |
const EVENT_MAX_LISTENERS = 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
/** | |
* Object.omit | |
* | |
* Returns a (shallow) copy of an object, with specified keys omitted. | |
* | |
* @param object sourceObject | |
* @param string omitKeys, ... | |
* | |
* @return object | |
*/ |
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
class RestfulController { | |
static validRequestMethods = [ | |
'get', 'post', 'put', 'patch', 'delete' | |
]; | |
constructor() { | |
let implementedRequestMethods = []; | |
if(new.target === RestfulController) { |
NewerOlder