Skip to content

Instantly share code, notes, and snippets.

View alonronin's full-sized avatar
:octocat:
Me. Write. Code.

Alon Valadji alonronin

:octocat:
Me. Write. Code.
View GitHub Profile
@alonronin
alonronin / cms.js
Last active December 12, 2015 22:14
Ronin CMS
'use strict';
var app = require('./app');
var models = require('./models');
var async = require('async');
var _ = require('lodash');
/*
middle-wares
*/
var config = models.config.middleware();
@alonronin
alonronin / api.js
Created June 14, 2017 11:37
An api implementation using Proxy
const target = {};
const handler = {
get(target, property, receiver) {
return fetch(`https://jsonplaceholder.typicode.com/${property}`)
.then(r => r.json())
}
};
const api = new Proxy(target, handler);
@alonronin
alonronin / async.test.js
Created September 28, 2017 21:01
Jest async await test
const myPromise = () => Promise.resolve('ok');
describe('Async - Await Test', () => {
test('Async', async () => {
expect(await myPromise()).toBe('ok');
})
});
@alonronin
alonronin / README.md
Last active June 20, 2019 11:04
Cross Domain LocalStorage

Cross Orrigin LocalStorage

Get access to LocalStorage on Cross-Origin Domains.

Usage

Put the iframe.html in your remote domain.

@alonronin
alonronin / index.html
Created January 21, 2020 02:37
JS Bin friendly iframe // source https://jsbin.com/setudej/2
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="friendly iframe">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
html {
height: 100vh;
@alonronin
alonronin / chasis.js
Last active February 24, 2020 17:45
JS-IL 02/2020
const express = require('express');
const { json, urlencoded } = require('body-parser');
const helmet = require('helmet');
const cors = require('cors');
const morgan = require('morgan');
const debug = require('debug');
const compression = require('compression');
const http = require('http');
const camelCase = require('lodash.camelcase');
@alonronin
alonronin / save-heroku-config-vars-to-env.sh
Created July 27, 2023 11:56 — forked from llighterr/save-heroku-config-vars-to-env.sh
Command line to save Heroku config vars into .env file
heroku config | sed 's/: */=/g; /^=/d' >> .env
import { RequestInit } from 'next/dist/server/web/spec-extension/request';
type DefaultOptions = {
baseUrl: string;
headers: Headers;
};
const defaultOptions: DefaultOptions = {
baseUrl: '',
headers: new Headers({