Skip to content

Instantly share code, notes, and snippets.

View Freika's full-sized avatar
🚀
yes, why?

Evgenii Burmakin Freika

🚀
yes, why?
View GitHub Profile
function get_ynab_categories(accessToken, budgetId) {
const groups = fetch_ynab_data(accessToken, "budgets/" + budgetId + "/categories").category_groups;
const columns = ["Name", "Budgeted", "Activity", "Balance"];
const rows = [];
for (var group_idx = 0; group_idx < groups.length; group_idx++) {
// Add the group
var group = groups[group_idx];
// Skip internal and hidden categories
@Freika
Freika / spf_examples.rb
Created May 24, 2017 10:08
пробы с SPF
#!/usr/bin/env ruby
require 'spf'
require 'spf/query'
require 'pry'
KIOSK_IP = '136.243.75.105' # Адрес сервера srv-1.kiiiosk.ru с которого отправляются письма
# KIOSK_IP = '2a01:4f8:212:295d::2' # Адрес сервера srv-1.kiiiosk.ru с которого отправляются письма
KIOSK_SPF = %w[
_spf.kiiiosk.ru
@Freika
Freika / gist:d27408ecfd5edb2a99c9ef3d6f69c958
Created March 2, 2017 06:55 — forked from kagemusha/gist:1569836
Dump Heroku Postgres DB and load locally
Get the Heroku db as detailed here:
http://devcenter.heroku.com/articles/pgbackups#exporting_via_a_backup
1. heroku pgbackups:capture
2. heroku pgbackups:url <backup_num> #=>backup_url
- get backup_num with cmd "heroku pgbackups"
3. curl -o latest.dump <backup_url>
Then locally do:
$ pg_restore --verbose --clean --no-acl --no-owner -h localhost -U myuser -d mydb latest.dump

Deploying Elixir and Phoenix applications using Docker and Exrm

Goal

By the end of this quick guide, you will know how to compile a Phoenix app release using Exrm and run it inside a Docker container. I've found only a couple of articles that discuss getting an Elixir app up and running inside a Docker container, and even those only touched on some parts of the process. The idea is that this guide will give you a full end-to-end example of how to get all the pieces and parts working together so that you are able to deploy your Phoenix application inside a Docker container.

Assumptions

  1. You already have a working Elixir environment with the Phoenix Framework installed
  2. You have at least basic working knowledge of Docker, and have installed the Docker tools onto your local environment
@Freika
Freika / rspec_rails_cheetsheet.rb
Last active August 29, 2015 14:27 — forked from them0nk/rspec_rails_cheetsheet.rb
Rspec Rails cheatsheet (include capybara matchers)
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)
class CreateIdentities < ActiveRecord::Migration
def change
create_table :identities do |t|
t.string :provider
t.string :uid
t.integer :user_id
t.timestamps null: false
end
require 'factory_girl_rails'
require 'rspec'
require 'rspec-rails'
require 'rspec/mocks/standalone' # => if factories need stubs (for remote services for example)
include FactoryGirl::Syntax::Methods # make FG methods available at top level, so you can do `> create :user`
def reload_factories!
FactoryGirl.instance_variable_set(:@factories, nil) # => clear loaded factories/sequences
# FactoryGirl.instance_variable_set(:@sequences, nil)

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

# Russian. Updated 2014-04-01
ru:
admin:
js:
true: 'True'
false: 'False'
is_present: 'Не пустое'
is_blank: 'Пустое'
date: 'Дата ...'
require('GlobalStrings')
-- generated from s_bonusStatStringTags
local bonusStats = {
[0] = "ITEM_MOD_MANA_SHORT",
[1] = "ITEM_MOD_HEALTH_SHORT",
[3] = "ITEM_MOD_AGILITY_SHORT",
[4] = "ITEM_MOD_STRENGTH_SHORT",
[5] = "ITEM_MOD_INTELLECT_SHORT",
[6] = "ITEM_MOD_SPIRIT_SHORT",