Skip to content

Instantly share code, notes, and snippets.

@nickbutcher
nickbutcher / 1 search_bar.xml
Last active March 26, 2022 10:03
Demonstrating morphing a search icon into a search field. To do this we use an AnimatedVectorDrawable (https://developer.android.com/reference/android/graphics/drawable/AnimatedVectorDrawable.html) made up of two paths. The first is the search icon (as a single line) the second is the horizontal bar. We then animate the 'trimPathStart' property …
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 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
@staltz
staltz / introrx.md
Last active May 7, 2024 09:38
The introduction to Reactive Programming you've been missing
@haggen
haggen / apple-crayon.scss
Last active February 18, 2024 20:16
Apple Crayon Palette RGB values in SASS
// Apple Crayon Palette RGB
$cantaloupe: rgb(255, 206, 110);
$honeydew: rgb(206, 250, 110);
$spindrift: rgb(104, 251, 208);
$sky: rgb(106, 207, 255);
$lavender: rgb(210, 120, 255);
$carnation: rgb(255, 127, 211);
$licorice: rgb(0, 0, 0);
$snow: rgb(255, 255, 255);
@jcouyang
jcouyang / 2012-12-31-node-dot-js-vs-tornado-vs-php.markdown
Last active January 15, 2021 02:38
为什么事件驱动服务器这么火

本文基本上这为两篇文章的翻译和整合 -- Scalable networking And Why are event-driven server so great

OPPC模型瓶颈

传统服务器模型如Apache为每一个请求生成一个子进程。当用户连接到服务器的一个子进程就产生,并处理连接。每个连接获得一个单独的线程和子进程。当用户请求数据返回时,子进程开始等待数据库操作返回。如果此时另一个用户也请求返回数据,这时就产生了阻塞。

这种模式在非常小的工作负荷是表现良好,当请求的数量变得太大是服务器会压力过于巨大。 当Apache达到进程的最大数量,所有进程都变得缓慢。每个请求都有自己的线程,如果服务代码使用PHP编写时,每个进程所需要的内存量是相当大的[1]。

fork()操作延时

@varis
varis / Activity Manager.java
Created August 5, 2011 23:51
Android / System Services
// AndroidManifest.xml must have the following permission:
// <uses-permission android:name="android.permission.GET_TASKS"/>
ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);