Skip to content

Instantly share code, notes, and snippets.

View kruszczynski's full-sized avatar
🎛️
Softer Developer

Bartek Kruszczynski kruszczynski

🎛️
Softer Developer
View GitHub Profile
@kruszczynski
kruszczynski / get_repos.rb
Last active June 14, 2023 15:35 — forked from jbarber/get_repos.rb
Github GraphQL query for repos, their topics, and Gemfile
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
We can make this file beautiful and searchable if this error is corrected: It looks like row 7 should actually have 8 columns, instead of 3. in line 6.
product_feed_id,product_id,product_photo,product_name,influencer_name,brand_name,popularity_score,influencer_pic
608,20.0,https://static.getprophet.io/xb3rlkbe8vde0jeq1pdnob86gakq,Ayres Chambray,johann,Mr Cena & Friends,7.0,https://static.getprophet.io/oj8vzzofdqzwvr5noajbdenvpnol
608,27.0,https://static.getprophet.io/fnft28pra8rfp1souo5bcs51fm4c,Chevron,johann,Mr Cena & Friends,3.0,https://static.getprophet.io/oj8vzzofdqzwvr5noajbdenvpnol
608,36.0,https://static.getprophet.io/pu29mg4onmvjjlpo851kiabv3a92,Derby Tier Backpack,johann,Mr Cena & Friends,9.0,https://static.getprophet.io/oj8vzzofdqzwvr5noajbdenvpnol
608,40.0,https://static.getprophet.io/bhz3vx7g45qy81ut99sddzvg91wa,Duckworth Woolfill Jacket,johann,Mr Cena & Friends,10.0,https://static.getprophet.io/oj8vzzofdqzwvr5noajbdenvpnol
608,54.0,https://static.getprophet.io/9wyn8ut9ct9h7c0wbsjnxe4wlr83,Guaranteed,johann,Mr Cena & Friends,18.0,https://static.getprophet.io/oj8vzzofdqzwvr5noajbdenvpnol
608,99.0,https://static.getprophet.io/ihnj1gk9pj7guclszfv49

SQL

Schema

clients
 - id
 - email

Given an array of positive integers, write a function which returns all the unique pairs which add (equal) up to 100.

Example data:

sample_data = [0, 1, 100, 99, 0, 10, 90, 30, 55, 33, 55, 75, 50, 51, 49, 50, 51, 49, 51]
sample_output = [[1,99], [0,100], [10,90], [51,49], [50,50]]
@kruszczynski
kruszczynski / keybase.md
Created December 21, 2018 09:11
Keybase

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 / postgres_queries_and_commands.sql
Created January 2, 2018 15:15 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- 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%'
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) {
# Model
def method(argument, &block)
SomeLibrary.new.other_method(argument, &block)
end
# Test
should '#method' do
block = -> {}
block = Proc.new {}
@kruszczynski
kruszczynski / gist:f771f73fa2b4df80223e
Created May 27, 2014 14:51
Sunspot #with method bug
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: