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 cfg from '../lib/config-parser'; | |
var customMatchers = { | |
toEqualMap: (util, customEqualityTesters) => { | |
return { | |
compare: (actual, expected) => { | |
var result = {}; | |
result.pass = util.equals([...actual], [...expected], customEqualityTesters); | |
if(!result.pass) { |
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
/** | |
* Return a copy of `obj` with the specified properties removed | |
* Modified from Babel source code | |
*/ | |
function objectWithoutProperties (obj: Object, keys: string[]): any { | |
let target = {} | |
for (var i in obj) { | |
if (keys.indexOf(i) >= 0) { continue } | |
if (!Object.prototype.hasOwnProperty.call(obj, i)) { continue } | |
target[i] = obj[i]; |
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
{"country":"England","result_count":1665,"longitude":-0.0651563649706527,"area_name":" E8","listing":[{"image_caption":"","status":"for_sale","num_floors":"0","listing_status":"sale","num_bedrooms":"2","agent_name":"Hollyton","latitude":51.524952,"agent_address":"42 Upper Berkeley Street, London","num_recepts":"0","property_type":"Flat","country":null,"longitude":-0.087046,"first_published_date":"2015-09-24 11:35:48","displayable_address":"City Road, Bezier Apartments EC1Y","floor_plan":["http://lc.zoocdn.com/b2b23e06251cd544a4907209b70fef3476a36d90.jpg"],"street_name":"","num_bathrooms":"0","thumbnail_url":"http://li.zoocdn.com/80c74240b27c6eea5ce36fe74205d9be8a57c993_80_60.jpg","description":"This stunning 2 bedroom, 3 bathroom penthouse apartment set on the 14th floor of the new development- Bezier Apartments by renowned developers City House Development Ltd. This property consists of a bright open-plan reception room attached to an ultra-modern fitted kitchen that caters to all needs with generous storage |
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
{ "Test": 1 } |
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 webpack = require('webpack'); | |
var path = require('path'); | |
var WebpackNotifierPlugin = require('webpack-notifier'); | |
module.exports = { | |
devtool: 'eval', | |
entry: [ | |
// Add the react hot loader entry point - in reality, you might only want this in your dev config | |
'react-hot-loader/patch', | |
'webpack-dev-server/client?http://localhost:3000', |
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
/** | |
* I recently needed to upload a file from the phone's filesystem to S3 using temporary credentials | |
* (i.e. access key, secret key and session token) issued by an API for a React Native application, | |
* without the overhead of Base64 encoding the file and passing it over the bridge (as it could be | |
* several MB big), and wanted to avoid writing native code to do this. | |
* | |
* None of the S3 libraries online worked with the temporary credentials, but I figured out a | |
* solution using the official AWS SDK (which is good, as it supports all the relevant authentication | |
* out of the box) and the react-native-fetch-blob module, which allows you to upload directly from the | |
* filesystem with the correct Content-type header (as far as I can tell, React Native's fetch only |
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 drawLine = regl({ | |
frag: ` | |
precision mediump float; | |
uniform vec4 color; | |
void main() { | |
gl_FragColor = color; | |
}`, | |
vert: ` | |
precision mediump float; |
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
<button id="close">close me</button> | |
<script> | |
document.getElementById('close').addEventListener('click', function() { | |
alert(1); | |
window.close(); | |
}); | |
</script> |
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
interface IState { | |
sticky: boolean; | |
} | |
export class HeaderBar extends React.Component<{}, IState> { | |
sentinelRef: React.RefObject<HTMLDivElement>; | |
observer: IntersectionObserver; | |
state = { sticky: false }; |
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 pkg = require('react-static/package.json'); | |
let packageConfig = {}; | |
try { | |
packageConfig = require(path.resolve(process.cwd(), 'package.json')); | |
packageConfig = packageConfig['react-static'] || {}; | |
} catch (err) { | |
} | |
const argv = {}; |