Skip to content

Instantly share code, notes, and snippets.

View marianposaceanu's full-sized avatar

Posăceanu Marian marianposaceanu

View GitHub Profile

How to fix the Reference has invalid format in git repos due to Google Drive

find . -type f -name "* (1)*" -exec rm -f {} \;
awk '!/conflicted/' .git/packed-refs > temp && mv temp .git/packed-refs

Note: those two lines are destructive commands if you first want to see what they do try:

find . -type f -name "* (1)*"

awk '!/conflicted/' .git/packed-refs

# ___ ___ ___ ___ ___ ___ ___ ___
# /\ \ /\ \ /\__\ /\ \ /\ \ /\ \ /\__\ |\__\
# /::\ \ /::\ \ /::| | /::\ \ /::\ \ /::\ \ /:/ / |:| |
# /:/\:\ \ /:/\:\ \ /:|:| | /:/\:\ \ /:/\:\ \ /:/\:\ \ /:/ / |:| |
# /:/ \:\ \ /::\~\:\ \ /:/|:|__|__ /::\~\:\ \ /::\~\:\ \ /:/ \:\__\ /:/ / ___ |:|__|__
# /:/__/_\:\__/:/\:\ \:\__/:/ |::::\__\ /:/\:\ \:\__/:/\:\ \:\__/:/__/ \:|__/:/__/ /\______/::::\__\
# \:\ /\ \/__\:\~\:\ \/__\/__/~~/:/ / \/_|::\/:/ \:\~\:\ \/__\:\ \ /:/ \:\ \ /:/ \::::/~~/~
# \:\ \:\__\ \:\ \:\__\ /:/ / |:|::/ / \:\ \:\__\ \:\ /:/ / \:\ /:/ / ~~|:|~~|
# \:\/:/ / \:\ \/__/ /:/ / |:|\/__/ \:\ \/__/ \:\/:/ / \:\/:/ / |:| |
# \::/ /
$(function() {
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
$("meta[name='viewport']").attr('user-scalable', 'yes');
}
});

Simple steps to install dynamo and its deps on OSX

We need to have a fresh copy Elixi that works with Erland R17

brew install erlang --devel

brew install elixir --HEAD

Some small heroku tips

heroku pgbackups:capture --expire
curl -o latest.dump `heroku pgbackups:url`

pg_restore --verbose --clean --no-acl --no-owner -h localhost -U myuser -d mydb latest.dump

{
# First, we need to add an empty key/value tuple (just an empty fork) to this `execution`, in preperation for
# making a `locals` list to store variables on.
#
# ┌ - we have to assume that native juxtaposition of `infrastructure` against the root-level `execution` will
# │ somehow “fall through.” I haven’t yet figured out the semantics of Nuclear-level scoping/fall-through.
# │ - considering: if `<this> locals` nothingnesses-out, then we juxtapose against enclosing scope at the
# │ interpreter level (which would imply, at this root scope, juxtaposing against the global scope I suppose)
# │
# │ ┌ - no `call()` implemented at this level, so we have to assume that the native-default juxtaposition for
@marianposaceanu
marianposaceanu / results.md
Last active January 1, 2016 11:49
StandardSingleton vs MethodMissingSingleton

Benchmark results

Ruby 2.1.0

                               user     system      total        real
StandardSingleton:         0.141000   0.000000   0.141000 (  0.129891)
MethodMissingSingleton:    0.125000   0.000000   0.125000 (  0.130870)
@marianposaceanu
marianposaceanu / closures.rb
Created December 27, 2013 00:24
CLOSURES IN RUBY by Paul Cantrell
# CLOSURES IN RUBY Paul Cantrell http://innig.net
# Email: username "cantrell", domain name "pobox.com"
# I recommend executing this file, then reading it alongside its output.
#
# Alteratively, you can give yourself a sort of Ruby test by deleting all the comments,
# then trying to guess the output of the code!
# A closure is a block of code which meets three criteria:
#
@marianposaceanu
marianposaceanu / arel mapped template ids.rb
Created December 21, 2013 00:12 — forked from ndbroadbent/arel mapped template ids.rb
Using Arel instead of ActiveRecord
module Sq
class Template < Sequel::Model
one_to_many :fields
def mapped_template_ids
FieldMapping.as(:m).
join(Field.named(:f), id: :field_id, template_id: id).
join(Field.named(:mf), id: :m__mapped_field_id).
distinct.select_map(:mf__template_id)
end
@marianposaceanu
marianposaceanu / quick_ruby_tips.md
Last active December 29, 2015 05:19
Quick, no fuss Ruby tips.

How to Find Where Ruby Methods are Defined

method(:page_title).source_location

# => ["/Users/ben/.rvm/gems/ruby-2.0.0-p353/gems/flutie-1.3.3/app/helpers/page_title_helper.rb", 2]