Skip to content

Instantly share code, notes, and snippets.

View alterx's full-sized avatar

Carlos Vega alterx

View GitHub Profile
@alterx
alterx / graph.js
Last active April 11, 2021 21:04
GunDB useful resources
// Dletta has implemented a depth-first (and sort of breadth-first) search algorithm for gun graphs.
var stack;
var nodes;
var edges;
var start;
var u;
var label;
var opt = true;
Verifying my Blockstack ID is secured with the address 1B1VeR1xw1b22VPehppqfdpGcyNzHdV8e9 https://explorer.blockstack.org/address/1B1VeR1xw1b22VPehppqfdpGcyNzHdV8e9
const getModule = (
declarations: Array<Type<any> | any[]>,
entryComponents: Array<Type<any> | any[]>,
bootstrap: Array<Type<any> | any[]>,
data: NgProvidedData,
moduleMetadata: NgModuleMetadata
) => {
const moduleMeta = {
declarations: [...declarations, ...(moduleMetadata.declarations || [])],
imports: [BrowserModule, FormsModule, ...(moduleMetadata.imports || [])],
...
import { Button } from '@storybook/angular/demo';
storiesOf('Addon|Notes', module)
.add(
'Simple note',
withNotes({ text: 'My notes on some button' })(() => ({
component: Button,
props: {
storiesOf('Metadata|Individual', module)
.add('Individual 1', () => ({
template: `<storybook-simple-token-component [name]="name"></storybook-simple-token-component>`,
props: {
name: 'Prop Name',
},
moduleMetadata: {
imports: [],
declarations: [],
providers: [
@alterx
alterx / draw.js
Last active March 13, 2018 17:15
const draw = (newModule: Function, reRender: boolean = true): void => {
if (!platform) {
try {
enableProdMode();
} catch (e) {}
platform = platformBrowserDynamic();
promises.push(platform.bootstrapModule(newModule));
} else {
Promise.all(promises).then(modules => {

Keybase proof

I hereby claim:

  • I am alterx on github.
  • I am carlosvega (https://keybase.io/carlosvega) on keybase.
  • I have a public key whose fingerprint is 36F2 3290 97D7 D20C 0B80 B789 DE03 05A8 C729 643A

To claim this, I am signing this object:

@alterx
alterx / koa-simple-waterline.js
Last active February 25, 2017 23:23
Simple Koa 2 middleware that transparently exposes Waterline (node 7.6+)
'use strict';
const Waterline = require('waterline');
let _waterline;
const upper = (str) => str[0].toUpperCase() + str.slice(1);
const isInvalid = (model) => (!model.identity);
const init = async ({ models, adapters, connections }) => {
if (_waterline) return Promise.resolve(_waterline);
import { Component, Input } from '@angular/core';
@Component({
selector: 'my-child-component',
template: `
<p>{{ prop1 }}</p>
`,
})
export class ChildComponent {
@Input() prop1: string;
constructor() {}
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
template: `
<my-child-component [prop1]="name"></my-child-component>
`,
})
export class App {
name: string = "Carlos";
constructor() {}