Skip to content

Instantly share code, notes, and snippets.

const async_hooks = require('async_hooks')
const fs = require('fs')
// Create a new AsyncHook instance. All of these callbacks are optional.
const asyncHook = async_hooks.createHook({
init,
before,
after,
destroy,
promiseResolve,
})
@bmax
bmax / fwatch_rsync.sh
Created January 20, 2021 19:57
Fwatch Rsync
!/usr/bin/env bash
# check color support
colors=$(tput colors)
if (($colors >= 8)); then
red='\033[0;31m'
nocolor='\033[00m'
else
red=
nocolor=
import { Module } from '@nestjs/common'
import { ConfigModule, ConfigService } from '@nestjs/config'
import * as Services from './services'
import { BookModule } from './books/book.module'
import { SequelizeModule } from '@nestjs/sequelize'
import { UsersModule } from './users/user.module'
import configuration from './config/configuration'
import { AuthModule } from './auth/auth.module'
import { ClubModule } from './clubs/club.module'
@bmax
bmax / bot.js
Created December 16, 2017 04:50
var Discord = require("discord.js");
var fs = require('fs');
// Initialize Discord Bot
const bot = new Discord.Client();
function getRandomInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min)) + min; //The maximum is exclusive and the minimum is inclusive
}
@bmax
bmax / keybase.md
Created September 19, 2017 01:47
keybase.md

Keybase proof

I hereby claim:

  • I am bmax on github.
  • I am bmax (https://keybase.io/bmax) on keybase.
  • I have a public key whose fingerprint is 5803 FC53 DFA6 7508 E600 C18A 4305 AF49 760D 6D92

To claim this, I am signing this object:

@bmax
bmax / Order.js
Last active March 28, 2017 01:46
<template>
<div class="container">
Order: {{$route.params.id}}
<div id="tabs">
<ul class="nav-pills">
<li role="presentation" v-on:click="cc = !cc; paypal=false">Credit Card</li>
<li role="presentation" v-on:click="paypal = !paypal; cc = false">Paypal</li>
</ul>
</div>
<Paypal v-if="paypal"></Paypal>
<template>
<div id="loading" v-if="loading"> <img src='../../assets/gears.svg' /></div>
</template>
<script>
import braintree from 'braintree-web'
// We generated a client token for you so you can test out this code
// immediately. In a production-ready integration, you will need to
// generate a client token on your server (see section below).
@bmax
bmax / blabla.js
Last active March 14, 2017 17:28
async function getNodes() {
return new Promise((resolve, reject) => {
http.get('http://localhost:3000', (res) => {
const statusCode = res.statusCode;
const contentType = res.headers['content-type'];
res.setEncoding('utf8');
let rawData = '';
<?php
class Behance_Sniffs_Gotchas_PHPUnitExpectsSniff implements PHP_CodeSniffer_Sniff {
public function register() {
return [ T_STRING ];
} // register
/**
* Processes this test, when one of its tokens is encountered.
*
@bmax
bmax / Login.vue
Last active October 27, 2016 03:57
<template>
<div class="container">
<div class="error">
<div v-if="errors">
{{errors}}
<div v-for="help in errors">{{help}}</div>
</div>
</div>
<div class="hello" v-if="!user.authenticated">
Email Address: <input v-model="email" placeholder="blabla@bla.com" type="text" />