Skip to content

Instantly share code, notes, and snippets.

View haslinger's full-sized avatar
🏠
Working from home

Stefan Haslinger haslinger

🏠
Working from home
View GitHub Profile
surround.vim
= 20160519 =
:global /{pattern}/ [cmd] führt ex-Kommando cmd für alle Zeilen, die pattern erfüllen, aus
:vglobal ... die pattern nicht erfüllen ...
qaq löscht Register a
:g/pattern/yank A in Register a anhängen
"ap inhalt Register a einfügen
:g/pattern/[range] sort sortiert Bereich range
@haslinger
haslinger / keybase.md
Created March 17, 2016 23:10
Keybase Proof

Keybase proof

I hereby claim:

  • I am haslinger on github.
  • I am informatom (https://keybase.io/informatom) on keybase.
  • I have a public key ASBlQz063oeZVZlOt9FzOcgoNP7LORbUFQtO5cd5TG4tJwo

To claim this, I am signing this object:

begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'rails', '5.0.0.beta3'
@haslinger
haslinger / 0010_installing_ruby_and_hobo.md
Last active August 29, 2015 14:09
0010 Installing Ruby and Hobo on a fresh Ubuntu machine

Installing Ruby and Hobo on a fresh Ubuntu Machine

This way several ruby versions can be installed individually and it's easy to switch between them.

Installing prerequesties

sudo apt-get install bash curl git-core build-essential bison openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev curl git-core libyaml-dev libxslt-dev autoconf libmysqlclient-dev libreadline5 libltdl-dev libncurses5-dev libserf1-dbg libsvn1 libtool subversion libgdbm-dev pkg-config libffi-dev@
@haslinger
haslinger / 0009 Login via login links sent by email.markdown
Last active August 29, 2015 14:01
Login via login links sent by email
@haslinger
haslinger / 0008 Integration of Elastic Search into Hobo.markdown
Last active August 29, 2015 14:01
Integration of Elastic Search into Hobo

I have got a Webshop applacation with a structure of 1700 products in 400 product categories through categorizations, and 1600 product properties in 1100 property groups and their 105 000 values.

For filtering and wanted to have a facetted search on category level on the values, like in the screenshot in the file facets.png

In the /Gemfile I load the Searchkick Gem:

gem "searchkick"                                    # Elastic Search integration
@haslinger
haslinger / 0007 Hobo Ajax features and Faye Messaging Server.markdown
Last active August 29, 2015 13:56
Hobo Ajax features and Faye Messaging Server

A few weeks ago I posted about a poor man's chat server I created with Hobo's Ajax features. I now had the request to improve performance, so I tried to fix it.

I pimped my old solution with a Faye messaging server: Ryan Bates created a gem and a Railscast about it.

Lets see how we update data on all connected clients but only when necessary. In conversation.dryml we subscribe to a faye server:

<%= subscribe_to "/conversations/" + this.id.to_s %>
@haslinger
haslinger / 0006 Paste Upload in Hobo.markdown
Last active August 29, 2015 13:55
Uploading images by pasting them into a HTML Element

Works also on Linux Mint LMDE, see Guide for details. Even if I got everything running, I'm still prefering to deploy to my own servers, it was a hassle. Sometimes deploying free applications is dead slow.

  • Installing the Heroku on Ubuntu wget -qO- https://toolbelt.heroku.com/install-ubuntu.sh | sh
  • Login heroku login
  • Add Repo git remote add heroku git@heroku.com:autocomplete-has-many-demo.git
  • Push
Started GET "/story_statuses/index2" for 127.0.0.1 at 2013-12-25 15:50:49 +0100
Processing by StoryStatusesController#index2 as HTML
  User Load (0.2ms)  SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1  [["id", "1"]]
DEPRECATION WARNING: Relation#all is deprecated. If you want to eager-load a relation, you can call #load (e.g. `Post.where(published: true).load`). If you want to get an array of records from a relation, you can call #to_a (e.g. `Post.where(published: true).to_a`). (called from block in dev_user_changer at /var/rails/hobo/hobo_clean/taglibs/nav.dryml:5)
  User Load (0.4ms)  SELECT "users".* FROM "users" LIMIT 30
  StoryStatus Load (0.4ms)  SELECT "story_statuses".* FROM "story_statuses" LIMIT 30 OFFSET 0
   (0.2ms)  SELECT COUNT(*) FROM "story_statuses"
  Rendered story_statuses/index2.dryml (119.9ms)
Completed 500 Internal Server Error in 126ms