Skip to content

Instantly share code, notes, and snippets.

View bermanboris's full-sized avatar
🎯
Hyper Focusing

Boris Berman bermanboris

🎯
Hyper Focusing
  • Earth
View GitHub Profile
@bermanboris
bermanboris / typescript-create-service.ts
Created June 11, 2018 09:19
TypeScript 2018 - Create Service Example Code (with declarations)
export type ServiceDefinition = {
[x: string]: MethodDefinition;
};
export type MethodDefinition = {
[x: string]: StringConstructor | NumberConstructor;
};
export type ServiceObject<T extends ServiceDefinition> = {
[P in keyof T]: ServiceMethod<T[P]>
@bermanboris
bermanboris / prettier-brower.js
Created June 3, 2018 18:04
Prettier in your browser!
import prettier from "prettier/standalone";
import path from "path";
const plugins = [
require("prettier/parser-graphql"),
require("prettier/parser-babylon")
];
const EXTENSION_TO_PARSER = {
ts: "typescript",
@bermanboris
bermanboris / angular-dynamic-property-decorator.ts
Last active December 18, 2017 20:13
Angular Dynamic Properties Decorator
import { Component } from '@angular/core';
import { HttpClient } from '@angular/common/http';
function getData(url) {
return function (target, key) {
const privateKey = `_${key}`
function getter() {
if (this[privateKey]) {
return this[privateKey];
@bermanboris
bermanboris / aws-codedeploy-agent-installation.sh
Last active May 18, 2021 08:52
Installation of AWS CodeDeploy Agent on Ubuntu 16.04
#!/bin/bash
sudo apt-get update -y
sudo apt-get install ruby wget -y
cd /home/ubuntu
wget https://aws-codedeploy-eu-central-1.s3.amazonaws.com/latest/install
chmod +x ./install
@bermanboris
bermanboris / webpack-symlink-trick.md
Created September 15, 2017 18:38 — forked from christiannaths/webpack-symlink-trick.md
Webpack: avoid relative import paths by symlinking a shortcut
@bermanboris
bermanboris / Layout.js
Created July 30, 2017 09:03 — forked from gustavlrsn/Layout.js
Example bootstrap 4 integration into Next.js, with the reactstrap package
import Head from 'next/head'
import { Container } from 'reactstrap'
const Layout = (props) => (
<div>
<Head>
<title>PairHub</title>
<meta name="viewport" content="initial-scale=1.0, width=device-width" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" />
</Head>
@bermanboris
bermanboris / hide_low_rating.js
Last active July 5, 2017 12:16
Hide restaurants with rating less than 10 in https://www.mishlohim.co.il
// Copy and paste this code to the Developer Console
$(".link span").each(function(index,elem) {
if($(this).text() < 10) {
$(this).parent().parent().parent().parent().parent().parent().hide()
}
})
@bermanboris
bermanboris / calculator.js
Created April 29, 2017 12:25
sum function
function sum( a, b ) {
return a + b;
}
{
"name": "Československé Státní Aerolinie (ČSA) Flight OK540",
"occurrenceType": "Accident",
"image": "Ilyushin_Il-62,_CSA_-_Ceskoslovenske_Aerolinie_AN0197189.jpg",
"caption": "An CSA Il-62, similar to the accident aircraft",
"date": "1975-08-19T21:00:00.000Z",
"summary": "CFIT",
"site": "Damascus International Airport",
"aircraftType": "Ilyushin Il-62",
"aircraftName": "Brno Trade Fair",
@bermanboris
bermanboris / postgres-notify-trigger.sql
Created February 11, 2017 10:26 — forked from bithavoc/postgres-notify-trigger.sql
I used this trigger to notify table changes via NOTIFY (migrating off RethinkDB)
CREATE OR REPLACE FUNCTION notify_trigger() RETURNS trigger AS $$
DECLARE
channel_name varchar DEFAULT (TG_TABLE_NAME || '_changes');
BEGIN
IF TG_OP = 'INSERT' THEN
PERFORM pg_notify(channel_name, '{"id": "' || NEW.id || '"}');
RETURN NEW;
END IF;
IF TG_OP = 'DELETE' THEN
PERFORM pg_notify(channel_name, '{"id": "' || OLD.id || '"}');