Skip to content

Instantly share code, notes, and snippets.

Hrvoje Šimić shime

Block or report user

Report or block shime

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
zulhfreelancer /
Last active Jan 11, 2020
How to fix 'readline.bundle image not found' problem?

If you get error like this:

Running via Spring preloader in process 7662
/Users/zulh/.rvm/gems/ruby-2.3.1@useradmin/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require': dlopen(/Users/zulh/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/x86_64-darwin15/readline.bundle, 9): Library not loaded: /usr/local/opt/readline/lib/libreadline.6.dylib (LoadError)
  Referenced from: /Users/zulh/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/x86_64-darwin15/readline.bundle
  Reason: image not found - /Users/zulh/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/x86_64-darwin15/readline.bundle
	from /Users/zulh/.rvm/gems/ruby-2.3.1@useradmin/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `block in require'
	from /Users/zulh/.rvm/gems/ruby-2.3.1@useradmin/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency'
	from /Users/zulh/.rvm/gems/ruby-2.3.1@useradmin/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fstream>
#include <iostream>
Extazystas / prawn_io_image.rb
Created Mar 3, 2016
Prawn PDF images with Base64 and StringIO
View prawn_io_image.rb
def render
pdf = Prawn::Document
pdf.image[:data])), at: [10, cursor - 50], width: 200, height: 125
def splitBase64(uri)
if uri.match(%r{^data:(.*?);(.*?),(.*)$})
return {
type: $1, # "image/png"
encoder: $2, # "base64"
cmkoller /
Last active Oct 4, 2019
Setting up Sinatra Flash

Setting Up Sinatra Flash

Sinatra Flash is an awesome gem that allows you to pop up little messages alerting your users of important things, via some simple code in your server.rb file. This is very useful for things like displaying error messages if the user has filled out a form wrong, or displaying "success" messages if the user did something successfully like sign in, sign out, or submit a form.

This also gives you a great chance to implement Foundation's beautiful alerts. Here's how to set it up!

  1. Install the gem by typing gem install sinatra-flash in your terminal.
  2. Require the gem in the top of your server.rb file: require 'sinatra/flash'
Leask / invertTree.js
Created Jun 12, 2015
[Invert Binary Tree] Google: 90% of our engineers use the software you wrote (Homebrew), but you can’t invert a binary tree on a whiteboard so fuck off.
View invertTree.js
* Definition for a binary tree node.
* function TreeNode(val) {
* this.val = val;
* this.left = this.right = null;
* }
* @param {TreeNode} root
* @return {TreeNode}
janko / 01-activerecord.rb
Created May 27, 2015
PostgreSQL JSON querying in Sequel (my presentation from our local Ruby meetup)
View 01-activerecord.rb
require "active_record"
ActiveRecord::Migration.verbose = false
ActiveRecord::Migration.class_eval do
create_table :played_quizzes, force: true do |t|
t.integer :player_ids, array: true
t.json :quiz_snapshot
j3j5 / gist:8b3e48ccad746b90a54a
Last active Dec 20, 2019
Adyen Test Card Numbers
View gist:8b3e48ccad746b90a54a
Adyen Test Card Numbers
These cards are only valid on our TEST system and they will never involve any actual transaction or transfer of funds. The TEST card numbers will not work on the Adyen LIVE Platform.
For all cards use the following expiration and CVV2/CVC2/or CID for Amex.
For all cards:
Expiration Dates CVV2 / CVC3 CID (American Express)
08/2018 OR 10/2020 737 7373
justmoon / custom-error.js
Last active Dec 28, 2019 — forked from subfuzion/
Creating custom Error classes in Node.js
View custom-error.js
'use strict';
module.exports = function CustomError(message, extra) {
Error.captureStackTrace(this, this.constructor); =;
this.message = message;
this.extra = extra;
require('util').inherits(module.exports, Error);
sjl / ext.vim
Created Dec 15, 2014
ways to run external commands in vim
View ext.vim
" run command
" no stdin
" output displayed in "Press enter to continue" style
" current buffer untouched
" run command
" pipe range of text to command on stdin
" output replaces the range in the current buffer
:RANGE!grep foo
izbor / dci_example.rb
Last active Mar 20, 2018
DCI (Data, Contexts, Interactions) paradigm example in Ruby
View dci_example.rb
# DCI EXAMPLE IN RUBY (with some prototype elements)
# Blog post:
# More info:
# Creator of MVC & DCI, Trygve Reenskaug: DCI: Re-thinking the foundations of
# object orientation and of programming
# James Coplien: Why DCI is the Right Architecture for Right Now
You can’t perform that action at this time.