Skip to content

Instantly share code, notes, and snippets.

View pfeiffer's full-sized avatar

Mattias Pfeiffer pfeiffer

View GitHub Profile
@jasonbekolay
jasonbekolay / trigger webViewWebContentProcessDidTerminate in simulator
Last active April 25, 2024 10:24
Killing a WKWebView content process in the iOS simulator to trigger a webViewWebContentProcessDidTerminate call
# In the command line, find the PID of your simulator process:
ps -p `pgrep launchd_sim`
# or if you have many simulators running:
ps -A | grep launchd_sim
# Find the PID of the WebContent process:
pgrep -P <simulator-pid> 'com.apple.WebKit.WebContent'
# kill it
@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
@palkan
palkan / 01_Readme.md
Last active April 30, 2023 00:03
Backport Rails 6 per-environment credentials

Backport Rails 6 per-environment credentials to Rails 5.2

Rails PR: rails/rails#33521

This patch makes it possible to use per-environment credentials (i.e., config/credentials/staging.yml.enc) in Rails 5.2.

Installation

  • Drop backport_rails_six_credentials.rb and backport_rails_six_credentials_command.rb somewhere, for example, into the lib/ folder
  • Add this line to config/application.rb:
@onefriendaday
onefriendaday / seo-plugin.js
Created June 27, 2018 15:14
Storyblok SEO Plugin
const Fieldtype = {
mixins: [window.Storyblok.plugin],
template: `
<div>Google snippet preview:
<div style="margin:5px 0 15px;padding:10px;color:#000;background:#fff">
<div style="color:blue;text-decoration:underline">{{ model.title }}</div>
<div style="color:green">yoursite.com/example</div>
<div>{{ model.description }}</div>
</div>
<div class=uk-form-row>
@jcdavison
jcdavison / rails-react-relay-graphql-workshop.md
Last active March 20, 2018 18:58
Learn to use Rails with React - Relay - Graphql

Join me as I conduct a live tutorial walk through of how to use Facebook's GraphQl/Relay tools to conduct high performance client side cache management in the context of a Ruby on Rails server, React client side stuff(z) and a declarative, non-RESTful, api.

We will be using a live application, source code and tutorials that I've written.

Live Application Site

Source Code

.
├── actions
├── stores
├── views
│   ├── Anonymous
│   │   ├── __tests__
│   │   ├── views
│   │   │   ├── Home
│   │   │   │   ├── __tests__
│   │   │   │   └── Handler.js
# config/routes.rb
resources :documents do
scope module: 'documents' do
resources :versions do
post :restore, on: :member
end
resource :lock
end
end
@ChrisTM
ChrisTM / block-grid.less
Last active August 25, 2022 19:53
Foundation 5's block grids for Bootstrap 3.
// # Block Grid
//
// Technique adapted from Foundation 5 for Bootstrap 3.0.3 to at least 3.3.1.
// https://github.com/zurb/foundation/blob/f755d8704123f86c281ede0b171881e2672f150d/scss/foundation/components/_block-grid.scss
//
// # Example Usage
//
// To produce a grid of 2 items per row on an extra-small screen, and 3 items
// per row on a small screen:
//
@rummelonp
rummelonp / yokkyu.rb
Last active October 1, 2019 09:12
ActiveRecord で Enumerize と StateMachine 使うやつ
class Yokkyu < ActiveRecord::Base
extend Enumerize
enumerize :status, scope: true, default: :awaiting in: {
awaiting: 1,
approved: 2,
rejected: 3,
}
state_machine :status do
@jkotchoff
jkotchoff / google_play_verification.rb
Last active July 6, 2023 17:57
Verifying an Android subscription in a Ruby on Rails app using the Google Play API
class GooglePlayVerification
require 'google/api_client'
# Refer:
# https://code.google.com/p/google-api-ruby-client/issues/detail?id=72
# and
# http://jonathanotto.com/blog/google_oauth2_api_quick_tutorial.html
# and
# http://milancermak.wordpress.com/2012/08/24/server-side-verification-of-google-play-subsc/
GOOGLE_KEY = 'xxx-xxx.apps.googleusercontent.com'