Skip to content

Instantly share code, notes, and snippets.

View enestatli's full-sized avatar
💭
I may be slow to respond.

enestatli

💭
I may be slow to respond.
View GitHub Profile
@Mohamed3on
Mohamed3on / batchPrettier.md
Last active January 7, 2025 03:23
Run prettier on all JS files in a directory
  1. Install prettier
  2. Make a .prettierignore file, and add directories you'd like prettier to not format, for example: **/node_modules
  3. Run prettier --write "**/*.js" *Don't forget the quotes.
  4. Optional: if you want to format JSON/SCSS files too, replace js with json/scss.
@IgorMing
IgorMing / barcodescanner.js
Last active October 19, 2024 20:55
Barcode Scanner on React Native (with expo), stylized with opaque edges
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { BarCodeScanner } from 'expo';
export default class App extends React.Component {
render() {
return (
<BarCodeScanner
onBarCodeRead={(scan) => alert(scan.data)}
style={[StyleSheet.absoluteFill, styles.container]}
@duncanmcdougall
duncanmcdougall / ClearItAllBookmarklet.js
Created July 27, 2017 08:43
Bookmarklet to Clear Cookies, LocalStorage and Session Storage
javascript:(function(){ localStorage.clear(); sessionStorage.clear(); var c = document.cookie.split("; "); for (i in c) { document.cookie =/^[^=]+/.exec(c[i])[0]+"=;expires=Thu, 01 Jan 1970 00:00:00 GMT"; }; })();
@levynir
levynir / RotatingView.js
Last active January 19, 2021 09:52
React Native Rotating Component
/**
* Created by nirlevy on 02/07/2017.
* MIT Licence
*/
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Animated, Easing } from 'react-native';
export class RotatingView extends Component {
state = {
@fokusferit
fokusferit / enzyme_render_diffs.md
Last active April 23, 2025 17:13
Difference between Shallow, Mount and render of Enzyme

Shallow

Real unit test (isolation, no children render)

Simple shallow

Calls:

  • constructor
  • render
@itinance
itinance / package.json
Last active July 13, 2024 21:08
React Native: package.json: usefully tools for React Native that can be used with "npm run $name"
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start --reset-cache",
"reset": "rm -rf node_modules/ && npm cache clear && watchman watch-del-all && npm i",
"testflight": "fastlane beta",
"android-device": "adb reverse tcp:8081 tcp:8081 && react-native run-android",
"lint": "jslint **.js",
"test": "jest",
"generate-apk": "cd android && ./gradlew assembleRelease && open ./app/build/outputs/apk/",
"install-apk": "cd android && ./gradlew installRelease"
},
@DomiR
DomiR / react-native-module-extension.md
Last active March 26, 2022 09:27
Extend objective c react-native module

facebook/react-native#1908 (comment) @alinz, @brentvatne & @jaygarcia

So lets say you want to add eval method to WebView component. What you have to do is: use category feature in objective-c.

// RCTWebView+WebViewExBridge.h

#import "RCTWebView.h"

@interface RCTWebView (WebViewExBridge)
@kevinold
kevinold / react-native-parse-xml-example.js
Created October 25, 2016 13:14 — forked from benvium/react-native-parse-xml-example.js
Parse XML Example using React Native.xmldom is a pure JavaScript implementation of an XML Parser. I've added it to window so that browser modules that require it will work. Tested on iOS and Android.
/**
*
* Before use, type:
* ```
* npm install xmldom --save
* ```
*/
window.DOMParser = require('xmldom').DOMParser;
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"rc-start": "npm start -- --reset-cache",
"clean": "rm -rf $TMPDIR/react-* && watchman watch-del-all && npm cache clean",
"clean-start": "npm run clean && npm run rc-start",
"fresh-install": "rm -rf $TMPDIR/react-* && watchman watch-del-all && rm -rf ios/build/ModuleCache/* && rm -rf node_modules/ && npm cache clean && npm install",
"fresh-start" : "npm run fresh-install && npm run rc-start",
"tron": "node_modules/.bin/reactotron"
}
@powerc9000
powerc9000 / creating_ios_archives.md
Created July 19, 2016 06:10
Creating and uploading iOS archives from the command line.

I don't like IDEs. I want to code in my editor and use the command line for everything else. I like the flow better and it feels faster to me.

I also like to have one command to do several things I want to do.

I don't want to open Xcode to create an archive, then open the archive window, then upload the archive to iTunes. It's slow and breaks my flow.

Also, in react native, it's trivial to build Android releases on the command line. I want to create and upload both iOS and android from the command line.

So after hours of searching the internet I found a flow I like for creating and uploading archives for iOS all from the command line