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( win, doc, s_add, s_rem ) { | |
if( doc[s_add] ) return; | |
Element.prototype[ s_add ] = win[ s_add ] = doc[ s_add ] = function( on, fn, self ) { | |
return (self = this).attachEvent( 'on' + on, function(e){ | |
var e = e || win.event; | |
e.target = e.target || e.srcElement; | |
e.preventDefault = e.preventDefault || function(){e.returnValue = false}; | |
e.stopPropagation = e.stopPropagation || function(){e.cancelBubble = true}; | |
e.which = e.button ? ( e.button === 2 ? 3 : e.button === 4 ? 2 : e.button ) : e.keyCode; | |
fn.call(self, e); |
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> | |
<html> | |
<head> | |
<title>My first application on the base of Matreshka</title> | |
</head> | |
<body> | |
<input type="text" class="my-input"> | |
<div class="my-output"></div> | |
<script src="http://cdn.jsdelivr.net/matreshka/latest/matreshka.min.js"></script> | |
<script src="js/app.js"></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
var Application = Class({ | |
'extends': Matreshka, | |
constructor: function() { | |
// bind x property to the text field | |
this.bindNode( 'x', '.my-input' ); | |
// bind x property and block to my-output class | |
this.bindNode( 'x', '.my-output', { | |
setValue: function( v ) { |
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 data = [{ | |
name: 'Ida T. Heath', | |
email: 'ida@dayrep.com', | |
phone: '507-879-9766' | |
}, { | |
name: 'Robert C. Burkhardt', | |
email: 'rburkhardt@teleworm.us', | |
phone: '321-252-5698' | |
}, { | |
name: 'Gerald S. Reaves', |
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 orderBy = function(arr, keys, orders) { | |
var defaultOrder = 'asc', | |
newArr, | |
length, | |
i, | |
commonOrder; | |
if ('length' in arr && typeof arr == 'object') { | |
if (!(orders instanceof Array)) { |
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
// Some math based on https://en.wikipedia.org/wiki/Discrete_logarithm | |
// The function fastModularExponentiation allow to generate | |
// pseudo-random unique number from 0 to prime - 1. | |
// In other words every gotten number is converted to another number and returned numbers are unique | |
// Warning! When number arg is more than prime then returned numbers are going to be repeated | |
// thus for biggrer numbers we'll need to choose bigger prime number. | |
// The implementation if fastModularExponentiation is taken there https://gist.github.com/krzkaczor/0bdba0ee9555659ae5fe | |
// Primitive root calc: http://www.bluetulip.org/2014/programs/primitive.html |
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
r=(f,d=document)=>d.readyState[0]=='l'?d.addEventListener('DOMContentLoad',f):f() |
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 readCache = require('read-cache'); | |
const fs = require('fs'); | |
const { NodeVM, VMScript } = require('vm2'); | |
const optional = require('optional'); | |
/* | |
The function enhances postcss import plugin allowing CSS files to @import JS files | |
which, in their turn, import a valid PostCSS string. | |
Example code: |
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
/* | |
Usage: | |
<NiceGradient index={9} style={StyleSheet.absoluteFill} /> | |
Where index is an index from gradients array (0...14) based on https://www.behance.net/gallery/62158409/Gradients-Color-Style | |
*/ | |
import React from 'react'; | |
import { LinearGradient } from 'expo-linear-gradient'; | |
export const gradients = [ | |
['#FF6CAB', '#7366FF'], |
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 { TouchableOpacity, TouchableNativeFeedback, Platform } from 'react-native'; | |
import { createElement } from 'react'; | |
// use TouchableNativeFeedback for android and TouchableOpacity for ios | |
// use TouchableOpacity with activeOpacity=1 for both platforms if disabled=true | |
const Touchable = ({ | |
disabled, | |
onPress, | |
...props | |
}) => { |
OlderNewer