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
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 sessionDebugger
from slacker import Slacker | |
import json | |
import argparse | |
import os | |
import shutil | |
import copy | |
from datetime import datetime | |
# This script finds all channels, private channels and direct messages | |
# that your user participates in, downloads the complete history for |
# MIT License | |
# Copyright (c) 2016 Chandler Abraham | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: |
Slack doesn't provide an easy way to extract custom emoji from a team. (Especially teams with thousands of custom emoji) This Gist walks you through a relatively simple approach to get your emoji out.
If you're an admin of your own team, you can get the list of emoji directly using this API: https://api.slack.com/methods/emoji.list. Once you have it, skip to Step 3
HOWEVER! This gist is intended for people who don't have admin access, nor access tokens for using that list.
Follow along...
#!/usr/bin/env ruby | |
# Do sanity check on imported data by comparing the number of rows in each table | |
require 'pg' | |
require 'mysql2' | |
tables = %w( { list the tables to compare here }) | |
p = PG.connect(dbname:'canvas', host: 'postgres.ocad.ca', user: 'canvas_user') |
#!/bin/sh | |
set_path="cd /home/rails/my_app/current" | |
case "$1" in | |
start) | |
echo -n "Starting delayed_job: " | |
su - rails -c "$set_path; RAILS_ENV=production script/delayed_job start" >> log/delayed_job.log 2>&1 | |
echo "done." | |
;; | |
stop) |
(my response to https://twitter.com/apotonick/status/717105889845624832)
I haven't yet came across readily available resources for large-scale application architecture for Elixir apps. I found Programming Phoenix to be a good start for that though. And there's ~30 years of knowledge in the Erlang land :)
For web apps, I found the abstractions that Elixir/Phoenix provides to be really helpful. Indeed, the list below is somewhat ORM focused.
In the small, Ecto.Schema, Ecto.Query, Ecto.Changeset, and Phoenix.View allow me to build highly composable and side-effect free modules. I can have many schemas, changesets and queries all interacting with the same underlying DB table(s) if I want to. Most of the side-effects (through Ecto.Repo for DBs) are usually in the Phoenix.Controller (or other Plugs).
Sometimes you want to use a gem on Heroku that is in a private repository on GitHub.
Using git over http you can authenticate to GitHub using basic authentication. However, we don't want to embed usernames and passwords in Gemfiles. Instead, we can use authentication tokens.
This method does not add your OAuth token to Gemfile.lock
. It uses bundle config to store your credentials, and allows you to configure Heroku to use environment variables when deploying.
# 1.install gource using HomeBrew | |
brew install gource | |
# 2.install avconv | |
git clone git://git.libav.org/libav.git | |
cd libav | |
# it will take 3-5 minutes to complie, be patient. | |
./configure --disable-yasm | |
make && make install |
# Say you want to look up the attrs of a Stripe Event for logging to your internal database. | |
attrs = begin | |
retriable(Stripe::APIConnectionError, Stripe::APIError, max: 25) do | |
# ... retrieve attrs from the Stripe event here... | |
end | |
rescue Stripe::APIConnectionError, Stripe::APIError | |
# We're inside an SQS queue block | |
throw :skip_delete # we'll just have to wait on this event, come back later | |
rescue Stripe::Error | |
notify $! |