Skip to content

Instantly share code, notes, and snippets.

Parashuram N axemclion

Block or report user

Report or block axemclion

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
@axemclion
axemclion / adding_flipper.diff
Last active Sep 29, 2019
Adding Flipper to an existing React Native project
View adding_flipper.diff
diff --git a/android/app/build.gradle b/android/app/build.gradle
index 6560b78..eade6f6 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -176,12 +176,21 @@ android {
}
}
+ packagingOptions {
+ pickFirst '**/libc++_shared.so'
@axemclion
axemclion / fix-yoga-react-native.sh
Created Sep 5, 2019
Fix Yoga conflict when using Flipper with React Native (for rn <0.62)
View fix-yoga-react-native.sh
sed -i '.bak' s/\'yoga\'/\'Yoga\'/ node_modules/react-native/ReactCommon/yoga/yoga.podspec
sed -i '.bak' s/\#\{version\}\.React/1\.14\.3/ node_modules/react-native/ReactCommon/yoga/yoga.podspec
sed -i '.bak' s/\#.Pinning/spec.pod_target_xcconfig=\{\'DEFINES_MODULE\'=\>\'YES\'\\}\#/ node_modules/react-native/ReactCommon/yoga/yoga.podspec
sed -i '.bak' s/\"yoga\",.\"\#\{version\}\.React\"/\"Yoga\"/ node_modules/react-native/React/React-Core.podspec
sed -i '.bak' s/\'yoga\'/\'Yoga\'/ ios/Podfile
@axemclion
axemclion / MainApplication.java
Created Aug 12, 2019
Adding Flipper to ReactNative
View MainApplication.java
// Call this in MainApplication.onCreate(), just after Soloader line.
private static void initialize(Context context) {
if (BuildConfig.DEBUG) {
try {
/*
We use reflection here to pick up the class that initializes Flipper,
since Flipper library is not available in release mode
*/
Class<?> aClass = Class.forName("com.facebook.flipper.ReactNativeFlipper");
aClass.getMethod("initializeFlipper", Context.class).invoke(null, context);
@axemclion
axemclion / JSIObject.cpp
Last active Jan 15, 2019
React Native JSI Example
View JSIObject.cpp
// This sample is a Work in Progress for JSI , and specific functions may change.
#pragma once
#include <string>
#include <unordered_map>
#include <jsi/jsi.h>
// This SameplJSIObject needs to inheric from HostObject, and this is the object that will be exposed to JS.
@axemclion
axemclion / FlutterToastPlugin.java
Created Dec 2, 2018
An adapter to use React Native's Native Modules in Flutter
View FlutterToastPlugin.java
package com.example.helloflutterplugin;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.modules.toast.ToastModule;
import com.nparashuram.reactnative.ReactNativeModuleAdapter;
import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
import io.flutter.plugin.common.MethodChannel.Result;
import io.flutter.plugin.common.PluginRegistry.Registrar;
@axemclion
axemclion / PerfLogger.java
Last active Sep 15, 2019
React Native Android - Systrace from ReactMarkers
View PerfLogger.java
package com.nparashuram;
import android.os.Process;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.ViewTreeObserver;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.bridge.ReactContext;
@axemclion
axemclion / MainApplication.java
Created Nov 11, 2018
React Native Android Startup - logging
View MainApplication.java
@Override
public void onCreate() {
super.onCreate();
///////// Add lines below this to capture times of the large sections
final String TAG = "RN_STARTUP"; // If you already have a TAG for the app, use that instead.
final TimingLogger timingLogger = new TimingLogger("AXE", "REACT_NATIVE_STARTUP");
timingLogger.reset();
ReactMarker.addListener(new ReactMarker.MarkerListener() {
@Override
@axemclion
axemclion / showpassword.user.js
Created Jan 6, 2018
Greasemonkey script to show password on doubleclick
View showpassword.user.js
// ==UserScript==
// @name Show Password
// @version 1
// @grant none
// ==/UserScript==
function handleDblClick(e){
var pwd = e.target;
var type = pwd.getAttribute('type');
pwd.setAttribute('type', type === 'password' ? 'text': 'password');
@axemclion
axemclion / feedly.user.js
Last active May 9, 2019
Feedly Open in New Background Tab
View feedly.user.js
// ==UserScript==
// @name Feedly - Open entry in background (Modified)
// @description Adds 'h' as a hotkey to open selected entry in background tab
// @namespace gist.github.com/axemclion/11b6968d2418caad7528e1e629af3886/edit
// @author axemclion
// @include http://feedly.com/*
// @include https://feedly.com/*
// @include http://*.feedly.com/*
// @include https://*.feedly.com/*
// @grant GM.openInTab
@axemclion
axemclion / app.jsx
Last active Jan 16, 2019
CodePush + Push Notifications for A/B Testing
View app.jsx
import Push from 'mobile-center-push';
import CodePush from 'react-native-code-push';
import { AppState } from 'react-native';
export default class MyApp extends Component {
// Component Logic ...
}
Push.setEventListener({
pushNotificationReceived: function (pushNotification) {
You can’t perform that action at this time.