Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View ugisozols's full-sized avatar

Uģis Ozols ugisozols

View GitHub Profile
@ugisozols
ugisozols / nokogiri_install
Created July 23, 2018 12:05 — forked from sobstel/nokogiri_install
nokogiri -> ERROR: cannot discover where libxml2 is located on your system
# `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
ugisozols / base_page.cr
Created November 11, 2017 21:35
no argument named 'user_names'
# src/pages/base_page.cr
abstract class BasePage
include LuckyWeb::HTMLPage
def render
html lang: "en" do
head do
utf8_charset
title page_title
css_link asset("css/app.css")
// app/adapters/applictation.js
import DS from "ember-data";
export default DS.FixtureAdapter.extend({ latency: 500 });
@ugisozols
ugisozols / gist:78db365c2f5a627b00f7
Last active August 29, 2015 14:12
Ruby 2.2.0 and passenger 4.0.56 fix for undefined symbol: rb_thread_blocking_region

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/passenger_native_support.so: 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:

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)
DB[:schema_info].first[:version]
end || 0
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
ugisozols / gist:9684528
Last active August 29, 2015 13:57
Overriding url that's being hit on the backend on a per model basis
// Problem.
//
// I wanted for this.store.find("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 https://github.com/emberjs/data/blob/v1.0.0-beta.6/packages/activemodel-adapter/lib/system/active_model_adapter.js#L65
//
// Note: In my app I'm using DS.ActiveModelAdapter.
//
// <3 https://github.com/robyurkowski for help.
App.SignupRoute = Ember.Route.extend({
model: function() {
return this.store.createRecord("user");
}
});
App.SignupController = Ember.ObjectController.extend({
actions: {
signup: function() {
var self = this;
App.Entry = DS.Model.extend({
title: DS.attr("string"),
content: DS.attr("string")
});
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0/handlebars.js"></script>
<script src="http://builds.emberjs.com.s3.amazonaws.com/tags/v1.0.0/ember.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>