Skip to content

Instantly share code, notes, and snippets.

hablo programación

Przemek Sobstel sobstel

hablo programación
Block or report user

Report or block sobstel

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
sobstel / nokogiri_install
Created Jan 3, 2017
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 ***
sobstel / auth-vhost.conf
Created Mar 21, 2014
Passing HTTP AUTH BASIC/DIGEST headers from Apache to PHP-FPM
View auth-vhost.conf
<VirtualHost *>
DocumentRoot "/var/www/auth"
ProxyPassMatch ^(/.*\.php)$ fcgi://
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
sobstel / router.rb
Last active Nov 13, 2019
Simple Ruby router
View router.rb
class Router
Route =, :block)
class RouteSet
def on(pattern, &block)
Router.routes.push, block)
@routes = []
sobstel / typescript-cheatsheet.ts
Last active Oct 11, 2019
TypeScript cheatsheet
View typescript-cheatsheet.ts
// same arg type and return type
withUID<T>(obj: T)
// "extends" helps providing some constraints
// eg <T extends object>
withUID({a: 1}) // valid
withUID("wrong way") // NOT valid
// default value type (string)
A<T=string> { name: T }
sobstel / codility_demo_test.rb
Created Oct 25, 2011
Codility demo test (Ruby)
View codility_demo_test.rb
def equi(a)
lower_elements_sum = 0
higher_elements_sum = a.inject(:+)
a.each_with_index do |el, i|
lower_elements_sum += a[i - 1] if i > 0
higher_elements_sum -= el
return i if lower_elements_sum == higher_elements_sum
View fetch_with_timeout.js
const API_URL = '...';
const TIMEOUT = 10; // seconds
export default (path) => {
/* global fetch */
const req = fetch(API_URL + path);
const timeout = new Promise((resolve, reject) => {
return setTimeout(() => reject(new Error('request timeout')), TIMEOUT * 1000);
sobstel /
Last active Aug 16, 2019
Effective Ruby

Effective Ruby

#1 (Almost) Everything is true

  • Every value is true except false and nil.
  • The number zero is true in Ruby.
  • Use the nil? method to differentiate between false and nil.

#2 All objects could be nil

sobstel / no_simulator.txt
Last active Jul 12, 2019
React Native "Could not find iPhone simulator"
View no_simulator.txt
❯ react-native run-ios --simulator="iPhone 7"
Found Xcode workspace Nabobil.xcworkspace
Could not find iPhone 7 simulator
Error: Could not find iPhone 7 simulator
at resolve (...)
sed -i '' 's/startsWith/includes/g' node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js
sobstel /
Created Oct 10, 2018
React Native iOS third-party double-conversion build error fix
# error: Build input file cannot be found: '/Users/sobstel/Projects/nabobil/nabobil-mobile/node_modules/react-native/third-party/double-conversion-1.1.6/src/'
cd node_modules/react-native/scripts && ./ && cd ../../../
cd node_modules/react-native/third-party/glog-0.3.5/ && ../../scripts/ && cd ../../../../
View app-controllers-concerns-authenticable.rb
module Authenticable
extend ActiveSupport::Concern
# Filter to use with before_action
def authenticate_user
rescue JWT::DecodeError => e
render json: { error: e.message }, status: :unauthorized
You can’t perform that action at this time.