Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Tuan Nguyen Anh anhtuank7c

🎯
Focusing
Block or report user

Report or block anhtuank7c

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View watermelon-sync-logger.js
// @flow
import { map, is } from 'rambdax'
import type { DirtyRaw } from '@nozbe/watermelondb/RawRecord'
import type { SyncLog } from '@nozbe/watermelondb/sync'
// beginning, end, length
const censorValue = (value: string): string =>
`${value.slice(0, 2)}***${value.slice(-2)}(${value.length})`
const shouldCensorKey = (key: string): boolean =>
@CodingDoug
CodingDoug / README.md
Last active Jul 12, 2019
Example code from the video "Use async/await with TypeScript in Cloud Functions"
View README.md

Example code from the video "Use async/await with TypeScript in Cloud Functions"

This is the example code from my video about using async/await with Cloud Functions. I've placed it here in a gist so it's easier to compare the "before" and "after" states for each case.

Watch the video here

The code in this project is licensed under the Apache License 2.0.

Copyright 2018 Google LLC
View Podfile
# When using RN in combination with Cocoapods, a lot of
# things are broken. These are the fixes we had to append
# to our Podfile when upgrading to ReactNative@0.55.3.
#
# WARNING: Check those line numbers when you're on a different version!
def change_lines_in_file(file_path, &change)
print "Fixing #{file_path}...\n"
contents = []
View smscode
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
@ericksli
ericksli / ReactNativeExtensions.kt
Last active Aug 29, 2019
React Native Kotlin extension functions for creating WritableMap and WritableArray #android #react-native #kotlin
View ReactNativeExtensions.kt
import com.facebook.react.bridge.Arguments
import com.facebook.react.bridge.WritableArray
import com.facebook.react.bridge.WritableMap
fun writableMapOf(vararg values: Pair<String, *>): WritableMap {
val map = Arguments.createMap()
for ((key, value) in values) {
when (value) {
null -> map.putNull(key)
is Boolean -> map.putBoolean(key, value)
@msand
msand / svg-css-inliner-color-hexer-gradient-defs-grouper-number-formatter.js
Last active Feb 19, 2019
Convert Illustrator SVG export into cross-platform CSS independent mode. CSS rule and style inlining, group gradients into a definitions tag, remove elements with display set to none, make colors hex. Works with react-native-web react-native-svg and svgs to give cross-platform web and native mobile rendering of any SVG produced in Illustrator.
View svg-css-inliner-color-hexer-gradient-defs-grouper-number-formatter.js
/*
Open console.
(Import https://raw.githubusercontent.com/MikeMcl/decimal.js/master/decimal.js first if you want/need number formatting)
Then copy & paste this + enter, to run this.
Copy console output to a NewFile.js or NewFile.jsx file.
prettier --write NewFile.js
*/
/* eslint no-console: ["error", { allow: ["log"] }] */
/* global document, Decimal*/
(() => {
View url-schemes-settings-ios.mkd

Note

Apple will reject apps that are using private url schemes (Ugh, Apple....) if they are pretty much obvius. Some apps are rejected and others are not, so, be aware of this issue before implementing any of those URL's in your app as a feature.

Updates

  • [UPDATE 4] iOS 10 update: apparently settings now can be reached using App-Pref instead of prefs
  • [UPDATE 3] For now you just can use url schemes to open your apps's settings with Swift 3.0 (Xcode 8). I'll keep you informed when OS preferences can be reached
  • [UPDATE 2] The openURL() method of UIApplication is now deprecated. You should use application(_:open:options:) instead
  • [UPDATE 1] Not yet tested in iOS 10. It will fail because of policies changes in URL scheme handling.
@brennanMKE
brennanMKE / EventEmitter.swift
Last active Aug 28, 2019
React Native Event Emitter for RCTEventEmitter in Objective-C and Swift
View EventEmitter.swift
class EventEmitter
/// Shared Instance.
public static var sharedInstance = EventEmitter()
// ReactNativeEventEmitter is instantiated by React Native with the bridge.
private static var eventEmitter: ReactNativeEventEmitter!
private init() {}
View 0-bridging-react-native-cheatsheet.md
@delfrrr
delfrrr / background.js
Created Jan 31, 2017
react-native requestAnimationFrame and d3-interpolate
View background.js
//this is an example of background animation from my weather comparsion app
//you can get early build of app at http://zowni.com
//full source of background.js below
const React = require('react');
const Svg = React.createFactory(require('react-native-svg').Svg);
const {interpolate} = require('d3-interpolate');
//...
/**
You can’t perform that action at this time.