Skip to content

Instantly share code, notes, and snippets.

View davazp's full-sized avatar

David Vázquez Púa davazp

View GitHub Profile
@davazp
davazp / main-package.js
Created March 8, 2016 10:07
Load main package.json
'use strict';
let findup = require('findup');
let path = require('path');
const PACKAGEFILE = 'package.json';
module.exports = function() {
let mainfile = require.main.filename;
if (mainfile){
'use strict';
const graphql = require('graphql').graphql;
const makeExecutableSchema = require('graphql-tools').makeExecutableSchema;
let resolvers = {
Query: {
person: ()=>{
return {
id: 2
@davazp
davazp / generate-merge.sql
Created June 29, 2017 07:52
Generate a SQL Server MERGE statement for a table
SET NOCOUNT ON
GO
PRINT 'Using Master database'
USE master
GO
PRINT 'Checking for the existence of this procedure'
IF (SELECT OBJECT_ID('sp_generate_merge','P')) IS NOT NULL --means, the procedure already exists
@davazp
davazp / snippets.sh
Created December 9, 2017 10:56
Snippets
# Grep across all git history
git rev-list --all | xargs git grep 'pattern'
@davazp
davazp / keybase.md
Created December 20, 2017 11:58
keybase.md

Keybase proof

I hereby claim:

  • I am davazp on github.
  • I am davazp (https://keybase.io/davazp) on keybase.
  • I have a public key ASCxn5ejKuIVLDn2Z5Pj1tuwVJiHFeZF5Y0SY8XgIV5pzQo

To claim this, I am signing this object:

@davazp
davazp / little-typer.pie
Last active February 17, 2019 12:28
The Little Typer
;; -*- scheme-*-
#lang pie
;;
;; Boolean
;;
(claim Boolean U)
(define Boolean Atom)
;;
/*
Incremental sieve of Erastotenes
================================
We get the nth prime by an variation of 'sieve of Erastotenes' that is
incremental and does not require a upper bound.
You can visualize the algorithm as it follows. Imagine some boxes
labeled with the integer numbers.
@davazp
davazp / ninja.ts
Created August 26, 2020 05:34
ninja.ts
/*
Simplest and least ambitious task-orchestration for Node-based projects
https://ninja-build.org/manual.html
*/
import { spawn } from "child_process";
import { promises as fs } from "fs";
import glob from "glob";
import path from "path";