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
/** | |
* Making promises | |
*/ | |
let okPromise = Js.Promise.make((~resolve, ~reject as _) => [@bs] resolve("ok")); | |
/* Simpler promise creation for static values */ | |
Js.Promise.resolve("easy"); | |
Js.Promise.reject(Invalid_argument("too easy")); |
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
/** | |
* Created by Guy Blank on 3/9/17. | |
* | |
* This is a sample provides an API to send & receive messages to and from the React-Native WebView (using postMessage/onMessage WebView API). | |
* A sample project that uses the bridge is available here https://github.com/blankg/rn-webview-bridge-sample | |
* | |
* webViewBridge.send('functionToInvoke', {mydata: 'test'}, function(){console.log('success')},function(){console.log('error')}); | |
* | |
* The API is designed to be similar to the Cordova exec API so migration to it should be almost seamless. | |
* The API also provides solution to a React-Native WebView bug in iOS which causes sending consecutive postMessage calls to override each other. |
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 EventEmitter | |
/// Shared Instance. | |
public static var sharedInstance = EventEmitter() | |
// ReactNativeEventEmitter is instantiated by React Native with the bridge. | |
private static var eventEmitter: ReactNativeEventEmitter! | |
private init() {} |
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
<h2> Hello World! </h2> | |
<script> | |
function iframeResize() { | |
var body = document.body, html = document.documentElement; | |
var height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight); | |
var location = document.location.href; | |
window.parent.postMessage(["setHeight", height, location], "*"); | |
} | |
iframeResize(); | |
$(window).resize(iframeResize); |
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
/** | |
* Битовые маски в UI | |
* Автор: Игорь Алексеенко | |
*/ | |
// состояния компонентов | |
class Button { | |
constructor() { | |
this.state = |
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 | |
/* eslint-disable */ | |
declare module 'redux-form' { | |
declare export type InputProps = { | |
checked?: boolean, | |
name: string, | |
value: any, | |
onBlur: Function, | |
onChange: Function, |
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
<!DOCTYPE html> | |
<head> | |
<title>HTML5 Camera Fun</title> | |
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script> | |
<script src="http://www.nihilogic.dk/labs/exif/exif.js" type="text/javascript"></script> | |
<script src="http://www.nihilogic.dk/labs/binaryajax/binaryajax.js" type="text/javascript"></script> | |
<script type="text/javascript"> | |
// Wrapper around MPL-licensed http://www.nihilogic.dk/labs/binaryajax/binaryajax.js | |
// to support JavaScript typed arrays since binary strings are not supported in IE 10 | |
var createBinaryFile = function(uintArray) { |
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 crc32(s/*, polynomial = 0x04C11DB7, initialValue = 0xFFFFFFFF, finalXORValue = 0xFFFFFFFF*/) { | |
s = String(s); | |
var polynomial = arguments.length < 2 ? 0x04C11DB7 : (arguments[1] >>> 0); | |
var initialValue = arguments.length < 3 ? 0xFFFFFFFF : (arguments[2] >>> 0); | |
var finalXORValue = arguments.length < 4 ? 0xFFFFFFFF : (arguments[3] >>> 0); | |
var table = new Array(256); | |
var reverse = function (x, n) { | |
var b = 0; |
NewerOlder