Skip to content

Instantly share code, notes, and snippets.

@ronshapiro
ronshapiro / dagger-android-view.md
Last active April 24, 2024 00:19
dagger.android for views in ~10 minutes

1. You can implement View.getActivity() like this:

public interface ViewWithActivity {
  // Using android-gradle-plugin 3.0, which has the desugar step for default methods on interfaces
  default Activity getActivity() {
    // https://android.googlesource.com/platform/frameworks/support/+/03e0f3daf3c97ee95cd78b2f07bc9c1be05d43db/v7/mediarouter/src/android/support/v7/app/MediaRouteButton.java#276
    Context context = getContext();
    while (context instanceof ContextWrapper) {
      if (context instanceof Activity) {
@ruanbekker
ruanbekker / cheatsheet-elasticsearch.md
Last active April 24, 2024 00:11
Elasticsearch Cheatsheet : Example API usage of using Elasticsearch with curl
@jboner
jboner / latency.txt
Last active April 24, 2024 00:08
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@getintio
getintio / getint-versions.md
Last active April 24, 2024 00:07
Getint Platform versions

Version 1.59 (2023-05-10)

Version 1.58 (2023-04-22)

Version 1.57.1 (2023-04-04)

PLATFORM:

  • Empty option handling is removed from UI - it was obsolete
  • Sharing access to instance with support team in controlled and secure way. This feature will enhance way for Getint support team to troubelshoot Jira Cloud and Getint Cloud customers

APPS:

  • Zendesk - bugfix for syncing some specific attachments
  • Jira - bugfix for not fetching all sprints for particular project
@truizlop
truizlop / Wave.swift
Created September 10, 2020 14:41
Wave animation using SwiftUI
import SwiftUI
let LINE_LENGTH: Double = 500.0
let N = 720
let LINES = 18
let WAVES: Double = 18.0
let WAVE_HEIGHT: Double = 20
let SPACING: Double = 27.0
let CURL_AMOUNT: Double = 12.0
@matthewpalmer
matthewpalmer / pod.yaml
Last active April 24, 2024 00:00
Example Kubernetes pod for the multi-container sidecar design pattern
# Example YAML configuration for the sidecar pattern.
# It defines a main application container which writes
# the current date to a log file every five seconds.
# The sidecar container is nginx serving that log file.
# (In practice, your sidecar is likely to be a log collection
# container that uploads to external storage.)
# To run:
@brianredbeard
brianredbeard / 00_popcorn_tofu.md
Last active April 23, 2024 23:57
Wheatsville Popcorn Tofu and Cashew Tamari Dressing

Popcorn Tofu

As reverse engineered from Wheatsville Co-op, Austin, TX

About

After a bit of hunting far and wide I have achieved success. For anyone who's been to Wheatsville Co-op in Austin, Texas knows that it's the bomb. It's received enough of a following that it has it's own Facebook page. The problem is that it's a closely guarded secret with only sparse smatterings of it to be found. At one point I found a recipe in a book

@Rodrigo54
Rodrigo54 / php-html-css-js-minifier.php
Last active April 23, 2024 23:58 — forked from taufik-nurrohman/php-html-css-js-minifier.php
PHP Function to Minify HTML, CSS and JavaScript
<?php
/**
* -----------------------------------------------------------------------------------------
* Based on `https://github.com/mecha-cms/mecha-cms/blob/master/system/kernel/converter.php`
* -----------------------------------------------------------------------------------------
*/
// HTML Minifier
function minify_html($input) {
@adisib
adisib / youtube_hd.user.js
Last active April 23, 2024 23:51
Make youtube videos in HD and automatically resize
// ==UserScript==
// @name Youtube HD
// @author adisib
// @namespace namespace_adisib
// @description Select a youtube resolution and resize the player.
// @version 2024.01.17
// @match https://*.youtube.com/*
// @noframes
// @grant GM.getValue
// @grant GM.setValue