This file contains hidden or 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 str = "áàâäãéèëêíìïîóòöôõúùüûñçăşţ"; | |
str.normalize('NFKD').replace(/[^\w]/g, ''); | |
// 'aaaaaeeeeiiiiooooouuuuncast' |
This file contains hidden or 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 base64_encode(file) { | |
var bitmap = fs.readFileSync(file); | |
return new Buffer(bitmap).toString('base64'); | |
} |
This file contains hidden or 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 function vibrance(ele, min, max, speed, color1 = '#ff1e9b', color2 = '#1eccff'){ | |
const self = this; | |
setTimeout(() => { | |
let rndNumber = self._randomIntFromInterval(min, max); | |
let strStyle = rndNumber + 'px 0px 0px ' + color1 + ', -' + rndNumber + 'px 0px 0px ' + color2; | |
ele.style.textShadow = strStyle; | |
self._vibrance(ele, min, max, speed, color1 = '#ff1e9b', color2 = '#1eccff'); | |
}, speed); | |
} |
This file contains hidden or 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
// Check if a string has a special character | |
export function hasSpecial(str){ | |
const iChars = "~`!#$%^&*+=-[]\\\';,/{}|\":<>?"; | |
for (let i = 0; i < str.length; i++) { | |
if (iChars.indexOf(str.charAt(i)) != -1) { | |
return true; | |
} | |
} | |
return false; | |
} |
This file contains hidden or 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 rndColor(){return '#'+(0x1000000+(Math.random())*0xffffff).toString(16).substr(1,6);} |
This file contains hidden or 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 fs = require('fs'); | |
var http = require('http'); | |
var https = require('https'); | |
var privateKey = fs.readFileSync('sslcert/server.key', 'utf8'); | |
var certificate = fs.readFileSync('sslcert/server.crt', 'utf8'); | |
var credentials = {key: privateKey, cert: certificate}; | |
var express = require('express'); | |
var app = express(); |
This file contains hidden or 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 shuffle(array) { | |
var currentIndex = array.length, temporaryValue, randomIndex; | |
// While there remain elements to shuffle... | |
while (0 !== currentIndex) { | |
// Pick a remaining element... | |
randomIndex = Math.floor(Math.random() * currentIndex); | |
currentIndex -= 1; |
This file contains hidden or 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
$ mkdir android/app/src/main/assets | |
$ react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res | |
$ react-native run-android |
This file contains hidden or 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
// Libraries | |
import React, { Component } from 'react'; | |
import PropTypes from 'prop-types'; | |
class SearchBox extends Component { | |
constructor(props) { | |
super(props); | |
this.onChange = this.onChange.bind(this); |
This file contains hidden or 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 getURLParameter(name) { | |
return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search) || [null, ''])[1].replace(/\+/g, '%20')) || null; | |
} |
NewerOlder