Skip to content

Instantly share code, notes, and snippets.

View jivebot's full-sized avatar

jivebot

  • Brightform Technology
  • Oregon, US
  • 09:21 (UTC -07:00)
View GitHub Profile
@dustingetz
dustingetz / sql_basic_demo_electric.md
Last active August 21, 2024 09:14
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 February 18, 2025 10:05
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'
@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'])
@dustingetz
dustingetz / gist:71fe73f8599b13c9e59e
Last active October 4, 2016 12:11
hypercrud livecoding demo
;; Datomic uses immutability to make read queries come from in-app process instead of network.
;; Web service backed by datomic can have same performance characteristics - browser ajax read
;; queries can come from in-browser. Changes browser programming model - can code as if all data
;; is local. Removes all read-IO from browser apps. Components that do IO can now compose.
;; Still ACID & relational queries like datomic.
;;
;; Other solutions to same problem: Facebook Relay/GraphQL, Netflix Falcor, Om Next