Skip to content

Instantly share code, notes, and snippets.

@blankg
blankg / WebViewBridge.js
Last active July 12, 2022 06:53
For RN >= 0.57 please look at https://github.com/blankg/rn-webview-bridge-sample-new/blob/master/resources/index.html. Provides a sample implementation for sending and receiving messages to and from the React-Native WebView (using postMessage/onMessage WebView API).
/**
* Created by Guy Blank on 3/9/17.
*
* This is a sample provides an API to send & receive messages to and from the React-Native WebView (using postMessage/onMessage WebView API).
* A sample project that uses the bridge is available here https://github.com/blankg/rn-webview-bridge-sample
*
* webViewBridge.send('functionToInvoke', {mydata: 'test'}, function(){console.log('success')},function(){console.log('error')});
*
* The API is designed to be similar to the Cordova exec API so migration to it should be almost seamless.
* The API also provides solution to a React-Native WebView bug in iOS which causes sending consecutive postMessage calls to override each other.
@megahertz
megahertz / MobxRnnProvider.js
Last active January 11, 2020 09:56
This is a provider which allows to use mobx-react Provider with wix/react-native-navigation.
import { Provider } from 'mobx-react/native';
const SPECIAL_REACT_KEYS = { children: true, key: true, ref: true };
export default class MobxRnnProvider extends Provider {
props: {
store: Object
};
context: {
@githubutilities
githubutilities / Apple-real-device-debugging.md
Last active November 18, 2023 12:41
install ipa using command line

Apple Real Devices Debugging

What you need

  • certificate--which tells your devices that Apple trust you
  • a app id
  • a test device
  • a provisioning profile
@jquense
jquense / 0. intro.md
Last active September 24, 2022 05:10
Alternative ways to define react Components

The 0.13.0 improvements to React Components are often framed as "es6 classes" but being able to use the new class syntax isn't really the big change. The main thing of note in 0.13 is that React Components are no longer special objects that need to be created using a specific method (createClass()). One of the benefits of this change is that you can use the es6 class syntax, but also tons of other patterns work as well!

Below are a few examples creating React components that all work as expected using a bunch of JS object creation patterns (https://github.com/getify/You-Dont-Know-JS/blob/master/this%20&%20object%20prototypes/ch4.md#mixins). All of the examples are of stateful components, and so need to delegate to React.Component for setState(), but if you have stateless components each patterns tends to get even simpler. The one major caveat with react components is that you need to assign props and context to the component instance otherwise the component will be static. The reason is

@phynet
phynet / Generate and Install IPA's file in device through Command Line.md
Last active December 22, 2022 16:15
Generate and Install IPA's file in device through Command Line

##Generate and Install IPA's file in device through Command Line

###Thanks to Mattt and phonegap's scripts

Take a note: all this steps can be automatized in a single script, if you know how to write it. (Bash or Ruby will be fine)

1.- Install your Provisioning Profile and Developer Certificate

2.- Install Shenzhen and ios-deploy: the firstone will generate the IPA file and the secondone will install it onto your device

@mathisonian
mathisonian / index.md
Last active March 22, 2023 05:31
requiring npm modules in the browser console

demo gif

The final result: require() any module on npm in your browser console with browserify

This article is written to explain how the above gif works in the chrome (and other) browser consoles. A quick disclaimer: this whole thing is a huge hack, it shouldn't be used for anything seriously, and there are probably much better ways of accomplishing the same.

Update: There are much better ways of accomplishing the same, and the script has been updated to use a much simpler method pulling directly from browserify-cdn. See this thread for details: mathisonian/requirify#5

inspiration

@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active February 12, 2024 17:18
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

OBSOLETE

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

@kevin-smets
kevin-smets / iterm2-solarized.md
Last active May 5, 2024 18:31
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@markhuge
markhuge / gist:4724990
Last active February 14, 2019 07:11
Using regex capture groups in Sublime Text 2 search and replace

I copied my .csshrc to a new machine, and needed to add a domain suffix to the hostnames of 20+ VMs in my cluster config. All of my hostnames end in at least 2 digits (foo-bar-baz-01), so I:

  1. Search for instances of 2 digits followed by whitespace.
  2. Preserve the digits in a capture group.
  3. Append the suffix to the capture group (\1)

Append domain suffix where none exists:

Search: ([0-9]{2})\s Replace: \1.my.domain.suffix

@manpages
manpages / the-case-for-gist-blogging.org
Created April 28, 2012 06:16
Why do I love to use gist as a blog engine?

The case for Gist blogging

Why to bother?

The posts people write in blogs can be classified in two groups:

  • those that are going to be (or should be) maintained, expressing the real time information (like books one reads or read, todo lists, lecture notes, etc),
  • those that express the momentary thoughts of a writer on an event or activity.

Maintaining the post

While first ones can be managed using standart blog engines (livejournal, blogger, etc) via «Edit post» option, that’s hardly