Skip to content

Instantly share code, notes, and snippets.

View YaakovHatam's full-sized avatar
🎯
Focusing

Yaakov Hatam YaakovHatam

🎯
Focusing
View GitHub Profile
@YaakovHatam
YaakovHatam / meta-tags.md
Last active May 2, 2016 07:41 — forked from kevinSuttle/meta-tags.md
List of Usable HTML Meta and Link Tags
@YaakovHatam
YaakovHatam / react-routing.js
Created December 30, 2018 19:46
React routing
import React from "react";
import { BrowserRouter, Route, Link } from "react-router-dom";
const App = () => (
<BrowserRouter>
<div>
<Header />
<main>
<Route exact path='/' component={Home} />
<Route exact path="/student" component={Students} />
@YaakovHatam
YaakovHatam / app.component.html
Created March 7, 2019 18:00
Update angular data service every X seconds
<input [(ngModel)]='num'>
<button (click)='send()'>Send</button>
<ul *ngIf='nums'>
<li *ngFor='let number of nums'> {{ number }} </li>
</ul>
@YaakovHatam
YaakovHatam / angular-app.module.ts
Last active March 11, 2019 19:18
Using socket.io angular - nodejs
import .....
// socket io
import { SocketIoModule, SocketIoConfig } from 'ngx-socket-io';
const config: SocketIoConfig = { url: 'http://localhost:8888', options: {} };
// end socket io
....
....
....
....
@YaakovHatam
YaakovHatam / naming.md
Created August 14, 2019 17:55
JavaScript naming rules

Variable and function names written as camelCase

Global/Constants variables written in UPPERCASE

$ in start of variable name used to hold JavaScript library objects

  • variables:
@YaakovHatam
YaakovHatam / index.html
Created September 8, 2019 08:26
Very simple nodejs with static html file and API
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<script src="jquery.js"></script>
</head>
<body>
@YaakovHatam
YaakovHatam / requireUncached.js
Created November 17, 2019 17:29
Nodejs require module without cache
const a1 = requireUncached('./mdl')('moshe')
const a2 = requireUncached('./mdl')('moshe1')
const a3 = requireUncached('./mdl')('moshe2')
function requireUncached(module){
delete require.cache[require.resolve(module)]
return require(module)
}
@YaakovHatam
YaakovHatam / weather.js
Last active November 22, 2019 09:25
Open weather map simple code example
// const ENDPOINT = 'http://api.openweathermap.org/data/2.5/weather?q=jerusalem&units=metric&appid=1e8ffdb64b7d4d8dbdd4bf3a700bdeb0';
const ENDPOINT = 'weather.json';
fetch(ENDPOINT).then(res => res.json().then(weatherData => {
console.log(weatherData);
}))
@YaakovHatam
YaakovHatam / builder.js
Last active November 29, 2019 09:48
openwaethermap-builder.js
function OpenweathermapBuilder(key) {
var queryStringParams;
var baseApiUrl;
baseApiUrl = 'http://api.openweathermap.org/data/2.5/weather';
queryStringParams = [];
init();
function init() {
import java.util.concurrent.ThreadLocalRandom;
public class HelloWorld {
public static void main(String []args){
int x = 13;
int y = 5;
// math operators
int addition = x + y; // 18