Skip to content

Instantly share code, notes, and snippets.

🐢
I may be slow to respond.

MICE Portal stereosupersonic

🐢
I may be slow to respond.
Block or report user

Report or block stereosupersonic

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
View athlete.json
{
"user": {
"athlete_profile": {
"sex": "m", # possible values m,f,u
"height": 160, # in cm
"weight": 61, # kg
"age": 27,
"goals": [
"improve_endurance",
"general_fitness",
View keybase.md

Keybase proof

I hereby claim:

  • I am stereosupersonic on github.
  • I am michaeldeimelde (https://keybase.io/michaeldeimelde) on keybase.
  • I have a public key ASAN0I1Fv73CG7ctPUy65cZmS_UJSNAvOilQT8eNrJfZhgo

To claim this, I am signing this object:

View core_user_user.rb
class Flservice::CoreUser::User < OpenStruct
PATH = "/v1/profile"
def self.find(uid)
response = connection(uid).get PATH
self.new JSON.parse(response.body)["user"].except("authentications")
end
def self.connection(uid)
url = "http://0.0.0.0:3000" # TODO RemoteApp.new(:core_user)
@stereosupersonic
stereosupersonic / kill_sidekiq_job.rb
Last active Mar 15, 2016
kill a sidekiq job by class
View kill_sidekiq_job.rb
require 'sidekiq/api'
# kill queued jobs
queue = Sidekiq::Queue.new("default")
queue.each do |job|
if job.item["wrapped"] == "OptivoSyncJob"
puts "kill #{job.item["jid"]}"
job.delete
end
end
View code_warrior_code.rb
# key word arguemtents with options
def foo(a, **b)
[a,b]
end
foo(1, a: 2, b:3) #=> [1, {:a=>2, :b=>3}]
# === regex
# http://www.codewars.com/kata/did-she-say-hallo/ruby
# my solution
def validate_hello(greetings)
View config.rb
MyGem.configure do |config|
# Description of the setting here...
config.setting1 = :value
end
module MyGem
class Configuration
attr_accessor :setting1, :setting2
end
View optivo_interface.rb
#Gemfile
gem "optivo_api", ">= 0.8.1", github: "freeletics/optivo_api"
#initilizer
#./config/initializers/optivo_api.rb
require "optivo_api"
OptivoApi.configure do |config|
config.mandator_id = Rails.application.secrets.optivo_api_mandator_id
config.user = Rails.application.secrets.optivo_api_user
View message_verifier.rb
message_verifier = Rails.application.message_verifier("some salt")
token = message_verifier.generate("my versecure thing")
message_verifier.verify(token) # => "my versecure thing"
# more params
token = message_verifier.generate([@user.id, email, "some message"])
user_id, email, message = message_verifier.verify(token) # => "my versecure thing"
View listen_dir.rb
require 'listen' #https://github.com/guard/listen
dir = "/Users/michaeldeimel/entwicklung/freeletics/core-user-rails"
listener = Listen.to(dir) do |modified, added, removed|
puts "modified absolute path: #{modified}"
puts "added absolute path: #{added}"
puts "removed absolute path: #{removed}"
end
listener.start # not blocking
sleep
You can’t perform that action at this time.