Skip to content

Instantly share code, notes, and snippets.

@sbarski
sbarski / index.js
Last active January 5, 2023 11:10
A Lambda function that creates and submits an Elastic Transcoder job after being invoked by an S3 bucket
'use strict';
var AWS = require('aws-sdk');
var s3 = new AWS.S3({
apiVersion: '2012-09-25'
});
var eltr = new AWS.ElasticTranscoder({
apiVersion: '2012-09-25',
region: 'us-east-1'
});
@printercu
printercu / rails-5.0-integration-tests-speedup.md
Last active March 7, 2022 01:20
Speed up Rails 5 integration tests

Speed up integration tests in Rails 5 app

Rails 5 recompiles templates on every request in test env. Fix will be released only in 5.0.2.

Add this lines to test helper to get the performance now (I've got x2 improvement):

class << ActionView::LookupContext::DetailsKey
 def clear
@Ashoat
Ashoat / text-height-measurer.js
Created May 11, 2017 04:24
React Native component for measuring text height
// @flow
import type {
StyleObj,
} from 'react-native/Libraries/StyleSheet/StyleSheetTypes';
import React from 'react';
import PropTypes from 'prop-types';
import { Text, View, StyleSheet } from 'react-native';
import invariant from 'invariant';
files:
"/opt/elasticbeanstalk/support/conf/sidekiq.conf":
mode: "000755"
content: |
description "Elastic Beanstalk Sidekiq Upstart Manager"
start on runlevel [2345]
stop on runlevel [06]
# explained above
respawn
respawn limit 2 30
@florina-muntenescu
florina-muntenescu / BaseDao.kt
Last active January 1, 2025 06:52
Use Dao inheritance to reduce the amount of boilerplate code - https://medium.com/google-developers/7-pro-tips-for-room-fbadea4bfbd1
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
let people = [
{ name: 'Bob', age: 28, child: { name: 'Sally', age: 8, grade: 3 } },
{ name: 'Sara', age: 46, child: { name: 'Lois', age: 14, grade: 9 } },
{ name: 'Ann', age: 27, child: { name: 'George', age: 9, grade: 4 } },
{ name: 'Dave', age: 52, child: { name: 'Hale', age: 17, grade: 11 } },
];
const add1 = (x) => x + 1;
const toFieldApplyFunc = (field, fn) => {
return (obj) => {