Skip to content

Instantly share code, notes, and snippets.

View orYoffe's full-sized avatar
🇺🇦
Stand with Ukraine

Or Yoffe orYoffe

🇺🇦
Stand with Ukraine
View GitHub Profile
@orYoffe
orYoffe / simple.html
Created September 30, 2020 12:10
html page
<!DOCTYPE html> <!-- This tag specifies we use HTML5, the newest version of HTML -->
<html> <!-- Our opening html tag that everything else goes inside of it -->
<head><!-- Our opening head tag will contain meta data like page title scripts, styles and more.. -->
<meta charset="UTF-8">
<!-- a meta tag that informs the browser we will use utf-8 to show all languages, like arabic, greek and hebrew -->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- a meta tag that informs the browser to keep the maximum width to fit the device (mainly used for mobile) -->
<title>My website title</title>
<!-- Our page title tag (content will show at the tab of the browser) -->
<style>
@orYoffe
orYoffe / setup_android_studio.sh
Created April 11, 2020 07:54 — forked from bmc08gt/setup_android_studio.sh
Android Studio bash installation script
#!/bin/bash
# only works atm if only one jdk package in downloads
DOWNLOADS=$HOME/Downloads
CURRENT_VERSION=$(java -version 2>&1)
JDK=` ls $DOWNLOADS | grep "jdk"`
STUDIO_URL=http://dl.google.com/android/studio/install/0.3.2/android-studio-bundle-132.893413-linux.tgz
if [ "uname -m" == "i386" -o "uname -m" == "i686" ]; then
ARCH=32
else
@orYoffe
orYoffe / git_newrepo
Created April 11, 2020 07:45 — forked from c0ldlimit/git_newrepo
Git: Push a new or existing repo to Github
# Create a new repository on the command line
touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/c0ldlimit/vimcolors.git
git push -u origin master
# Push an existing repository from the command line
@orYoffe
orYoffe / iris-tensorflow-js.js
Created April 11, 2020 05:15 — forked from learncodeacademy/iris-tensorflow-js.js
Solving Iris with Tensorflow.js and Iris JSON dataset
import * as tf from "@tensorflow/tfjs"
import "@tensorflow/tfjs-node"
import iris from "./iris.json"
import irisTesting from "./iris-testing.json"
// convert/setup our data
const trainingData = tf.tensor2d(iris.map(item => [
item.sepal_length, item.sepal_width, item.petal_length, item.petal_width,
]))
const outputData = tf.tensor2d(iris.map(item => [
@orYoffe
orYoffe / download-multiple-files.js
Created March 29, 2020 06:43 — forked from noelvo/download-multiple-files.js
Download multiple files then compress to one zip file using JSZip & JSZip-utils
var zip = new JSZip();
var count = 0;
var zipFilename = "zipFilename.zip";
var urls = [
'http://image-url-1',
'http://image-url-2',
'http://image-url-3'
];
urls.forEach(function(url){
@orYoffe
orYoffe / jstates_react_simple_example.js
Last active July 25, 2020 09:23
jstates_react_simple _example
import { createState, subscribe, useSubscribe } from "jstates-react";
const counterState = createState({ counter: 0 });
const addOne = () => counterState.setState(state => ({ counter: ++state.counter }));
const removeOne = () => counterState.setState(state => ({ counter: --state.counter }))
function Counter() {
return (
@orYoffe
orYoffe / jstates_simple_example.js
Last active July 23, 2020 15:29
jstates simple example
const createState = require("jstates");
const myState = createState({ counter: 0 });
function onUpdate(state) {
console.log("onUpdate: counter =", state.counter);
}
myState.subscribe(onUpdate);
myState.setState(state => ({ counter: ++state.counter }));
@orYoffe
orYoffe / removeBanner.js
Created August 7, 2019 16:52
a script to add a button that would remove blocking banners
let banner;
function removeBanner() {
banner = document.elementFromPoint(300, 300);
if (banner.offsetWidth > 600) {
banner.parentNode.removeChild(banner);
console.log('!!! removeBanner ------ removed');
} else {
console.log('!!! removeBanner ------ did not removed')
}
@orYoffe
orYoffe / common.js
Created December 28, 2018 13:48
How to tel which env you are on with react native and react native web
import { Platform } from 'react-native';
const isWeb = Platform.OS === 'web';
const isNative = !isWeb;
const isIos = Platform.OS === 'ios';
const isAndroid = Platform.OS === 'android';
const isDesktop = isWeb && typeof matchMedia !== 'undefined' && matchMedia('(min-width: 768px)').matches;
const isMobile = !isDesktop;
const HelloReact = () => (
<div>
<p>Hello React</p>
</div>
);
const HelloReactNative = () => (
<View>
<Text>Hello ReactNative</Text>
</View>