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 postgres_queries_and_commands.sql
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
View Capybara.md

Capybara Actions

# Anchor
click_link 'Save'

# Button
click_button 'awesome'

# Both above
View gist:5b3ff53c3784b18796c873d358fb3a44

Pry Cheat Sheet

Command Line

  • pry -r ./config/app_init_file.rb - load your app into a pry session (look at the file loaded by config.ru)
  • pry -r ./config/environment.rb - load your rails into a pry session

Debugger

@stereosupersonic
stereosupersonic / README-Template.md
Created Nov 3, 2017 — forked from PurpleBooth/README-Template.md
A template to make good README.md
View README-Template.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

View Retry.rb
begin
result = some_method
rescue MyApp::Exception => e
retries ||= 0
retries += 1
raise e if retries > 5
retry
end
@stereosupersonic
stereosupersonic / pre-commit.sh
Created Sep 20, 2017
pre-commit prevent master commits
View pre-commit.sh
#!/bin/bash
echo -e "[PREVENT] --> init (wait a second)"
BRANCH=`git rev-parse --abbrev-ref HEAD`
if [ $BRANCH == master ]; then
echo -e "[PREVENT] --> Non shall commit to master!"
exit 1
else
echo -e "[PREVENT] --> Prevent commit approved"
@stereosupersonic
stereosupersonic / pre-push.sh
Created Sep 20, 2017
rubocop git hook pre-push
View pre-push.sh
#!/bin/sh
echo "pre-push"
echo "Starting rubocop"
bundle exec rubocop
if [ $? -ne 0 ]; then
echo ""
echo ""
echo "Rubocop failed; push aborted!"
View response.json
{
"user": {
"athlete_profile": {
"gender": "m",
"height": 179,
"weight": 85,
"age": 46,
"goals": ["improve_endurance", "relieve_stress", "burn_fat"],
"skills": ["pullups", "muscleups", "strict_hs_pushups", "toes_to_bar"],
"limitations": [],
View performance_classes.md
AgeGroup performance_class count
Child untrained 44
Child novice 28
Child intermediate 22
Child proficient 10
Child advanced 1
Young subpar 6
Young untrained 373
View test.json
[{"user":{"athlete_profile":{"sex":"m","height":160,"weight":61,"age":28,"goals":["improve_endurance","lose_weight","gain_strength"],"skills":["pistols","pullups","toes-to-bar","strict-hs-pushups"],"limitations":[],"fitness_level":75,"desired_training_days":5,"coach_week":118,"country":"Deutschland","training_spot":"München"},"training_data":[{"workout_slug":"bw_iris","performance":1549,"performed_at":"2013-03-05T09:58:11.000Z","exertion_rate":null,"exertion_preference":null,"technique":null,"training_type":"free"},{"workout_slug":"bw_iris","performance":1536,"performed_at":"2013-03-06T12:04:23.000Z","exertion_rate":null,"exertion_preference":null,"technique":null,"training_type":"free"},{"workout_slug":"bw_situp","performance":null,"performed_at":"2013-03-06T12:10:50.000Z","exertion_rate":null,"exertion_preference":null,"technique":null,"training_type":"free"},{"workout_slug":"bw_pushup","performance":null,"performed_at":"2013-03-06T12:13:24.000Z","exertion_rate":null,"exertion_preference":null,"technique":n
You can’t perform that action at this time.