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 interface Fn<T, P extends any[], R> { | |
(this: T, ...args: P) : R; | |
} | |
export type UnboundParams<F extends Fn<any, [ ...BindP, ...any[] ], any>, BindP extends any[]> | |
= F extends Fn<any, [ ...BindP, ...infer CallP ], any> ? CallP : never; | |
export type BoundFn<F extends Fn<any, [ ...BindP, ...any[] ], any>, BindP extends any[]> | |
= F extends Fn<infer T, [ ...BindP, ...infer CallP ], infer R> | |
? Fn<T, CallP, R> |
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 { languages } from 'prismjs'; | |
const extra_keywords = [ | |
{ | |
pattern: /\b(?:memory\.(?:init|copy|fill)|data\.(?:drop)|table\.(?:init|copy|grow|size|fill|get|set)|elem\.(?:drop)|ref\.(?:null|is_null|func))\b/, | |
inside: { | |
'punctuation': /\./ | |
} | |
}, |
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 { marked } from 'marked'; | |
export interface DescriptionListToken extends marked.Tokens.Generic { | |
items: (DescriptionTermToken | DescriptionDetailToken)[]; | |
} | |
export interface DescriptionTermToken extends marked.Tokens.Generic { | |
text: string; | |
} |
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 { randomBytes } from 'crypto'; | |
const charset = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'; | |
const randomString = (length) => { | |
return new Promise((resolve, reject) => { | |
const chars = new Array(length); | |
randomBytes(length, (error, bytes) => { | |
if (error) { |
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 size = 32000000; | |
const rand = () => Math.random() * 100; | |
console.log('Generating test data...'); | |
let data = new Array(size); | |
for (let i = 0; i < size; i++) { | |
data[i] = rand(); |
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() { | |
// | |
var isInheriting = false; | |
// | |
// | |
// | |
function Model(originalDTO) { | |
if (! isInheriting) { |
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
// | |
// Finds a specified property path in a nested object structure | |
// | |
// @param {obj} the object to search | |
// @param {path} the property path (eg. "foo.bar.[0].{baz:qux}.property") | |
// @return object | |
// | |
function findObjectScope(obj, path) { | |
var scope = obj; | |
var steps = path.split('.'); |
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 promises(func) { | |
var promiseIndex = func.length - 1; | |
return function() { | |
var scope = this; | |
var args = Array.prototype.slice.call(arguments); | |
var promise = args[promiseIndex] = args[promiseIndex] || new oath(); | |
process.nextTick(function() { | |
func.apply(scope, args); |
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
<?php | |
$mysql = mysqli_connect("localhost","root","","test"); | |
if (mysqli_connect_errno($mysql)){echo "Failed to connect to database";} | |
$user = "rebel24"; | |
$input = mysqli_query($mysql,"SELECT * FROM `userdata` WHERE `Username` = '$user';"); | |
//while ($row = mysqli_fetch_array($input)){ |
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
<?php while (have_posts()) : the_post(); $count++; ?> | |
<?php $video = get_field('video'); ?> | |
<a href="#" onclick="switchVideo(this, '<?php echo $video; ?>'); return false;" class="vidtn"> | |
<img src="<?php echo the_field('vidthumbnail'); ?>" /> | |
</a> | |
<?php endwhile; ?> | |
<script type="text/javascript"> | |
// | |
// @param original the DOM element of the existing video to be replaced |
NewerOlder