Skip to content

Instantly share code, notes, and snippets.


Uģis Ozols ugisozols

View GitHub Profile
ugisozols / nokogiri_install
Created Jul 23, 2018 — forked from sobstel/nokogiri_install
nokogiri -> ERROR: cannot discover where libxml2 is located on your system
View nokogiri_install
# `ERROR: Error installing nokogiri:
# ERROR: Failed to build gem native extension.
# current directory: /usr/local/var/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/nokogiri-1.7.0/ext/nokogiri
# /usr/local/var/rbenv/versions/2.3.1/bin/ruby -r ./siteconf20170103-68488-r71c9j.rb extconf.rb --with-xml=/usr/local/Cellar/libxml2/ --use-system-libraries
# checking if the C compiler accepts ... yes
# checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
# Building nokogiri using system libraries.
# ERROR: cannot discover where libxml2 is located on your system. please make sure `pkg-config` is installed.
# *** extconf.rb failed ***
ugisozols /
Created Nov 11, 2017
no argument named 'user_names'
# src/pages/
abstract class BasePage
include LuckyWeb::HTMLPage
def render
html lang: "en" do
head do
title page_title
css_link asset("css/app.css")
View applictation.js
// app/adapters/applictation.js
import DS from "ember-data";
export default DS.FixtureAdapter.extend({ latency: 500 });
ugisozols / gist:78db365c2f5a627b00f7
Last active Aug 29, 2015
Ruby 2.2.0 and passenger 4.0.56 fix for undefined symbol: rb_thread_blocking_region
View gist:78db365c2f5a627b00f7

After installing Ruby 2.2.0 and the latest version of passenger (as of this writing) 4.0.56 I started to get this error in nginx error.log:

symbol lookup error: /opt/rubies/ruby-2.2.0/lib/ruby/gems/2.2.0/gems/passenger-4.0.56/buildout/ruby/ruby-2.2.0-x86_64-linux/ undefined symbol: rb_thread_blocking_region

After a quick google search I found phusion/passenger#1314 (comment).

I'm using ruby-install so I re-installed the Ruby 2.2.0 using this command:

View gist:1e10f739c44b838714b6
namespace :db do
require "sequel"
Sequel.extension :migration
DB = Sequel.connect(ENV['DATABASE_URL'])
desc "Prints current schema version"
task :version do
version = if DB.tables.include?(:schema_info)
end || 0
View benchmark-results.txt
Rehearsal ----------------------------------------------------
split/map/reject 0.060000 0.000000 0.060000 ( 0.064907)
scan with regex 0.030000 0.000000 0.030000 ( 0.024250)
------------------------------------------- total: 0.090000sec
user system total real
split/map/reject 0.070000 0.000000 0.070000 ( 0.068857)
scan with regex 0.020000 0.000000 0.020000 ( 0.023608)
ugisozols / gist:9684528
Last active Aug 29, 2015
Overriding url that's being hit on the backend on a per model basis
View gist:9684528
// Problem.
// I wanted for"account") in AccountRoute's model hook to hit /account instead of /accounts so I ended up
// creating App.AccountAdapter where I subclass App.ApplicationAdapter and override pathForType.
// See
// Note: In my app I'm using DS.ActiveModelAdapter.
// <3 for help.
View gist:9637557
App.SignupRoute = Ember.Route.extend({
model: function() {
App.SignupController = Ember.ObjectController.extend({
actions: {
signup: function() {
var self = this;
View entry.js
App.Entry = DS.Model.extend({
title: DS.attr("string"),
content: DS.attr("string")
View jsbin.uJePUHe.html
<!DOCTYPE html>
<script src=""></script>
<script src=""></script>
<script src=""></script>
<meta charset=utf-8 />
<title>JS Bin</title>