Skip to content

Instantly share code, notes, and snippets.

View palkan's full-sized avatar
✈️
Transcontinental hustle

Vladimir Dementyev palkan

✈️
Transcontinental hustle
View GitHub Profile
@Ceroce
Ceroce / recursion.erl
Created June 27, 2017 10:09
Erlang: Fibonacci with Tail recursion + determining if an integer is perfect.
-module(recursion).
-export([fib/1, fibtail/1, fibtail/3, isPerfect/1]).
fib(0) ->
0;
fib(1) ->
1;
fib(N) when N > 0 ->
fib(N-1)+fib(N-2).
@palkan
palkan / 01_readme.md
Last active January 15, 2024 10:32
Docker Dev
@palkan
palkan / postgres_queries_and_commands.sql
Last active December 5, 2019 13:01 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- kill running query
SELECT pg_cancel_backend(procpid);
-- kill idle query
@steinwaywhw
steinwaywhw / One Liner to Download the Latest Release from Github Repo.md
Last active May 5, 2024 20:02
One Liner to Download the Latest Release from Github Repo
  • Use curl to get the JSON response for the latest release
  • Use grep to find the line containing file URL
  • Use cut and tr to extract the URL
  • Use wget to download it
curl -s https://api.github.com/repos/jgm/pandoc/releases/latest \
| grep "browser_download_url.*deb" \
| cut -d : -f 2,3 \
| tr -d \" \
@lfender6445
lfender6445 / gist:9919357
Last active May 2, 2024 22:40
Pry Cheat Sheet

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

@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')