Skip to content

Instantly share code, notes, and snippets.

View zivc's full-sized avatar

Ash zivc

View GitHub Profile
@zivc
zivc / ContactUsButton.js
Created October 27, 2022 22:35
Want to make a higher/lower order component based on NativeBase but don't want to change a whole bunch of shit or register your component via NativeBase? Cba to register a variant? Or a theme? Or some other nuance? native-base v.3.4.19 - heres a dumb reusable ContactUsButton component
import { FontAwesome5 } from "@expo/vector-icons";
import Constants from "expo-constants";
import useIconSizeInPixels from "useIconSizeInPixels";
import useNativeBaseProps from "useNativeBaseProps";
import { Box, Button, useToken } from "native-base";
import { Linking } from "react-native";
const defaultProps = {
bg: "transparent",
size: "lg",
@zivc
zivc / TextDecoder.md
Created September 26, 2022 00:01
ReferenceError: Can't find variable: TextDecoder

Error:

Using expo react-native and realm-web for iOS etc

ReferenceError: Can't find variable: TextDecoder

Solution:

This file has been truncated, but you can view the full file.
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'install' ]
2 info using npm@3.3.12
3 info using node@v5.5.0
4 silly loadCurrentTree Starting
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 silly install normalizeTree
8 silly loadCurrentTree Finishing
9 silly loadIdealTree Starting
This file has been truncated, but you can view the full file.
2001 silly mapToRegistry uri https://registry.npmjs.org/underscore.string
2002 verbose addRemoteTarball https://registry.npmjs.org/underscore.string/-/underscore.string-2.3.3.tgz not in flight; adding
2003 verbose addRemoteTarball [ 'https://registry.npmjs.org/underscore.string/-/underscore.string-2.3.3.tgz',
2003 verbose addRemoteTarball '71c08bf6b428b1133f37e78fa3a21c82f7329b0d' ]
2004 info retry fetch attempt 1 at 11:46:24 PM
2005 info attempt registry request try #1 at 11:46:24 PM
2006 http fetch GET https://registry.npmjs.org/underscore.string/-/underscore.string-2.3.3.tgz
2007 silly cache afterAdd lodash@2.4.2
2008 verbose afterAdd /Users/Ash/.npm/lodash/2.4.2/package/package.json not in flight; writing
2009 verbose afterAdd /Users/Ash/.npm/lodash/2.4.2/package/package.json written
@zivc
zivc / index.html
Last active August 29, 2015 14:14
array and key in ngOptions (plnkr.co)
<!DOCTYPE html>
<html ng-app="demo">
<head>
<script data-require="angular.js@*" data-semver="1.4.0-beta.2" src="https://code.angularjs.org/1.4.0-beta.2/angular.js"></script>
<link rel="stylesheet" href="style.css" />
<script src="script.js"></script>
</head>
<body>
@zivc
zivc / user24.js
Last active August 29, 2015 14:08
Get every element that has 100% width
[].forEach.call(document.querySelectorAll('*'), function($element) {
var style = window.getComputedStyle($element);
console.log(style.width == "100%" || (style.display == "block" && style.width == "auto"));
});
@zivc
zivc / inviteall.js
Created October 5, 2014 15:38
Invite all friends to an event on Facebook javascript
/*
Scroll to the bottom of the lazy loading list and then put this in your console
*/
[].forEach.call(
document.querySelectorAll('.multiColumnCheckable.checkableListItem'),
function(friend) {
if (friend.className.indexOf('disabledCheckable')<0) { // check to make sure that they're not already invited
friend.click();
}
}
@zivc
zivc / Three column layout with fixed width middle column
Created September 16, 2014 16:14
Three column layout with one column centered with a fixed size and the two other columns filling the empty voids.
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
</head>
<body>
(function(){
var log = console.log;
console.log = function(str) {
var css = 'background: linear-gradient(to right, red, yellow, lime, aqua, blue, fuchsia, red); color: white; font-weight: bold;';
var args = Array.prototype.slice.call(arguments);
args[0] = '%c' + args[0];
args.splice(1,0,css);
var speech = new SpeechSynthesisUtterance();