Skip to content

Instantly share code, notes, and snippets.

View badlee's full-sized avatar
:octocat:

Badinga Ulrich badlee

:octocat:
View GitHub Profile
@badlee
badlee / Readme.md
Last active April 29, 2025 02:37
Golang : Simple event emitter.

events

A simple event emitter for Go.

About

The events provides an event emitter making use of the reflect packages ability to call functions. Using the Call method on the value of a function allows passing any type of function to the event emiiter, regardless of the functions parameters.

Usage

@badlee
badlee / index.js
Created September 4, 2024 11:04
A javascript template engine that is simple, easy to use
import compiler from "template.js";
const title = "";
const list= [{ name: 'yan' }, { name: 'haijing' }];
// template JS
const script = `
<?js /* Comments */ ?>
<html>
<head>
<title><?js= title ?></title>
@badlee
badlee / md5.js
Created February 14, 2018 13:45
JavaScript MD5 (work on object) - Fork of https://github.com/blueimp/JavaScript-MD5
/*
* JavaScript MD5
* https://github.com/blueimp/JavaScript-MD5
*
* Copyright 2011, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* https://opensource.org/licenses/MIT
*
/**
* Found an index of a value in a array
* @params : function
* @return : number ; return -1 if not found
* usage : [{a:[1]},11,{c:10},4,5,6].index((e)=>e.c == 10) // return 2
* [{a:[1]},11,{c:10},4,5,6].index((e)=>e == 60) // return -1
* [{a:[1]},11,{c:10},4,5,6].index((e)=>e == 5) // return 4
**/
Array.prototype.index = function(fn) {
var index=-1;
/*!
* EventEmitter v4.2.11 - git.io/ee
* Unlicense - http://unlicense.org/
* Oliver Caldwell - http://oli.me.uk/
* @preserve
*/
/**
* Update by https://github.com/badlee
* Fix bug : reject `this.on("sd",nonFunctionOrDescriptorObject);`
@badlee
badlee / ui.js
Last active December 21, 2015 11:19
Add coffescript and roy support to TideSDK
/**
* This file has been modified from its orginal sources.
*
* Copyright (c) 2012 Software in the Public Interest Inc (SPI)
* Copyright (c) 2012 David Pratt
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@badlee
badlee / exportMysqlToMongo.php
Last active December 18, 2015 07:09
Migrate a Mysql database to Mongodb. Migrez votre base de données Mysql vers MongoDB.
<?php
/*
*
* Uploaded by Rajah Oshimin
* Udated from : http://cloudsherpaz.wordpress.com/2013/01/05/migrate-mysql-database-to-mongodb/
*
*/
// genghis is a single-file MongoDB admin application.
// Located at http://genghisapp.com/