Skip to content

Instantly share code, notes, and snippets.

View kirillzh's full-sized avatar
☀️

Kirill Zhukov kirillzh

☀️
View GitHub Profile
@e2
e2 / stopping_backward_compatibility_madness.md
Last active April 8, 2020 05:30
How to stop the "Backward Compatibility Cult" before it kills Ruby.

How to stop the "Backward Compatibility Cult" before it kills Ruby.

  1. It's irresponsible to support Ruby < 2.2. A Ruby version is not "supported" if it's only getting security fixes. Because "support" means fixing bugs. And any Ruby version < 2.2 is rife with "never-to-be-fixed" bugs that can occur at any time. A minor OS upgrade, a minor gem upgrade ... and suddenly a new (or old) bug is triggered and Ruby crashes every time. At this point, the user may be forced to upgrade (at the most inconvenient time possible). The only other option is for everyone to implement some obscure workaround to side-step the bug in their outdated Ruby version. Ridiculous effort and costs just to keep a likely vulnerable (and definitely broken - even if it "works") version of Ruby around.

  2. Ruby 2.2.4 fixes an important vulnerability. There is a patch-level version of Ruby 2.0 (patch-level in code terms, not SemVer) and a minor of Ruby 2.1.9 to solve t

@adavis
adavis / BeforeLoginActivityTest.java
Last active April 7, 2022 13:58
Using Screen Robots with Android Espresso Tests
package <your_package>;
import android.support.test.espresso.intent.rule.IntentsTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.LargeTest;
import org.junit.After;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
require 'net/http'
require 'json'
# 此类只是检测 token 是否有效
# 如果前端有传 user_id 和 email 过来,其值还需与接口返回的值对比
class AuthTokenUtil
class << self
=begin
@saxophone
saxophone / ResultTestActivity.java
Last active October 13, 2020 14:43
Use Android Espresso to test that your Activity finishes with the expected result.
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;
import static android.support.test.InstrumentationRegistry.getInstrumentation;
import static org.hamcrest.MatcherAssert.assertThat;
@polbins
polbins / README.md
Last active June 20, 2022 02:50
Android Studio as default Git Diff Tool

Create Android Studio Command-line Launcher

  1. Open Android Studio
  2. Go to: Tools > Create Command-line Launcher
  3. Leave as default, Press OK

Configure Git to use Android Studio as default Diff Tool

  1. Add the following lines to your .gitconfig
@atcuno
atcuno / gist:3425484ac5cce5298932
Last active March 25, 2024 13:55
HowTo: Privacy & Security Conscious Browsing

The purpose of this document is to make recommendations on how to browse in a privacy and security conscious manner. This information is compiled from a number of sources, which are referenced throughout the document, as well as my own experiences with the described technologies.

I welcome contributions and comments on the information contained. Please see the How to Contribute section for information on contributing your own knowledge.

Table of Contents

@tlowrimore
tlowrimore / address_books_controller.rb
Last active June 1, 2024 04:53
Keeps your API lookin' good! No need for all that nested_attributes pollution in your request/response payloads
class V1::AddressBooksController < V1::BaseController
def create
@address_book = AddressBook.new address_book_params
unless @address_book.save
errors = @address_book.errors.to_hash(true)
render status: 422, json: { errors: errors }
end
end
private
@LeCoupa
LeCoupa / bash-cheatsheet.sh
Last active May 27, 2024 20:46
Bash CheatSheet for UNIX Systems --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
@staltz
staltz / introrx.md
Last active June 6, 2024 03:19
The introduction to Reactive Programming you've been missing
@bryanhunter
bryanhunter / build-erlang-17.0.sh
Last active May 22, 2022 12:02
Build Erlang 17.0 on a fresh Ubuntu box (tested on 12.04 and 14.04)
#!/bin/bash
# Pull this file down, make it executable and run it with sudo
# wget https://gist.githubusercontent.com/bryanhunter/10380945/raw/build-erlang-17.0.sh
# chmod u+x build-erlang-17.0.sh
# sudo ./build-erlang-17.0.sh
if [ $(id -u) != "0" ]; then
echo "You must be the superuser to run this script" >&2
exit 1
fi