Skip to content

Instantly share code, notes, and snippets.

View eladb's full-sized avatar
🤖

Elad Ben-Israel eladb

🤖
View GitHub Profile
@eladb
eladb / trace.js
Created September 1, 2012 08:27
Who calls `path.exists`?
#!/usr/bin/env node
function trace(base) {
return function() {
console.log('called at:', new Error().stack.split('\n')[2].trim());
return base.apply(this, arguments);
};
}
var path = require('path');
path.exists = trace(path.exists);
@eladb
eladb / express-csvdb.js
Created September 11, 2012 12:32
node-express-csvdb
var csvdb = require('csvdb');
var express = require('express');
var path = require('path');
//
// Returns an `express` middleware that can used to
// `source` is the url of the csv source (required)
// `options.filter` is a function called for each entry in `source` and allows one to filter the served results (default is no filter).
// `options.autofetch` is an interval for autofetching from source (default 5000ms).
// `options.view` is the name of a view to render when requests come in with `http` in their `accept` header (optional).
@eladb
eladb / hello.md
Created January 21, 2014 14:40
Test gist.io

Hello

This is my first gist

- (void)viewDidLoad
{
[super viewDidLoad];
[self hopTo:@"splash" then:^{
[self hopTo:@"onboarding" then:^{
[self login];
}];
}];
}
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
if ([keyPath isEqualToString:@"currentUser"]) {
if (self.currentUser) {
[self hopTo:@"main" then:nil];
}
else {
[self hopTo:@"signup_login" then:nil];
}
}
- (void)setupCamera
{
self.coreImageContext = [CIContext contextWithOptions:nil];
// session
self.cameraSession = [[AVCaptureSession alloc] init];
[self.cameraSession setSessionPreset:AVCaptureSessionPresetPhoto];
[self.cameraSession commitConfiguration];
// input
@eladb
eladb / relnotes.rb
Created June 10, 2014 09:20
Markdown release notes since last bump commit with github links
#!/usr/bin/env ruby
#
# relnotes.rb
# Markdown release notes since last bump commit with github links
# Awesome for creating release notes for a release.
#
# Usage: ruby relnotes.rb [github-prefix]
#
# The script will extract all git commits since the last "bump commit" (a commit with the text "bump")
# and will generate a bulletted description of all the commits. If `github-prefix` is provided (e.g. "eladb/myrepo"),
#!/bin/bash
set -eu # we don't want "pipefail" to implement idempotency
###
# Usage: ./publish-mvn.sh
#
# Publishes the content of an offline Maven repository to Maven Central.
#
# This script expects the following environment variables to be set to appropriate
# values (which can be achieved by using scripts/with-signing-key.sh):
@eladb
eladb / extract-jsii.sh
Last active January 19, 2021 11:19
Reflecting on the AWS CDK Type System using jsii-reflect
#!/bin/bash
set -euo pipefail
# given an aws-cdk bundle archive (the one published to github releases), extract
# all .jsii manifests and places them under "jsii/*.jsii"
# now they can be used with jsii-reflect
zip=${1:-}
if [ -z "${zip}" ]; then
echo "Usage: $(basename $0) <cdk-bundle-zip>"
const markets = {
  'US': { region: 'us-east-1', account: '1234' },
  'EU': { region: 'eu-west-2', account: '3333' },
};


interface MyThingProps {
 market: string;