Skip to content

Instantly share code, notes, and snippets.

.git
.gitignore
.cache
docker-compose.yml
### Git ###
# Created by git for backups. To disable backups in Git:
# $ git config --global mergetool.keepBackup false
*.orig
@neohunter
neohunter / gist:91dbe6031d099527bbc6c5a75e51d505
Last active October 25, 2020 23:01
deadlock order relationships updates before commit
# This avoid Deadlock
module ActiveRecord
module ConnectionAdapters
class Transaction
def before_commit_records
return unless records && @run_commit_callbacks
records.uniq.sort_by(&DeadlockPreventionOrder).each(&:before_committed!)
end
@neohunter
neohunter / gist:1304e3ebde7c937a987c8bb9fee83830
Last active November 5, 2017 04:22
instance class variables
module Validator
def self.included(klass)
klass.extend ClassMethods
end
module ClassMethods
def inherited(child_class)
child_class.instance_variable_set :@required_fields, self.required_fields
end
@neohunter
neohunter / gist:090c9da3fa5b6d84721988772ad92a3d
Last active September 20, 2017 22:55
ejemplo de docker con php
# Cree estos directorios en donde tiene su app:
# docker
# mysql
# mysql_data (vacio)
# mysql_init
# initial.sql (puede estar en gz) o si quiere no existir, es la db por defecto
# php
# php-overrides.ini # cualquier configuracion del php.ini que quiera
# ejecutar
@neohunter
neohunter / zpreztorc
Created September 1, 2016 17:35
zpresto
#
# Sets Prezto options.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
#
# General
#
@neohunter
neohunter / .slate
Created September 1, 2016 13:24
Slate config
config defaultToCurrentScreen true
config nudgePercentOf screenSize
config resizePercentOf screenSize
config secondsBetweenRepeat 0.1
config checkDefaultsOnLoad true
config focusCheckWidthMax 3000
config windowHintsDuration 5
config windowHintsSpread true
config windowHintsOrder persist
config windowHintsShowIcons true
{
"debug" : false,
"autocomplete": true,
"command" : "/Users/arnoldroa/bin/ctags_for_ruby",
"filters" : {
"source.python": {"type":"^i$"}
},
"definition_filters": {
"source.php": {"type":"^v$"}
},
@neohunter
neohunter / 0_reuse_code.js
Created June 19, 2014 19:57
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@neohunter
neohunter / gist:3789979
Created September 26, 2012 19:19
Setting model
<?php
App::uses('AppModel', 'Model');
/**
* Setting Model
*
*/
class Setting extends AppModel {
/**
* Display field
@neohunter
neohunter / gist:3725272
Created September 14, 2012 22:16
delegar bloques?
# modo de uso de emails
options = {}
gmail.emails(options) do |email|
# aqui tengo cada email..
end
# Quiero crear un metodo llamado search que me llame emails de un modo particular, la idea es que esto funcione:
gmail.search('pepito moreno') do |email|
# aqui tendria cada email, igual que si hubiera llamado gmail.emails