Skip to content

Instantly share code, notes, and snippets.

Bartek Kruszczynski kruszczynski

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am kruszczynski on github.
  • I am kruszczynski (https://keybase.io/kruszczynski) on keybase.
  • I have a public key ASCxlKlZxWAeFt66_f0E03h8a-_W-I0x9sooBJaxnCBPlAo

To claim this, I am signing this object:

@kruszczynski
kruszczynski / get_repos.rb
Last active Apr 24, 2018 — forked from jbarber/get_repos.rb
Github GraphQL query for repos, their topics, and Gemfile
View get_repos.rb
require 'httparty'
def get_data
query = File.open('repos.graphql', 'r').read
token = 'https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/'
cursor = nil
repos = []
org = 'evil_mega_corp'
loop do
View postgres_queries_and_commands.sql
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), 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(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
View scrapfy-6evmqztwcoj8xgvi.rb
# Model
def method(argument, &block)
SomeLibrary.new.other_method(argument, &block)
end
# Test
should '#method' do
block = -> {}
block = Proc.new {}
View gist:f771f73fa2b4df80223e
Project.search do
case params[:type]
when 'healthy'
with(:health_score, 80..100)
# => [80, 81, ... , 99, 100]
when 'at_risk'
with(:health_score, 50...80)
# => [50, 51, ... , 79, 80] - should not inlcude 80, inner Sunspot Range evaluation error
end
# possible fix:
View countCSSRules.js
function countCSSRules() {
var results = '',
log = '';
if (!document.styleSheets) {
return;
}
for (var i = 0; i < document.styleSheets.length; i++) {
countSheet(document.styleSheets[i]);
}
function countSheet(sheet) {
You can’t perform that action at this time.