Skip to content

Instantly share code, notes, and snippets.

@mjunaidi
mjunaidi / rssFeed.js
Created December 23, 2018 13:15 — forked from PhilipFlyvholm/rssFeed.js
Example of RSS feed as JSON in React Native
import React from 'react';
import {StyleSheet, View, Text} from 'react-native';
export class RSSFeed extends React.Component{
constructor(props) {
super(props);
this.state = {
rss: []
};
@mjunaidi
mjunaidi / extract_rtf.py
Created March 30, 2019 04:34
Function to extract text in RTF files.
# -*- coding: utf-8 -*-
"""
Extract text in RTF Files. Refactored to use with Python 3.x
Source:
http://stackoverflow.com/a/188877
Code created by Markus Jarderot: http://mizardx.blogspot.com
"""
@mjunaidi
mjunaidi / WebViewBridge.js
Created September 19, 2019 07:57 — forked from blankg/WebViewBridge.js
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.
@mjunaidi
mjunaidi / gist:f6615cec7f6d006642aa7ee6cb9b89a0
Created December 7, 2020 12:53 — forked from nazoking/gist:2822127
get image mime type from base64
function guessImageMime(data){
if(data.charAt(0)=='/'){
return "image/jpeg";
}else if(data.charAt(0)=='R'){
return "image/gif";
}else if(data.charAt(0)=='i'){
return "image/png";
}
}