Skip to content

Instantly share code, notes, and snippets.

View maxcodes's full-sized avatar
🤓
Hire me! hire@maxholzheu.com

Max Holzheu maxcodes

🤓
Hire me! hire@maxholzheu.com
View GitHub Profile
@maxcodes
maxcodes / test.php
Created December 1, 2021 06:04
php recurrente
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://app.recurrente.com/api/checkouts');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{ \"items\": [{ \"price_id\": \"pr_XXXXX\" }] }");
$headers = array();
$headers[] = 'X-Public-Key: pk_live_XXXXX';
$headers[] = 'X-Secret-Key: sk_live_XXXXX';
@maxcodes
maxcodes / goodreads_to_roam.rb
Last active April 22, 2020 02:31
Import Goodreads Export into Roam
require "csv"
def roam_bookshelf(shelf)
case shelf
when "favorites"
"Favorite"
when "re-read"
"Re-Read"
when "bios"
"Biography"
@maxcodes
maxcodes / HomeScene_Original.js
Last active January 21, 2018 17:48
OneSignal
import { compose, setPropTypes, withHandlers, lifecycle, getContext, withState } from 'recompose'
const HomeScene = ({ }) => (
<View>
// omitted
</View>
)
export default compose(
setPropTypes({
@maxcodes
maxcodes / setup_selenium_server.sh
Last active May 5, 2017 22:05
Setup a Selenium server
wget https://chromedriver.storage.googleapis.com/2.27/chromedriver_linux64.zip
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
sudo apt-get update
sudo apt-get install google-chrome-stable
@maxcodes
maxcodes / script.sh
Created October 27, 2016 06:18
How to install node using nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.0/install.sh | bash
# open new shell
command -v nvm # should output "nvm"
nvm install node
require 'fuzzystringmatch'
desc "This task eliminates books without ISBN, finds the duplicated books and merges them"
task find_duplicated_books: :environment do
jarow = FuzzyStringMatch::JaroWinkler.create(:native)
#Destroy books without isbn that have no shelf_books and progresses
Book.where(isbn: nil).where(shelf_books_count: 0, progresses_count: 0).destroy_all
books = Book.all # These are 30K books.
@maxcodes
maxcodes / Beek_technical_challenge.md
Last active May 3, 2016 23:04 — forked from tadast/Alphasights_technical_challenge.md
A technical challenge we give to our Ruby on Rails applicants in order to evaluate their coding proficiency.

Beek Technical Challenge

Using Ruby on Rails we would like you to create a simple expert search tool. The application should fulfill the requirements below. The source code must be placed in a public repo on GitHub. The application should be deployable on Heroku.

  • I enter a name and a personal website address and a member is created.
  • When a member is created, all the heading (h1-h3) values are pulled in from the website to that members profile.
  • The website url is shortened (e.g. using http://goo.gl)
  • After the member has been added, I can define their friendships with other existing members. Friendships are bi-directional i.e. If David is a friend of Oliver, Oliver is always a friend of David as well.
  • The interface should list all members with their name, short url and the number of friends e.g. Alan http://goo.gl/3io1P (3)
@maxcodes
maxcodes / models.rb
Created January 8, 2016 17:43
Refactoring blocks
class Book < ActiveRecord::Base
has_many :shelf_books
has_many :shared_items, as: :item
has_many :book_reviews
end
class ShelfBook < ActiveRecord::Base
belongs_to :book
end
workers Integer(ENV['WEB_CONCURRENCY'] || 2) # currently not set, so 2
threads_count = Integer(ENV['MAX_THREADS'] || 5) # currently not set, so 5
threads threads_count, threads_count
preload_app!
rackup DefaultRackup
port ENV['PORT'] || 3000
environment ENV['RACK_ENV'] || 'development'
@maxcodes
maxcodes / _like.html.erb
Last active August 29, 2015 14:26
Trying to extend PublicActivity::Activity, as per https://github.com/chaps-io/public_activity/issues/219
# If I debug here and execute the code on activity.rb manually, it works
<i class="fa fa-heart-o"> <%= @notification.activity.likes.count %></i>