Skip to content

Instantly share code, notes, and snippets.

View Diullei's full-sized avatar

Diullei Gomes Diullei

View GitHub Profile
@Diullei
Diullei / example.coffee
Created October 20, 2012 06:15 — forked from dc/example.coffee
ANSI styling — node.js
terminal = require('terminal')
console.log terminal.ANSIFormat("{{magenta}}Hello {{blue}}World!{{reset}}")
console.log terminal.ANSIStyle('red;inverse') + "ERROR:" + terminal.ANSIStyle('default;noinverse') + " method not found"
@Diullei
Diullei / result.js
Created October 29, 2012 19:01 — forked from juandopazo/result.js
YUI TypeScript definitions
module Y {
interface Anim extends Base {
}
interface App extends App_Base, App_Content, App_Transitions, PjaxContent {
(config?: any);
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Web.Http.Dependencies;
using Ninject;
using Ninject.Syntax;
public class NinjectDependencyScope : IDependencyScope
{
private IResolutionRoot resolver;

Reading data before application startup in Angular 2

In this demonstration I will show you how to read data in Angular2 final release before application startup. You can use it to read configuration files like you do in other languages like Java, Python, Ruby, Php.

This is how the demonstration will load data:

a) It will read an env file named 'env.json'. This file indicates what is the current working environment. Options are: 'production' and 'development';

b) It will read a config JSON file based on what is found in env file. If env is "production", the file is 'config.production.json'. If env is "development", the file is 'config.development.json'.

@Diullei
Diullei / gql2ts.sh
Created April 27, 2017 20:39
Rudimentary graphql to typescript definition generator. Accepts a graphql schema file (not json, nor js) and converts it to typescript defs.
#!/usr/bin/env bash
cat "$1" \
| sed -r 's/^(\s*)#/\1\/\//' \
| sed -r 's/!//g' \
| sed -r 's/^input /export interface /g' \
| sed -r 's/^enum /export enum /g' \
| sed -r 's/^type /export interface /g' \
| sed -r 's/^union /export type /g'\
| sed -r 's/^schema /export interface schema /g' \
| sed -r 's/^(\s+[a-zA-Z0-9_-]+\s*)\([^\)]+\)(\s*:\s*)/\1\2/g' \
@Diullei
Diullei / PrintStgGHC8_4_3.hs
Created December 6, 2020 18:09 — forked from chrisdone/PrintStgGHC8_4_3.hs
Print STG in GHC 8.4.3
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE StandaloneDeriving #-}
-- | Print STG in GHC 8.4.3.
module Main where
import Control.Monad.IO.Class (liftIO)
import qualified CorePrep

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example