Skip to content

Instantly share code, notes, and snippets.

View dariocravero's full-sized avatar

Darío Javier Cravero dariocravero

View GitHub Profile
/** @satisfies {import('json-schema-to-ts').JSONSchema} */
const schema2 = {
type: 'object',
additionalProperties: false,
properties: {
input: {
type: 'object',
additionalProperties: false,
properties: {
x: { type: 'number' },
@dariocravero
dariocravero / README.md
Created October 20, 2012 05:25
Save files in Meteor

Create a Meteor app and put the client_/server_ files in a client/server directories. Also, create a public dir to save the uploaded files.

@dariocravero
dariocravero / Gemfile
Created September 5, 2012 18:48
Minimal sinatra app with puma's config.
source "https://rubygems.org"
gem 'puma'
gem 'sinatra'
@dariocravero
dariocravero / README.md
Created May 22, 2016 10:31 — forked from marten-de-vries/README.md
Running CouchApps on PouchDB in the browser using service workers - without any modifications!

Running CouchApps on PouchDB in the browser using service workers

What is this?

A description of how to run an existing CouchApp on PouchDB in the browser using service workers - without any modifications to existing code being necessary! The best thing is that if service workers aren't available, the CouchApp will still run as normal: that is, online.

Demo

upstream myapp {
server unix:///myapp/tmp/puma.sock;
}
server {
listen 80;
server_name myapp.com;
# ~2 seconds is often enough for most folks to parse HTML/CSS and
# retrieve needed images/icons/frames, connections are cheap in

This is how we do metadata in Hasura instead of going through the migrations mechanism in v1. It's interesting that the Hasura team is following a similar approach https://youtu.be/ik3vd0Ju9sw?t=1636 with the next iteration of the metadata!

This process really helps us model our data and the relations way faster. In particular when it comes down to renaming things or removing many permissions at once.

I should've totally shared this earlier :/.

What we do is that we write our metadata in YAML files inside a metadata folder and split them by types.

CHANGES=`git log origin/production..origin/master`;
if [ -z "$CHANGES" ]; then
echo "✅ Production is already in sync with master";
exit;
fi;
echo ""
echo ""
echo "📝 This is what's on master that's could be released to production:"
unset GREP_OPTIONS
# find content in javascript files inside a folder
# eg: findjs color src
function findjs {
find "${2:-.}" -name '*.js' -not -path '*node_modules*' -not -path '*dist*' -exec grep "$1" --color=auto {} \; -print
}
# find content in javascript files inside a folder and replace it with something else
# eg: findjsr red blue src
let glob = require('fast-glob');
let fs = require('fs').promises;
let path = require('path');
let RELATIVE_IMPORT_ABOVE_FILE = /^import .+? '((\.\.\/)+)/;
let isRelativeImportAboveFile = line => RELATIVE_IMPORT_ABOVE_FILE.test(line);
let asAbsoluteImport = line =>
line.replace(line.match(RELATIVE_IMPORT_ABOVE_FILE)[1], '');
async function run() {