Skip to content

Instantly share code, notes, and snippets.

View levynir's full-sized avatar

Nir Levy levynir

  • Zoomd
  • Hertzelia
View GitHub Profile
@levynir
levynir / calculator.js
Last active March 31, 2022 11:44
temp file
const calculator = () => {
document.getElementById('calculate_button').onClick = () => {
alert('1');
}
};
calculator();
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:base="https://www.agora.co.il/" xml:lang="he">
<!--
אודות פיד זה
^^^^^^^^^^^^
דף זה הינו פיד המציג מודעות בהתאם לקריטריונים שהגדרת.
לאחר הרשמה לפיד זה, תקבל עידכונים אוטומטיים בכל פעם שמודעה חדשה אשר מתאימה לקריטריונים תופיע באתר.
איך להירשם לפיד זה
^^^^^^^^^^^^^^^^^^
@levynir
levynir / Dockerfile
Created June 23, 2019 13:09
Dockerfile for local node.js application
FROM node:8-alpine
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY . .
RUN npm install
EXPOSE 3000
CMD [ "npm", "start" ]
#Some of this was copied from https://www.freecodecamp.org/news/how-to-deploy-a-node-js-application-to-amazon-web-services-using-docker-81c2a2d7225b/
@levynir
levynir / install-aws.bash
Created June 23, 2019 13:05
script to install AWS CLI on macOS
#!/bin/bash
curl -O https://bootstrap.pypa.io/get-pip.py
python get-pip.py --user
pip install awscli --upgrade --user
echo \"export PATH=\${PATH}:`ls -1d ${HOME}/Library/Python/*.*/bin | tail -1`\" >> ~/.profile
aws configure
@levynir
levynir / make-docker.bash
Last active June 23, 2019 12:47
Script to build a docker for AWS
#!/bin/bash
if [[ $(git diff --stat) != '' ]]; then
echo "*** ERROR *** GIT reports this directory to be dirty.Please commit and push to master before building "; exit 1
fi
APPNAME=dayzz/dayzz-bi
REGION=us-east-2
AWS_CMD=`aws ecr get-login --no-include-email --region $REGION`
AWS_URI=`echo $AWS_CMD | awk '{print $7}' | sed -E "s/https\:\/\///"`
@levynir
levynir / axios-debounce-cache.js
Last active September 17, 2018 08:37
axios debounce cache demo
import axios from 'axios';
import {MD5} from 'object-hash'; //npm install object-hash
const hash=MD5; //MD5 is less secure but much faster on my production linux machines
export class ServerConnection {
static _defaultOptions = {debounce: true, ttl:1000};
static _once = {};
static cache(func,options,...params) {
options = options || ServerConnection._defaultOptions;
@levynir
levynir / i18n.js
Last active July 4, 2017 07:10
Simple add-on to RN I18N package to help working with RTL language and properly support RTL devices even if you are not supporting RTL in your app.
import {I18nManager} from 'react-native';
import I18n from 'react-native-i18n';
import en from './locales/en';
import he from './locales/he';
/*
We are very likely not to have all the languages translated,
so fallback to default locale in case we don't
*/
I18n.fallbacks = true;
@levynir
levynir / RotatingView.js
Last active January 19, 2021 09:52
React Native Rotating Component
/**
* Created by nirlevy on 02/07/2017.
* MIT Licence
*/
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Animated, Easing } from 'react-native';
export class RotatingView extends Component {
state = {