Skip to content

Instantly share code, notes, and snippets.

@dhh
dhh / Gemfile
Created June 24, 2020 22:23
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
@kleczkowski
kleczkowski / funktory.md
Last active August 25, 2019 23:07
Funktory (aplikatywne)

Funktory (aplikatywne)

Ten artykuł chciałbym poświęcić jednej, dość zapomnianej rzeczy, jaką jest funktor aplikatywny. Mamy pełno artykułów o monadach i ich zastosowaniach, lecz nieczęsto się zdarza czytać o funktorach aplikatywnych i w ogóle --- funktorach.

Stwierdziłem, że funktory aplikatywne mają naprawdę potencjał w realnych zastosowaniach, tylko mało kto sobie zdaje sprawę, że funktor aplikatywny jest w zasadzie funkcyjną wersją, wysokopoziomową, pewnego kreacjonalnego wzorca projektowego.

Zakładam, że wiesz, co to są klasy typów i algebraiczne struktury danych, jak je się definiuje. Generalnie wymagana jest wiedza z Haskella na poziomie pisania w REPLu.

Czym jest funktor?

@IvanivOleg
IvanivOleg / push_notification_sender.py
Last active May 7, 2020 18:50
A small script which helps you to test APNs functionality. Source: http://gobiko.com/blog/token-based-authentication-http2-example-apns/
import json
import jwt
import time
from hyper import HTTPConnection
ALGORITHM = 'ES256'
# fill these items
APNS_KEY_ID = ''
@prestia
prestia / installing_MTGA_on_macOS_with_Retina_support.md
Last active October 13, 2023 23:22
Instructions on how to install Magic the Gathering Arena on macOS with Retina support.

Installing MTGA on macOS using Wine, and making it look pretty!

The following instructions are heavily inspired by /u/uhohohdear. I modified uhohohdear's instructions and then added support for Retina/HiDPI displays and instructions about how to update MTGA.

IMPORTANT UPDATE: This will no longer work if you upgrade to macOS Catalina, as Wine and Wineskin are 32-bit. I'll update this Gist with 64-bit versions when they become available.

We're back in business!

It appears that the workarounds no longer work. A few people with Macs using Nvidia graphics cards are having success, but Macs with Intel and AMD GPUs crash regularly. At this time, the best way to play Arena on Mac is via Boot Camp or GeForce Now.

@F21
F21 / signing-gpg-keys.md
Last active April 12, 2025 16:10
Signing someone's GPG key

This is a quick guide of the commands we use to sign someone's GPG key in a virtual key signing party.

Note: The steps cover only the technical aspects of signing someone's key. Before signing someone's key, you must verify their identity. This is usually done by showing government-issued ID and confirming the key's fingerprint

The commands will work for both GPG and GPG2.

I use Julian's key for the examples. His key id is 2AD3FAE3. You should substitute with the appropriate key id when running the commands.

Signing the key

  1. List the keys currently in your keyring: gpg --list-keys.
@taketo1113
taketo1113 / Replace 'be_success' to 'be_successful'.md
Created May 11, 2018 02:13
Fix 'DEPRECATION WARNING: The success? predicate is deprecated and will be removed in Rails 6.0. Please use successful?'
  • Error
DEPRECATION WARNING: The success? predicate is deprecated and will be removed in Rails 6.0. Please use successful?
  • Sample code
  # deprecated
  expect(response).to be_success
 
@andyyou
andyyou / rails_webpacker_bootstrap_expose_jquery.md
Last active August 9, 2022 07:38
Rails 5.2 with webpacker, bootstrap, stimulus starter

Rails 5.2 with webpacker, bootstrap, stimulus starter

This gist will collects all issues we solved with Rails 5.2 and Webpacker

Create Project

# Last few parameters(--skip-* part) is only my habbit not actully required
$ rails new <project_name> --webpack=stimulus --database=postgresql --skip-coffee --skip-test
@saghiralfasly
saghiralfasly / dataset_to_tfrecord.py
Last active April 29, 2022 06:16
Python script to create tfrecords from pascal VOC data set format (one class detection) for Object Detection API Tensorflow, where it divides dataset into (90% train.record and 10% test.record)
import os
import io
import glob
import hashlib
import pandas as pd
import xml.etree.ElementTree as ET
import tensorflow as tf
import random
from PIL import Image
@yalab
yalab / bootstrap-memo.md
Last active July 20, 2022 20:29
rails5 + webpacker + bootstrap
$ echo 'gem "webpacker"' >> Gemfile
$ bundle install
$ rails webpacker:install
$ yarn add [email protected] jquery popper.js
diff --git a/config/webpack/environment.js b/config/webpack/environment.js
index d16d9af..86bf1a7 100644
@loicginoux
loicginoux / firebase-messaging-sw.js
Last active October 26, 2024 07:16
Adding FCM to an html page to receive notifications and sending then via FCM ruby gem. (edit: HTTPS needed!)
// [START initialize_firebase_in_sw]
// Give the service worker access to Firebase Messaging.
// Note that you can only use Firebase Messaging here, other Firebase libraries
// are not available in the service worker.
importScripts('https://www.gstatic.com/firebasejs/3.5.2/firebase-app.js');
importScripts('https://www.gstatic.com/firebasejs/3.5.2/firebase-messaging.js');
// Initialize the Firebase app in the service worker by passing in the
// messagingSenderId.
firebase.initializeApp({