Skip to content

Instantly share code, notes, and snippets.

This file has been truncated, but you can view the full file.
! function(t) {
function e(t) {
function e(e) {
if (o.onerror = o.onload = o.onreadystatechange = null, e) {
var i = s[t];
if (delete s[t], i)
for (; i.length;) i.shift().error.call(null, n)
}
}
var i = document.getElementsByTagName("head")[0],
@GingerBear
GingerBear / gist:2c5eea66180deba994b5c93dc83c506c
Created March 3, 2017 16:29
build.gradle to make react-native-device-info and react-native-maps work together
compile(project(':react-native-device-info')){
exclude group: 'com.google.android.gms', module: 'play-services-gcm'
}
compile 'com.google.android.gms:play-services-gcm:9.8.0'
compile project(':react-native-maps')
@GingerBear
GingerBear / gist:641f36fc175def0ca7eba477f86d9ed0
Created March 8, 2017 19:57
inject js to ios that put catch
document.querySelector('#printLink').addEventListener('click', function() {
var iframe = document.querySelector('.printLink-iframe');
if (!iframe) {
iframe = document.createElement('div');
iframe.style.display = 'none';
iframe.classList.add('printLink-iframe');
}
iframe.innerHTML = '<iframe src="/printLink-iframe"></iframe>';
document.body.appendChild(iframe);
@GingerBear
GingerBear / gist:36efef9b179bb79ec6b551fed6e6fc99
Created March 8, 2017 19:57
inject js to ios that put catch
document.querySelector('#printLink').addEventListener('click', function() {
var iframe = document.querySelector('.printLink-iframe');
if (!iframe) {
iframe = document.createElement('div');
iframe.style.display = 'none';
iframe.classList.add('printLink-iframe');
}
iframe.innerHTML = '<iframe src="/printLink-iframe"></iframe>';
document.body.appendChild(iframe);
@GingerBear
GingerBear / injectCSSToHide.js
Last active May 10, 2017 16:48
inject css to hide elements
function injectCSS(css) {
var style = document.createElement('style');
style.innerHTML = css;
document.head.appendChild(style);
}
document.addEventListener('DOMContentLoaded', function() {
injectCSS('.header-widget {display: none}')
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
@GingerBear
GingerBear / gist:6aedca970faae3d4cbd662e01b982f85
Created March 15, 2017 22:39
react-navigation push and pop
// "react-native": "0.42.0",
// "react-navigation": "^1.0.0-beta.7"
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
@GingerBear
GingerBear / highlight.js
Last active April 27, 2017 18:47
highlights string by keyword, split into pieces, keep character case
function highlightStr(name, query) {
if (!query)
return [
{
str: name,
isHighlight: false
}
];
const queryRegx = new RegExp(query, "ig");
@GingerBear
GingerBear / rename_xcode_project.sh
Created June 7, 2017 16:24
rename xcode project name
# change xcode project name from "BadNamedProject" to "GoodNamedProject"
# change code
grep -r 'BadNamedProject' -l --null . | xargs -0 sed -i '' 's#BadNamedProject#GoodNamedProject#g'
# change filename
find . -depth -name "*BadNamedProject*" -execdir sh -c 'mv {} $(echo {} | sed "s/BadNamedProject/GoodNamedProject/")' \;
@GingerBear
GingerBear / gist:d95fe862a506a2db605ad6026a18bf1c
Last active June 23, 2017 05:12
add text position adjust to tabbar label RCCTabBarController.m
    id imageInsets = tabItemLayout[@"props"][@"iconInsets"];
    if (imageInsets && imageInsets != (id)[NSNull null])
    {
      id topInset = imageInsets[@"top"];
      id leftInset = imageInsets[@"left"];
      id bottomInset = imageInsets[@"bottom"];
      id rightInset = imageInsets[@"right"];
      
      CGFloat top = topInset != (id)[NSNull null] ? [RCTConvert CGFloat:topInset] : 0;