Skip to content

Instantly share code, notes, and snippets.

View ecoologic's full-sized avatar

Erik ecoologic

View GitHub Profile
@ecoologic
ecoologic / show_presenter.rb
Created June 18, 2011 17:30
presenter for codeschool rails best practices
# /app/presenters/tweets/show.rb
module Tweets
class ShowPresenter
def initialize(tweet)
@tweet = tweet
end
def tweet
@tweet
end
@ecoologic
ecoologic / lsof3000
Created September 22, 2011 09:01
lsof | grep 3000
> lsof | grep 3000
dbus-daem 1248 emanuele 74u unix 0xf6923000 0t0 10964 socket
gvfsd 1355 emanuele 3u unix 0xee9a3000 0t0 6807 socket
tomboy 1379 emanuele mem REG 8,6 195452 1838262 /usr/lib/libgnomecanvas-2.so.0.3000.1
tomboy 1379 emanuele mem REG 8,6 84544 1838246 /usr/lib/libgnome-2.so.0.3000.0
gnome-pan 1381 emanuele mem REG 8,6 195452 1838262 /usr/lib/libgnomecanvas-2.so.0.3000.1
gnome-pan 1381 emanuele mem REG 8,6 84544 1838246 /usr/lib/libgnome-2.so.0.3000.0
nautilus 1382 emanuele mem REG 8,6 195452 1838262 /usr/lib/libgnomecanvas-2.so.0.3000.1
nautilus 1382 emanuele mem REG 8,6 84544 1838246 /usr/lib/libgnome-2.so.0.3000.0
firefox-b 1387 emanuele mem REG 8,6 30008 40566 /usr/lib/firefox-3.6.22/components/libdbusservice.so
# /etc/sysctl.conf
vm.overcommit_memory=1
# /etc/redis.conf
# comments on the same line gave problems
# custom conf 1gb, will solve a warning
maxmemory 1073741824
# commenting these three lines will avoid redis to dump the db at all

What is Earth Day

The 22nd April of every year since 1970 is Earth Day! It's a day where everyone should think a little bit more of the environment and what we can do to save the planet from catastrophic changes that our society are likely to be responsible for.

What is happening to the planet, and why?

Every theory have deniers but it seems quite accepted that advanced societies have major (bad) impacts on the life on Earth. I'm sure you heard about it, but here's a great explanatory video from crash course, terrific channel by the way.

What is Earth Day

Every year, the 22nd April (since 1970) is known as Earth Day! It is a day where everyone is encouraged to think a little bit more of the environment. We asked to mindful of catastrophic changes which might result if our society continues to disrespect the Earth.

NetEngine

NetEngine is very happy to exist on this planet and in order to minimize our collective impact to our environment we already have in place some simple practices, which we encourage others to adopt if you aren't already adept to them. They include, recycling or providing showers so people can come to work by bike.

We are always thinking of how to take this further. In the meantime, to show our respect for Mother Earth on its day we're taking some simple steps like, inviting everyone to avoid using the car; keeping the aircon off for the entire day; minimising the use of lights and other polluting devices, and given we'll likely survive the day without these things, we'll likely adopt them as common practice.

What is Earth Day

Every year, the 22nd April (since 1970) is known as Earth Day! It is a day where everyone is encouraged to think a little bit more of the environment. We asked to mindful of catastrophic changes which might result if our society continues to disrespect the earth.

NetEngine

NetEngine is very happy to exist on this planet and in order to minimize our collective impact to our environment we already have in place some simple practices, which we encourage others to adopt if you aren't already adept to them. They include, recycling or providing showers so people can come to work by bike.

We are always thinking of how to take this further. In the meantime, to show our respect for Mother Earth on its day we're taking some simple steps like, inviting everyone to avoid using the car; keeping the aircon off for the entire day; minimising the use of lights and other polluting devices, and given we'll likely survive the day without these things, we'll likely adopt them as common practice.

[user]
name = erik
email = erikecoologic@gmail.com
[color]
ui = auto
[core]
whitespace = trailing-space,space-before-tab
editor = vim
excludesfile = /Users/netengine/.gitignore_global
[diff]
@ecoologic
ecoologic / conventions.rb
Last active August 11, 2020 09:47
My Conventions
{}.as_json # {}
{}.to_json # "{}"
# query / command
user_params # query, no get_params etc, prefer queries over commands, leads to more declarative code, which is simpler
remote_document # Query, not get_document, more declarative
buy_document! # Exception to the above, it's probably a POST and I want to express that it's not a free call
prepare_document! # Bang to express imperative behaviour (?)
compact_params(params) # command - takes args and can be reused
compacted_user_params # YES, a noun is better
$('form#new_invoice:not(".invoice-project-select")').submit ->
$form = $('form#new_invoice')
$tasks = $form.find('.task-checkbox')
$flatFees = $form.find('[data-flatfee]')
confirmCheckAll = 'You have not selected a single item. Please take note that all items that are unbillable are unchecked by default.\n\nDo you want to check them all and create the invoice?'
confirmInvoiceWithFlatFees = "There are either tasks or projects that have a fixed fee set. If you would like to instead invoice these by hours logged, please set them to 'hourly' before creating the invoice.\n\nDo you still wish to create the invoice now?"
# $tasks.find(':not(:checked)').click() # this keeps the graphic in sync
$tasks.attr('checked', true) if $tasks.find(':checked').length == 0 && confirm(confirmCheckAll)
App = Em.Application.create() # use App for every app and Em as a shortcut
window.h = # h a hash with all the non oo helpers
formatDate: (date) ->
date = new Date unless date?
[date.getDate(), (date.getMonth() + 1), date.getFullYear(), ].join('/')
$ ->
$('.datepicker').datepicker()
$('.tab').tabs()