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 React, { useEffect, useState } from 'react'; | |
import { Canvas, RoundedRect } from '@shopify/react-native-skia'; | |
import { useSharedValue, withRepeat, withSequence, withTiming } from "react-native-reanimated"; | |
import { Dimensions } from 'react-native'; | |
// Number of cards to render | |
const items = 50; | |
// Array of cards with unique id | |
const cards = new Array(items).fill(null).map((_, idx) => `k-${idx}`) |
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 object recreate speed on large objects vs small objects | |
function createObject(propsCount) { | |
const obj = {}; | |
for (let i = 0; i < propsCount; i += 1) { | |
obj[`p${i}`] = i; | |
} | |
return obj; | |
} |
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 onOpen() { | |
var menuEntries = [{ name: "Download JSON", functionName: "convertToJson" }]; | |
var sheet = SpreadsheetApp.getActiveSpreadsheet(); | |
sheet.addMenu("Utils", menuEntries); | |
} | |
function convertToJson() { | |
const sheet = SpreadsheetApp.getActiveSheet(); | |
const lastRow = sheet.getLastRow(); |
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
/** | |
* Keep this file in the project root | |
* | |
* Overrides configuration for metro-bundler so that any | |
* symlinked library (npm link) is automatically added | |
* to project root (listened for changes). Also all the | |
* dependencies and peerDependencies are provided through | |
* `extraNodeModules` options (which is the main problem | |
* with symlinked libraries in react-native). | |
* |
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 os = require('os'); | |
export default function getLocalIP() { | |
const ifaces = os.networkInterfaces(); | |
const ifnames = Object.keys(ifaces); | |
for (let i = 0; i < ifnames.length; i += 1) { | |
const aliases = ifaces[ifnames[i]]; | |
for (let j = 0; j < aliases.length; j += 1) { | |
const iface = aliases[j]; |
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
#!/bin/bash | |
# Copy this script with run permission inside | |
# /usr/local/bin/vm-ubuntu | |
# Script to start and ssh to a VM on Virtual Box | |
# It starts the VM in headless mode (if not already started) | |
# This script assumes an Ubuntu Virtual Box named "Ubuntu" | |
# is already created with NAT network mode with host port |
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 JSON formatter that transforms the incoming | |
* stream of JSON data (without proper formatting) | |
* into properly formatted JSON string. | |
* Usage: | |
* yourInputStream.pipe(createJSONFormatter()).pipe(yourOutputStream); | |
*/ | |
const Transform = require('stream').Transform; |
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
#!/bin/sh | |
# Simple script for getting geo information from ip or host name. | |
# This script uses linux command `host` to get ip address for | |
# the given domain name. It also depends on `http://ipinfo.io/` | |
# to get the geo information. | |
# | |
# The valid_ip function has been copied directly from | |
# http://www.linuxjournal.com/content/validating-ip-address-bash-script | |
# | |
# INSTALLATION |
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 generateDocs(count) { | |
const docs = []; | |
for (let i = 0; i < count; i += 1) { | |
docs.push({ | |
id: i + 1, | |
name: `Name${i}`, | |
processed: 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
/** | |
* Benchmarking the array modification for redux using different techniques | |
*/ | |
const ITERATIONS = 500000; | |
// Create an array with the given length | |
function range(length) { | |
const list = []; | |
for (let i = 0; i < length; i += 1) { | |
list.push(Math.random()); |
NewerOlder