Skip to content

Instantly share code, notes, and snippets.

View ben-gy's full-sized avatar
🏠
Working from home

Ben Richardson ben-gy

🏠
Working from home
View GitHub Profile

API calls

Authentication

Handled with bearer token in the headers: Authorization: Bearer <token> where <token> is the api_key provisioned by Comply Group.

Sample received

POST   /api/v1/received_samples
params = {
  "samples": [
GIT
remote: https://github.com/ben-gy/flexbox_rb.git
revision: 980eaaafda86bb34cd9deeda6b9655f9d101b1cc
specs:
flexbox_rb (0.5)
railties (>= 3.2.6)
GIT
remote: https://github.com/ben-gy/slack-notify.git
revision: 04001abc1676e6e50872d605a84e77342c9c1ec6
@ben-gy
ben-gy / gist:346fa29ab4495c2f49f95196f3942616
Created September 19, 2020 22:53
Latest Gemfile for autoprefixer issue
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '2.7.1'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails'
# Use pg as the database for Active Record
gem 'pg'
# Use Puma as the app server
@ben-gy
ben-gy / Gemfile.rb
Created April 23, 2019 03:06
This is a copy of the gemfile for a social network that I'm building
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '2.6.0'
# ++ Back-end infrastructure
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails'
# Use pg as the database for Active Record
@ben-gy
ben-gy / setup.md
Last active April 23, 2019 03:11
How I usually setup a new Rails app

New repo setup

Read the documentation and install each of the following gems after initialising a new rails application. I have provided some initialiser snippets from one of my Rails 5.2 projects with configuration that I'd like to be setup, but please read the documentation to verify the snippets are still constructed correctly based on current gem versions today.

  • install pg (remove sqlite)
  • install paper_trail
  • install act_as_paranoid
  • install rack-attack
class Rack::Attack
An error occurred while installing pg (0.21.0), and Bundler cannot continue.
Make sure that `gem install pg -v '0.21.0' --source 'https://rubygems.org/'` succeeds before bundling.
### Use the command below to fix the error above after having installed postgres.app
sudo ARCHFLAGS="-arch x86_64" gem install pg -v '0.21.0' -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/10/bin/pg_config
import string
import requests
from bs4 import BeautifulSoup
import json
import glob
from multiprocessing import Pool
import sys
API_KEY = None # your api key here
CRUNCHBASE_COMPANY_API = "http://api.crunchbase.com/v/1/company/%s.js?api_key=%s"

My Gemfile (working version)

I try and keep a very verbose Rails Gemfile so any new developers working on my startup can very quickly understand what gems are installed, why they're installed, and the value they add to the project.

I also use my Gemfile as a bit of a todo list when I find smarter or faster gems, or just new cool things that I want to try out. I thought I'd release a copy of what it looks like if you're interested.

source 'https://rubygems.org'
ruby '2.3.1'
meta[name="mobile-web-app-capable" content="yes"]
meta[name="apple-mobile-web-app-capable" content="yes"]
meta[name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"]
meta[http-equiv="X-UA-Compatible" content="IE=edge"]
meta[name="apple-mobile-web-app-status-bar-style" content="black"]
meta[name="format-detection" content="telephone=no"]
  1. Open terminal
  2. Drop the folder where you want to keep the script in the terminal window
  3. Type "touch backup_script" and hit enter

Now, every time you want to run a backup, open your terminal and drop the script into the window and hit enter.

nb// the folder locations are hardcoded and it's not automatic (run it manually each day)

#!/bin/bash