Skip to content

Instantly share code, notes, and snippets.

View jivebot's full-sized avatar

jivebot

  • Brightform Technology
  • Oregon, US
  • 18:20 (UTC -07:00)
View GitHub Profile
@dustingetz
dustingetz / sql_basic_demo_electric.md
Last active January 30, 2024 17:37
SQL basic demo – Electric Clojure

PostgreSQL hello world — Electric Clojure

How do I integrate a SQL database backend?

Easy:

  • make an ordinary Clojure function query-pokemon-list for the query
  • The query is blocking, and Electric Clojure is async, so use e/offload to move it to a thread pool.
    • (Don't block the event loop!)
  • e/offload throws Pending until the query finishes, and then the exception "goes away"
@terrafied
terrafied / delete-all-tweets.py
Last active November 10, 2022 20:20 — forked from ihpannu/delete-all-tweets.py
Python script to delete all tweets using Python version 3
import tweepy
import traceback
import _thread
consumer_key = ''
consumer_secret = ''
access_key = ''
access_secret = ''
@0penBrain
0penBrain / commitCount.sh
Last active May 29, 2024 00:50
The simplest way to get commit count of a GitHub repository through the API
curl -I -k "https://api.github.com/repos/:owner/:repo/commits?per_page=1" | sed -n '/^[Ll]ink:/ s/.*"next".*page=\([0-9]*\).*"last".*/\1/p'
### And that's all !
# I saw many fighting with finding first commit SHA or similar fancy thing.
# Here we just rely on the GH API, asking commits at 1 per page and parsing the last page number in the header of the reply (whose body only holds the last commit !)
# So this is robust and bandwidth efficient. :)
# If one want the commit count of a specific SHA, just use :
curl -I -k "https://api.github.com/repos/:owner/:repo/commits?per_page=1&sha=:sha" | sed -n '/^[Ll]ink:/ s/.*"next".*page=\([0-9]*\).*"last".*/\1/p'
@ArturT
ArturT / main.yaml
Last active November 9, 2022 06:10
GitHub Actions - how to run parallel tests in RSpec for Ruby on Rails project. See article how to run RSpec on GitHub Actions for Ruby on Rails app using parallel jobs https://docs.knapsackpro.com/2019/how-to-run-rspec-on-github-actions-for-ruby-on-rails-app-using-parallel-jobs or sign up at https://knapsackpro.com/?utm_source=github&utm_medium=…
# .github/workflows/main.yaml
name: Main
on: [push]
jobs:
test:
runs-on: ubuntu-latest
# If you need DB like PostgreSQL, Redis then define service below.
@gdestree
gdestree / dnsmasq-setup.md
Created December 18, 2017 19:48
Setup dnsmasq on OS X *updated for .test

Never touch your local /etc/hosts file in OS X again

UPDATED for .test

To setup your computer to work with *.test domains, e.g. project.test, awesome.test and so on, without having to add to your hosts file each time.

Requirements

@brablc
brablc / dnsmasq macOS.md
Last active September 24, 2021 10:24 — forked from ogrrd/dnsmasq OS X.md
Setup dnsmasq on OS X

Never touch your local /etc/hosts file in OS X again

To setup your computer to work with *.test domains, e.g. project.test, awesome.test and so on, without having to add to your hosts file each time.

Requirements

Install

@hadees
hadees / arel_helpers.rb
Created March 5, 2016 05:41
Arel Helpers
module ArelHelpers
extend self
def self.included(base)
base.extend self
end
def asterisk(arel_table_or_model)
arel_table, columns = case arel_table_or_model
when Arel::Table
@kuboon
kuboon / Gemfile
Created November 20, 2015 06:30
acts_as_taggable_on + simple_form + select2
gem 'acts-as-taggable-on'
gem 'simple_form'
gem 'select2-rails'
@toddmotto
toddmotto / *.md
Created September 14, 2015 13:46
How I lost 20kg/3stone/44lbs

Everytime I tweet about losing weight and posting images, a lot of people ask questions - so thought I'd write something decent down about what I've done so far and am currently working on.

12 months change:

Necessary changes

Step 1: Fixing your diet

My diet used to be so so bad, energy drinks, constant sugar intake. Kill that! I also used to order takeaways at least 2-3 times a week, because it was easy and the bigger you get the lazier you get from my experience.

@henrik
henrik / config--initializers--rails4_to_rails3_downgradability.rb
Created June 18, 2015 09:55
Fix "NoMethodError: undefined method `sweep'" error when downgrading from Rails 4 to Rails 3.
# Without this fix, downgrading from Rails 4 to Rails 3 causes session cookies to blow up.
#
# The way the flash is stored in the session changed in a backwards-incompatible way.
if Rails::VERSION::MAJOR == 3
module ActionDispatch
class Flash
def call(env)
if (session = env['rack.session']) && (flash = session['flash'])