Skip to content

Instantly share code, notes, and snippets.

😐
bored

Sven Pachnit 2called-chaos

😐
bored
Block or report user

Report or block 2called-chaos

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
@2called-chaos
2called-chaos / z_airbrake.rb
Created May 16, 2020
Airbrake config example (they made it a bit harder each version tbh)
View z_airbrake.rb
Airbrake.configure do |config|
# project specific
config.project_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
# use git SHA & current commit as app version
# Looks like this:
# Ruby: 2.7.0 » Rails: 6.0.2.2 » f98b36585 - Only try to remove fade from modals if jQuery is there
config.app_version = "Ruby: #{RUBY_VERSION} » Rails: #{Rails::VERSION::STRING} » " << `cd #{Rails.root} && git log -1 --pretty="%h - %B" HEAD`
# can always be 1
@2called-chaos
2called-chaos / fuzzily_converter_example.rb
Created Apr 3, 2020
Custom number converter example (fuzzily)
View fuzzily_converter_example.rb
class Product < ApplicationRecord
fuzzily_searchable :search_name, class_name: "ProductTrigram"
def search_name
term = [name, name_origin, *search_terms.try(:split, ",")].join(" ")
term = FuzzilyStringConverter.convert_in_string(term)
term.split(" ").uniq.join(" ")
end
def saved_change_to_search_name?
@2called-chaos
2called-chaos / mail.md
Created Feb 12, 2019
My letter to the MEPs concerning the copyright reform / Article 13 and 11
View mail.md

Dear Member of the European Parlament,

my name is Sven Pachnit and I work as, for and with content creators and providers of general web services. I'm deeply concerned about Article 13 and let's don't forget Article 11.

Both will harm the free internet to an enormous extend and will result in even worse conditions for small companies and startups in the EU (you already wonder why all the big web companies are in the US, it's not because they are so much better at it but the climate in the EU just isn't that appealing to have ones HQ in, this will certainly won't make it any better). I know quite a few companies that are being operated by EU citizens but they registered the company outside of the EU.

Upload filters are a huge problem. I'm guessing you are not a content creator on YouTube so let me tell you how bad the world's most advanced content filter (Content ID from Google) really is. It "detects" ones voice (with nothing else, e.g. background music) and claims it as copyright violation. It also common

@2called-chaos
2called-chaos / _form.html.erb
Last active Jan 23, 2019
Bootstrap 3 rails form builder
View _form.html.erb
<%= bs_form_for [:backend, @publisher] do |f| %>
<%= f.lock %>
<%= f.error_messages %>
<%= f.labeled_text_field :name %>
<%= f.labeled_text_field :support_link, placeholder: "http://help.ea.com", hint: "Possibly visible to customers if given." %>
<%= f.labeled_text_field :support_email, placeholder: "support@ea.com", hint: "Only for internal use." %>
<%= f.indicate_tenant(:global) unless @publisher.persisted? %>
<%= f.actions do %>
View recaptcha3.coffee
class AppOS.Component.Recaptcha3 extends AppOS.Component
name: "recaptcha"
API_URL: "https://www.google.com/recaptcha/api.js?onload=%callback&render=explicit"
API_KEY: "MY_PUBLIC_SITEKEY"
init: ->
@pending = []
@apiState = "unloaded"
# init event
View recaptcha.coffee
class AppOS.Component.Recaptcha extends AppOS.Component
name: "recaptcha"
API_URL: "https://www.google.com/recaptcha/api.js?onload=%callback&render=explicit&hl=%hl"
init: ->
@pending = []
@apiState = "unloaded"
# init event
$(document).on "recaptcha:init", (ev, el) =>
@2called-chaos
2called-chaos / z_airbrake.rb
Created Apr 17, 2018
Airbrake 6.3 config
View z_airbrake.rb
Airbrake.configure do |config|
# project specific
config.project_key = ''
# use git SHA & current commit as app version
config.app_version = "Ruby: #{RUBY_VERSION} » Rails: #{Rails::VERSION::STRING} » " << `cd #{Rails.root} && git log -1 --pretty="%h - %B" HEAD`
# can always be 1
config.project_id = 1
@2called-chaos
2called-chaos / srcds_log.rb
Last active Sep 15, 2016
Log filterer/colorizer/analyzer for source servers (CS:GO + sourcemod tested only)
@2called-chaos
2called-chaos / profile.sh
Created Mar 16, 2016
binstubs light (hack)
View profile.sh
# binstubs light
function bundle_exec {
bundler=`bundle list 2>&1`
cmd=$1
shift
if [[ $bundler == "" || $bundler =~ "Could not locate Gemfile" ]]
then
command="$cmd $@"
else
View rails_resource_routing.rb
/* ====================== */
/* = resources :baskets = */
/* ====================== */
butler_baskets GET /butler/baskets(.:format) {:action=>"index", :controller=>"butler/baskets"}
POST /butler/baskets(.:format) {:action=>"create", :controller=>"butler/baskets"}
new_butler_basket GET /butler/baskets/new(.:format) {:action=>"new", :controller=>"butler/baskets"}
edit_butler_basket GET /butler/baskets/:id/edit(.:format) {:action=>"edit", :controller=>"butler/baskets"}
butler_basket GET /butler/baskets/:id(.:format) {:action=>"show", :controller=>"butler/baskets"}
PUT /butler/baskets/:id(.:format) {:action=>"update", :controller=>"butler/baskets"}
DELETE /butler/baskets/:id(.:format) {:action=>"destroy", :controller=>"butler/baskets"}
You can’t perform that action at this time.