Skip to content

Instantly share code, notes, and snippets.

import Ember from 'ember';
function trackPropertyChanges(defaultValue) {
var value = defaultValue;
function updateChangedProperty(model, name, property, value) {
var changedProperties = model.get('changedProperties');
if (!changedProperties) {
changedProperties = Ember.Object.create();
model.set('changedProperties', changedProperties);
@fguillen
fguillen / .aliasesrc
Last active October 7, 2016 09:28
dotfiles
alias dr="cd ~/Develop/Rails/Current"
alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'"
alias gitfast="git add . && git add -u && git commit -m 'WIP'"
alias gitci="git push -f fguillen HEAD:ci"
alias rgrep="find . \( ! -name .svn -o -prune \) -type f -print0 | xargs -0 grep"
alias raca="rake"
alias rt="ruby -Itest"
alias to="touch tmp/restart.txt"
alias deployeverywhere=" git push origin HEAD:staging && git push origin HEAD:production && cap staging deploy && cap production deploy"
@fguillen
fguillen / truncate_rails_log_files.sh
Last active August 29, 2015 14:25
Empty all Rails logs
find /var/www/*/shared/log -name "*.log" -exec truncate {} --size 0 \;
require "benchmark"
require "logger"
require "resolv"
module Script
def self.run(process_name, resolv_kind, dns_server_ip, nameserver_to_resolv)
file = File.open("/tmp/dns_resolution_stress.log", File::WRONLY | File::APPEND)
logger = Logger.new(file)
logger.level = Logger::DEBUG
@fguillen
fguillen / .aliasesrc
Last active September 7, 2016 15:11
Shell helpers
# ~/.aliasesrc
# tree visualization of your actual folder
alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'"
# Making a fast (temporal) commit of all your changes
alias gitfast="git add . && git add -u && git commit -m 'WIP'"
# Pushing to the CI branch
alias gitci="git push -f fguillen HEAD:ci"
tail -f /var/log/nginx.log | awk '
/status:"2.."/ {print "\033[32m" $0 "\033[39m"}
/status:"5.."/ {print "\033[31m" $0 "\033[39m"}
/status:"[^25].."/ {print $0}
'
Last login: Tue Oct 1 16:07:06 on ttys004
~ $ cat /Users/fguillen/.rvm/log/1380636448_ruby-1.9.3-p448/make.log
[2013-10-01 16:07:51] __rvm_make
__rvm_make ()
{
\make "$@" || return $?
}
current path: /Users/fguillen/.rvm/src/ruby-1.9.3-p448
command(3): __rvm_make -j 1
CC = /opt/local/bin/gcc-apple-4.2
#!/usr/bin/env ruby
SERVICES = [
{
:domain => "abandonbikes.fernandoguillen.info",
:port => "3020",
:gemset => "1.9.2-p290@abandon_bikes"
},
{
:domain => "bookysitter.com",
@fguillen
fguillen / .gitignore
Last active December 12, 2015 12:19
Example code to reproduce the issue: http://stackoverflow.com/q/14838196/316700
.rvmrc
*.sqlite