Skip to content

Instantly share code, notes, and snippets.

View netusco's full-sized avatar

Ernest Conill netusco

  • New Relic
  • Barcelona
View GitHub Profile
@netusco
netusco / asyncQueue.js
Created February 26, 2018 15:28
Asynchronous queue system with limit of processes at a time
// LIVE EXAMPLE: https://jsfiddle.net/ytr1kh3z/128/
const queueLimit = 5;
const debug = true;
const verbose = false;
// processes operating asynchronously
var x = 0;
// number of total processes
var counter = 0;
/*************************************************
* Public Constants
*************************************************/
#define NOTE_B0 31
#define NOTE_C1 33
#define NOTE_CS1 35
#define NOTE_D1 37
#define NOTE_DS1 39
#define NOTE_E1 41
#!/bin/bash
#
# #automysqlcheck.sh
#
# This is a small bash script that checks all mysql databases for errors
# and mails a log file to a specified email address. All variables are
# hardcoded for ease of use with cron. Any databases you wish not to check
# should be added to the DBEXCLUDE list, with a space in between each name.
#
# original version by sbray@csc.uvic.ca, UVic Fine Arts 2004
@netusco
netusco / magento_new_admin_user.sql
Last active March 31, 2016 10:59 — forked from tridungpham/new_gist_file.sql
Create new admin user in Magento with password "admin"
INSERT INTO admin_user SELECT
NULL `user_id`,
"Dung" `firstname`,
"Pham" `lastname`,
"dungpt@sutunam.com" `email`,
"dungpt.sutunam" `username`,
"9684dfd577831f73890e88fe18ca9072:Hs" `password`,
NOW() `created`,
NULL `modified`,
NULL `logdate`,
@netusco
netusco / Backwoods Brawl
Last active March 5, 2016 14:28
Codecombat snippets
// 1st, 2nd and 3rd rounds
loop {
var flag = this.findFlag();
var enemies = this.findEnemies();
var enemy = false;
var enemiesClose = 0;
var enemyIdx = 0;
// counting enemies close to use cleave when it's really needed
@netusco
netusco / Standard.php
Last active February 19, 2016 08:44 — forked from mzeis/Standard.php
Debug module / controller / action routing in Magento CE 1.9.2.3. Save file as app/code/local/Mage/Core/Controller/Varien/Router/Standard.php
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
@netusco
netusco / habtm_counter_cache.php
Created November 17, 2010 12:47 — forked from neilcrookes/habtm_counter_cache.php
fixed one infinite loop...
<?php
/**
* Provides counter cache behavior for HABTM records.
*
* Example: Posts habtm Tags and tags table contains post_count field
*
* class Post extends AppModel {
* var $name = 'Post';
* var $actsAs = array('HabtmCounterCache');
* var $hasAndBelongsToMany = array('Tag');