Skip to content

Instantly share code, notes, and snippets.

To use AWS Lambda (Serverless) with RDS in production, you should

  • warm up functions
  • preserve DRS connections

configure_handlers.js configures Serverless handler functions to achieve them.

Usage

function initialize() {
if (!is_ios()) return;
let document_click_on_ios;
document.addEventListener('touchstart', () => {
document_click_on_ios = true;
});
document.addEventListener('touchmove', () => {

Following the official guide, you'll bump into the following error:

$ sudo zypper ref
Repository 'Google-Chrome' is up to date.
Retrieving repository 'Yarn' metadata --------------------------------------------------------------------------------------------------------------------------------------------------------------------------[\]
Warning: File 'repomd.xml' from repository 'Yarn' is signed with an unknown key '9CBBB5586963F07F'.

    Note: Signing data enables the recipient to verify that no modifications occurred after the data
    were signed. Accepting data with no, wrong or unknown signature can lead to a corrupted system
@necojackarc
necojackarc / .eslintrc.js
Last active December 23, 2020 19:34
My ESLint configuration
module.exports = {
parserOptions: {
ecmaVersion: 2020,
},
env: {
es6: true,
},
root: true,
extends: 'eslint:recommended',
rules: {
@necojackarc
necojackarc / _json_ld_breadcrumbs.html.erb
Last active November 6, 2017 01:58
Render breadcrumbs in JSON-LD with Breadcrumbs On Rails
<!-- app/views/layouts/_json_ld_breadcrumbs.html.erb -->
<script type="application/ld+json">
<%= render_breadcrumbs builder: Breadcrumbs::JsonLdBuilder %>
</script>
@necojackarc
necojackarc / Deploy Hubot with OpsWorks.md
Last active April 24, 2017 08:25
How to Deploy Hubot with OpsWorks

Procedure

  1. Create a new custom cookbook for Hubot
  2. Create a Node.js stack and an app on OpsWorks
  3. Set the recipe in "Deploy" section

Custom Cookbook for Hubot

Put two files as below:

  • hubot/recipes/deploy.rb
  • hubot/templates/default/bin_hubot.erb
@necojackarc
necojackarc / Install Matplotlib with Tk on openSUSE.md
Last active April 13, 2017 09:49
How to Install Matplotlib with Tk Backend on openSUSE

Matplotlib's default background is agg, which doesn't have GUI. It means that show() doesn't show any plots on GUI.

That will never show any window, your matplotlib is configured to use agg, which is no gui version of output. Install a gui backend like python-matplotlib-qt4, python-matplotlib-tk and try again. https://forums.opensuse.org/showthread.php/494173-matplotlib-fails-to-show-plots-after-latest-update-from-the-Sciencerepolistory

So, let's configure Matplotlib to use TkAgg, which is really easy to set up:

@necojackarc
necojackarc / Control Maintenance Mode (Render 503) by Env Vars with Rails.md
Last active February 10, 2018 19:52
How to Control Maintenance Mode (Render 503) by Env Vars with Rails

Environment variables

Key VALUE
MAINTENANCE_MODE When "true", your Rails app runs as maintenance mode
ALLOWED_IPS Set IP addresses you allow to access your Rails app when maintenance mode

Example

@necojackarc
necojackarc / Use ActiveModelSerializers inside Jbuilder.md
Last active March 28, 2017 09:34
How to Use ActiveModelSerializers inside Jbuilder

Background

ActiveModelSerializers (AMS) is often said "an alternative to Jbuilder", but AMS is a kind of decorator which knows only how to serialize the target objects. On the other hand, Jbuilder is a library for the view of MVC.

So, it's a bit tough with only AMS to compose complex JSONs like this:

{
 "users": [

Easy to check which branches will be deleted by removing at the bottom of | sh :)

git branch -r --merged master | sed -e 's#origin/#:#g' | egrep -v 'master|release|ADD BRANCH NAMES YOU WANT TO LEAVE' | sed 's/^/git push origin'/g | sh