Skip to content

Instantly share code, notes, and snippets.

View henrytao-me's full-sized avatar

Henry Tao henrytao-me

View GitHub Profile
@tobi
tobi / kindle.rb
Last active September 25, 2022 02:37
Download your Kindle Highlights to local markdown files. Great for Obsidian.md.
#!/usr/bin/env ruby
# gem install active_support
require 'active_support/inflector'
require 'active_support/core_ext/string'
# gem install webrick (only ruby3)
require 'webrick'
# gem install mechanize
@bhaskarmurthy
bhaskarmurthy / react-native-principles.md
Last active October 30, 2020 13:56
React Native notes

React Native principles

October 28, 2020

https://reactnative.dev/blog/2020/07/17/react-native-principles

  • Our top priority for React Native is to match the expectations people have for each platform. This is why React Native renders to platform primitives. We value native look-and-feel over cross-platform consistency.
  • In order to match the look-and-feel of native apps, we must also match their performance.
  • Great user experiences are created iteratively. It should only take a few seconds to seeing the result of code changes in a running app. React Native's architecture enables it to provide near-instant feedback during development.
  • Teams can easily leverage the fast-growing ecosystem of high quality open source packages. Teams can also share business logic between Android, iOS, and the web. This helps them ship updates faster and reduce organizational silos between platform teams.
@chourobin
chourobin / 0-bridging-react-native-cheatsheet.md
Last active May 4, 2024 14:06
React Native Bridging Cheatsheet
@thorsten
thorsten / setUserAgent.js
Created May 9, 2016 15:12
Override user agent on all browsers
function setUserAgent(window, userAgent) {
// Works on Firefox, Chrome, Opera and IE9+
if (navigator.__defineGetter__) {
navigator.__defineGetter__('userAgent', function () {
return userAgent;
});
} else if (Object.defineProperty) {
Object.defineProperty(navigator, 'userAgent', {
get: function () {
return userAgent;
@tan-yuki
tan-yuki / camelToSnake.js
Created August 24, 2012 13:06
camel case to snake case
String.prototype.toSnakeCase = function() {
var upperChars = this.match(/([A-Z])/g);
if (! upperChars) {
return this;
}
var str = this.toString();
for (var i = 0, n = upperChars.length; i < n; i++) {
str = str.replace(new RegExp(upperChars[i]), '_' + upperChars[i].toLowerCase());
}
public class CheckableFrameLayout extends FrameLayout implements Checkable {
private static final int[] CHECKED_STATE_SET = {
android.R.attr.state_activated,
android.R.attr.state_checked,
};
private boolean mChecked;
public CheckableFrameLayout(Context context) {
super(context);