Skip to content

Instantly share code, notes, and snippets.

View sobstel's full-sized avatar
💎

sobstel

💎
  • 10:05 (UTC +01:00)
View GitHub Profile
module Authenticable
extend ActiveSupport::Concern
# Filter to use with before_action
def authenticate_user
jwt_token
rescue JWT::DecodeError => e
render json: { error: e.message }, status: :unauthorized
end
@sobstel
sobstel / nokogiri_install
Created January 3, 2017 17:30
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 ***
@sobstel
sobstel / mnmlistweb.md
Last active October 23, 2016 15:32
mnmlist web

Mnmlst Web

A website with the main purpose of having people read content would best serve its readers with almost nothing else but what’s needed for the reading experience.

Strip a site of all its distraction, cruft, gimmicks, promotions, advertising, social sharing and more... and all you have is the pure reading experience.

A minimalist website. Perfect for the readers, which is perfect for the writer. Not so perfect for advertisers

@sobstel
sobstel / README.md
Last active January 13, 2017 13:36
Kata04: Data Munging - Part One: Weather Data http://codekata.com/kata/kata04-data-munging/

In weather.dat you’ll find daily weather data for Morristown, NJ for June 2002. Download this text file, then write a program to output the day number (column one) with the smallest temperature spread (the maximum temperature is the second column, the minimum the third column).

http://codekata.com/kata/kata04-data-munging/

@sobstel
sobstel / over-engineering-mistakes.md
Created August 12, 2016 13:06
10 Modern Software Over-Engineering Mistakes

10 Modern Software Over-Engineering Mistakes

  1. Engineering is more clever than Business? The House (Business) Always Wins.
  2. Reusable Business Functionality? Prefer Isolating Actions than Combining.
  3. Everything is Generic? Duplication is better than the wrong abstraction.
  4. Shallow Wrappers? Wrappers are an exception, not the norm. Don’t wrap good libraries for the sake of wrapping.
  5. Applying Quality like a Tool? Always take a step back and look at the macro picture. Concepts need shift in Mindset. Cannot be applied blindly like tools.
  6. Overzealous Adopter Syndrome? TL;DRs should not be used everywhere.
  7. –ity? Don’t let -ities go unchallenged. Clearly define and evaluate the Scenario/Story/Need/Usage.
  8. In House “Inventions”? Reuse. Fork. Contribute. Reconsider.
@sobstel
sobstel / waste.md
Created August 8, 2016 13:04
Lean: Eliminate Waste

Continuously eliminate anything that isn’t adding value and only work on what we absolutely need to be doing at this moment in time.

  • Partially done coding eventually abandoned during the development process is waste
  • Extra processes and features not often used by customers are waste
  • Waiting for other activities, teams, processes is waste
  • Defects and lower quality are waste
  • Managerial overhead not producing real value is waste
@sobstel
sobstel / php_server_config.conf
Created August 1, 2016 08:18
php server nginx config
location ~ ^.+\.php(/|$) {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
fastcgi_param HTTPS $https;
# Security: mitigating HTTPoxy vulnerability
fastcgi_param HTTP_PROXY "";
}
@sobstel
sobstel / NamedParams.php
Created July 9, 2016 10:22
PHP named params
<?php
namespace Util;
/**
* Workaround to avoid long unnamed argument list
*
* Usage:
*
* 1. Required params
*
@sobstel
sobstel / blurred_background_view.rb
Created July 9, 2016 10:17
[RubyMotion] blurred background view
class BlurredBackgroundView < UIVisualEffectView
def rmq_build
blur_effect = UIBlurEffect.effectWithStyle(UIBlurEffectStyleDark)
self.effect = blur_effect
self.frame = UIScreen.mainScreen.bounds
end
end
# rmq
#class HomeScreenStylesheet < ApplicationStylesheet
@sobstel
sobstel / Rakefile
Last active July 9, 2016 10:15
[RubyMotion] [ProMotion] hide status bar
app.info_plist['UIStatusBarHidden'] = true