Skip to content

Instantly share code, notes, and snippets.

View falcon11's full-sized avatar
🌏
🐳

Ashoka falcon11

🌏
🐳
View GitHub Profile
@falcon11
falcon11 / qiniu_sslcert.py
Created January 17, 2023 01:02 — forked from lewangdev/qiniu_sslcert.py
qiniu_sslcert
#!/usr/bin/env python
## Dependencies:
#
# pip install qiniu
#
## Tips for Deploy certs to Qiniu:
#
# export DOMAIN=lewangdev.com
# export QINIU_DOMAIN=images.${DOMAIN},staticfiles.${DOMAIN}
@falcon11
falcon11 / git-add-commit-msg-prefix.md
Created May 9, 2022 12:40
Git: Add prefix to a range of commit messages

Original Link

Imagine that you cloned an open source project to contribute something. You implemented a bugfix through a series of atomic commits on a private branch. Just when you’re about to create a Pull Request to submit your changes, you discover in the contributor’s guide that you’re supposed to prefix each commit with the bug tracking number.

Rewriting the commit message of the last commit is easy:

git commit --amend
@falcon11
falcon11 / usdt_erc20_transfer_demo.js
Created January 28, 2022 06:31 — forked from kangchihlun/usdt_erc20_transfer_demo.js
usdt(erc20) transfer demo
// Created by Chih.Lun.Kang
// 網路上找的範例大部分都不能用,後來嘗試數次只有這方法可行
// 主網的appid => 539ab33xxxx,要去Infura申請,在上面建立一個project
// #### NOTE #### : 要特別注意本身轉帳的帳號要儲備足夠數量的 eth 跟 btc
// #### 注意 #### : 目前使用人工轉換儲值手續費,建議在幣價好的時候一次換匯才划算
const USDTJSON = require('./build/contracts/USDT.json')
const Web3 = require('web3')
const Tx = require('ethereumjs-tx').Transaction
@falcon11
falcon11 / index.md
Created May 18, 2021 06:13 — forked from bvaughn/index.md
How to use profiling in production mode for react-dom
@falcon11
falcon11 / react-dynamic-import.md
Created May 9, 2021 05:36 — forked from adyontech/react-dynamic-import.md
A simple trick to dynamically import components in react.

AsyncLoadFile.jsx

import React, { Component } from 'react';

export default function asyncComponent(importComponent) {
    class AsyncComponent extends Component {
        /**
        * @constructor
        * @desc Represents AsyncComponent component
        * @param props Properties passed from parent component
@falcon11
falcon11 / jquery-scroll-bottom.js
Created February 26, 2019 09:48 — forked from toshimaru/jquery-scroll-bottom.js
Detect the scrolling to bottom of the page using jQuery.
$(window).on("scroll", function() {
var scrollHeight = $(document).height();
var scrollPosition = $(window).height() + $(window).scrollTop();
if ((scrollHeight - scrollPosition) / scrollHeight === 0) {
// when scroll to bottom of the page
}
});
@falcon11
falcon11 / topview.js
Created September 12, 2018 01:09 — forked from mactive/topview.js
rn-topview
/**
* [email protected]
* 2017-05-08
*/
'use strict';
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
@falcon11
falcon11 / react-native-pinch-zoom.js
Created May 18, 2018 04:47 — forked from zshell31/react-native-pinch-zoom.js
React Native: how to implement pinch to zoom gesture
/** Links:
* - http://stackoverflow.com/questions/36368919/scrollable-image-with-pinch-to-zoom
* - http://blog.lum.pe/gesture-detection-in-react-native-fixing-unexpected-panning/
*
*/
import React, {Component, PropTypes} from 'react';
import { Text, View, PanResponder, Image } from 'react-native';
function calcDistance(x1, y1, x2, y2) {
@falcon11
falcon11 / ios_detect.swift
Created April 20, 2018 16:15 — forked from mahmudahsan/ios_detect.swift
iPhone X and other iOS device detection by Swift and Objective-C
struct Device {
// iDevice detection code
static let IS_IPAD = UIDevice.current.userInterfaceIdiom == .pad
static let IS_IPHONE = UIDevice.current.userInterfaceIdiom == .phone
static let IS_RETINA = UIScreen.main.scale >= 2.0
static let SCREEN_WIDTH = Int(UIScreen.main.bounds.size.width)
static let SCREEN_HEIGHT = Int(UIScreen.main.bounds.size.height)
static let SCREEN_MAX_LENGTH = Int( max(SCREEN_WIDTH, SCREEN_HEIGHT) )
static let SCREEN_MIN_LENGTH = Int( min(SCREEN_WIDTH, SCREEN_HEIGHT) )