Skip to content

Instantly share code, notes, and snippets.

View nglx's full-sized avatar
✌️
no mud no lotus

marcin naglik nglx

✌️
no mud no lotus
View GitHub Profile

Unshakable Freedom: Ancient Stoic Secrets Applied to Modern Life

  • Don’t you know that freedom is a glorious thing of great worth?   EPICTETUS

  • If you choose, you are free; if you choose, you need to blame no one and accuse no one                                                                                      Epictetus[5]

  • You can only control what is under your control.

  • What is not in your control is neither good nor bad.

@nglx
nglx / finished_books.md
Last active July 3, 2019 09:42
Books I've read
  • Upadek / Albert Camus / 16.08.2018

  • Principles / Ray Dalio / 22.08.2018

  • Tao Te Ching / Lao-Tzu by Stephen Mitchell / 07.09.2018

  • Każdy krok niesie pokój / Thich Nhat Hanh / 14.09.2018

  • Turn the ship around / L. David Marquet

  • Unshakable Freedom: Ancient Stoic Secrets Applied to Modern Life / Chuck Chakrapani / 02.07.2019

@nglx
nglx / codeship.log
Last active March 31, 2016 12:57
bundle exec rake jasmine:ci
Waiting for jasmine server on 55287...
jasmine server started.
Phantomjs does not appear to be installed in /home/rof/.phantomjs/1.9.8/x86_64-linux/bin/phantomjs, installing!
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 0 0 321 0 0 9269 0 --:--:-- --:--:-- --:--:-- 9269
bunzip2: phantomjs-1.9.8-linux-x86_64.tar.bz2 is not a bzip2 file.
tar: phantomjs-1.9.8-linux-x86_64.tar: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
#!/usr/bin/env ruby
require 'benchmark'
REGEXPS = [
/^no such file to load -- (.+)$/i,
/^Missing \w+ (?:file\s*)?([^\s]+.rb)$/i,
/^Missing API definition file in (.+)$/i,
/^cannot load such file -- (.+)$/i,
]
class UsersController < ApplicationController
def index
user_search = UserSearch.new(params[:user_search])
@users = User.by_user_search(user_search)
end
end
# user search form object
class UserSearch
include Virtus.model
@nglx
nglx / has_scope.rb
Last active December 24, 2015 20:38
class UsersController < ApplicationController
include User::SearchScope
def index
search_params = params[:user_search] || {}
@users = apply_scopes(User, search_params)
end
end
class User < ActiveRecord::Base
module Scope
def self.included(base)
base.has_scope :with_name_like
base.has_scope :with_title_like
end
end
class PostsController < ApplicationController
include Scope
ActiveRecord.where('created_at > ?', Time.now).to_sql
@nglx
nglx / gist:3787676
Created September 26, 2012 12:15 — forked from bjallen/gist:3723463
city impact on results
# see what the confidence code means here:
# http://www.mapquestapi.com/geocoding/geocodequality.html
Web::Address.from_params({ :street => "Canal Road", :city => "Orleans", :state => "MA", :country => "US" })
[{"country_name"=>"United States",
"city"=>"Orleans",
"@name"=>"location",
"latitude"=>41.796795,
"country"=>"US",