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 superExpensiveMapFn(num) { | |
//do something synchronous and very expensive, compounded by the fact that the array it operates on is very large | |
return num; | |
} | |
function useExpensiveDerivation(largePushOnlyArray: number[]){ | |
const prevPushOnlyArray = useRef(largePushOnlyArray); | |
const derivedArray = useRef(useMemo(() => largePushOnlyArray.map(superExpensiveMapFn), [])) |
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
/**** | |
* | |
* A super clunky svg file to react component converter very similar in spirit to the somewhat popular svgr library (https://www.npmjs.com/package/svgr/v/1.4.0) | |
* But we have the additional requirement of needing to scale the svg while __preserving__ the stroke width. And unfortunately | |
* react-native-svg does not support the only config value that would enable this. Namely, the property `vector-effect="non-scaling-stroke"`. | |
* Follow the issue here: https://github.com/react-native-community/react-native-svg/issues/885 | |
* Eventually, once the issue is resolved, we should move to svgr and simply use the svg `scale` property | |
*/ | |
const path = require("path"); |
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
//Exactly like String.replace except it ignores matches inside of single or double quotes | |
function replaceIgnoreQuoted(string, find, replaceOrCb) { | |
var quotedString = /(["'])(?:\\?.)*?\1/g; | |
var indexOfStrings = [], | |
match; | |
quotedString.lastIndex = 0; | |
while(match = quotedString.exec(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
<html lang="en"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=8" /> | |
<!--[if lt IE 8]> | |
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE8.js"></script> | |
<![endif]--> | |
<title>MeekroDB -- The Simple PHP MySQL Library</title> | |
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
app.directive("ngTap", ["$parse", function($parse) { | |
return function($scope, $element, $attributes) { | |
var tapped; | |
tapped = false; | |
$element.bind("click", function(event) { | |
if (!tapped) { | |
var fn = $parse($attributes["ngTap"]); | |
$scope.$apply(function() { | |
fn($scope, {$event:event}); | |
}); |
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
//expand-float actually isn't a mixin, but a useful class that must be given in the html | |
.expand-float:before, | |
.expand-float:after { | |
content: ""; | |
display: table; | |
} | |
.expand-float:after { | |
clear: both; | |
} |