Skip to content

Instantly share code, notes, and snippets.

View lbadura's full-sized avatar

Lukasz Badura lbadura

View GitHub Profile
@lbadura
lbadura / app_framework.rb
Created October 18, 2019 13:47
App Framework beta flags
# grid console payments production
# bundle exec rails c production
# paste and call :-)
app_framework = proc do |account_id|
BetaFeature.transaction do
features = %w[zendesk_app_market:sell_apps_public zendesk_app_market:sell_apps_private]
features.each do |feature|
BetaFeature.create!(account_id: account_id,
feature: feature, enabled: true, permanent: true)

Keybase proof

I hereby claim:

  • I am lbadura on github.
  • I am lbadura (https://keybase.io/lbadura) on keybase.
  • I have a public key ASAmPa0cgIq_3lg90vilK2AbNnLEei91sjtLoGjXdDfJHgo

To claim this, I am signing this object:

@lbadura
lbadura / install_elixir.md
Created May 5, 2016 13:02 — forked from rubencaro/install_elixir.md
Elixir installation guide

Elixir installation guide

Version numbers should be the ones you want. Here I do it with the last ones available at the moment of writing.

The simplest way to install elixir is using your package manager. Sadly, at the time of writing only Fedora shows the intention to keep its packages up to date. There you can simply sudo dnf install erlang elixir and you are good to go.

Anyway, if you intend to work with several versions of erlang or elixir at the same time, or you are tied to a specific version, you will need to compile it yourself. Then kerl and exenv are your best friends.

@lbadura
lbadura / osx-setup.sh
Created February 8, 2016 10:39 — forked from somebox/osx-setup.sh
Set up an OSX machine from zero to awesome. Uses Homebrew (and cask, fonts, etc). Focused on Ruby/Rails development, includes rvm, xquartz, editor fonts, sublime text, and many tools.
#!/bin/bash
# A script to set up a new mac. Uses bash, homebrew, etc.
# Focused for ruby/rails development. Includes many utilities and apps:
# - homebrew, rvm, node
# - quicklook plugins, terminal fonts
# - browsers: chrome, firefox
# - dev: iterm2, sublime text, postgres, chrome devtools, etc.
# - team: slack, dropbox, google drive, skype, etc
@lbadura
lbadura / gist:8556338
Created January 22, 2014 10:12
Render an authorization error if any of Backbone's syncs result with 401 response
originalSync = Backbone.sync
app = this
Backbone.sync = (method, model, opts) ->
dfd = $.Deferred()
if opts
dfd.then(opts.success, opts.error)
xhr = originalSync(method, model, _.omit(opts, 'success', 'error'))
xhr.done(dfd.resolve)
xhr.fail ->
woland(master)-{17:06}
$ ruby -v
ruby 1.8.7 (2012-02-08 patchlevel 358) [i686-linux]
woland(master)-{17:08}
$ script/server
/home/lukasz/.rvm/gems/ruby-1.8.7-p358@aaero/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:55: uninitialized constant ActiveSupport::Dependencies::Mutex (NameError)
from /home/lukasz/.rvm/gems/ruby-1.8.7-p358@aaero/gems/activesupport-2.3.8/lib/active_support.rb:57:in `require'
from /home/lukasz/.rvm/gems/ruby-1.8.7-p358@aaero/gems/activesupport-2.3.8/lib/active_support.rb:57
from /home/lukasz/.rvm/gems/ruby-1.8.7-p358@aaero/gems/rails-2.3.8/lib/commands/server.rb:1:in `require'
from /home/lukasz/.rvm/gems/ruby-1.8.7-p358@aaero/gems/rails-2.3.8/lib/commands/server.rb:1
@lbadura
lbadura / rbenv-install-system-wide.sh
Created May 21, 2012 11:13 — forked from devsigner/rbenv-install-system-wide.sh
rbenv install ruby 1.9.3-p125 on Debian 6 Squeeze
# Update, upgrade and install development tools:
apt-get update
apt-get -y upgrade
apt-get -y install build-essential git-core curl libssl-dev \
libreadline5 libreadline5-dev \
zlib1g zlib1g-dev \
libmysqlclient-dev \
libcurl4-openssl-dev \
libxslt-dev libxml2-dev
# on loading the page
:3000/:19GET http://localhost:3000/assets/ads/ad.js?body=1
:3000/:19GET http://localhost:3000/assets/ads/index.js?body=1
:3000/:19GET http://localhost:3000/assets/views/ads/ads_index.js?body=1
# after clicking find it
jquery.js:8241XHR finished loading: "http://localhost:3000/api/listings?what=&where=Seattle%2C+WA&limit=10".
search_index.js:157Uncaught TypeError: undefined is not a function
jquery.js:8241XHR finished loading: "http://localhost:3000/api/ads?what=&where=Seattle%2C+WA&limit=6".
search_index.js:157Uncaught TypeError: undefined is not a function
class AttachedFile < ActiveRecord::Base
belongs_to :attachable, :polymorphic => true
attr_accessible :file, :plan_id
validates :file, :presence => true
mount_uploader :file do
def store_dir
"uploads/#{model.attachable_type.downcase.pluralize}"
end
end
Started GET "/en/advisor/offers/10,associate-accountant-krakow-hitachi" for 77.252.243.105 at 2011-11-16 14:39:38 +0100
Processing by Advisor::OffersController#show as HTML
Parameters: {"id"=>"10,associate-accountant-krakow-hitachi", "locale"=>"en"}
User Load (0.4ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 2 LIMIT 1
Role Load (0.3ms) SELECT `roles`.* FROM `roles` INNER JOIN `roles_users` ON `roles`.id = `roles_users`.role_id WHERE ((`roles_users`.user_id = 2))
Offer Load (0.3ms) SELECT `offers`.* FROM `offers` WHERE `offers`.`id` = 10 LIMIT 1
Company Load (0.2ms) SELECT `companies`.* FROM `companies` WHERE `companies`.`id` = 175 LIMIT 1
FacebookUser Load (0.2ms) SELECT `facebook_users`.* FROM `facebook_users` WHERE (`facebook_users`.user_id = 2) LIMIT 1
SQL (0.2ms) SELECT COUNT(*) FROM `offers` WHERE (`offers`.company_id = 175)
SQL (0.1ms) BEGIN