Skip to content

Instantly share code, notes, and snippets.

View samermurad's full-sized avatar

Samer Murad samermurad

View GitHub Profile
@samermurad
samermurad / MediaDisplayer.js
Created November 21, 2018 11:09
A react-native Media Display screen that can display videos, images, audio files and pdfs, it is taken from a project that I wrote, so obviously some items are project related.
import React, { Component } from 'react'
import { View, TouchableOpacity, StyleSheet,Image,Animated, Platform, BackHandler, Button } from 'react-native'
import { connect } from 'react-redux'
import {Actions} from 'react-native-router-flux'
import { colors,fonts,images, styles as appStyles } from '../assets'
import { Screen, NAVIGATION_BAR_HEIGHT, STATUS_BAR_HEIGHT } from '../consts'
import { mediaType } from '../enums'
import Interactable from 'react-native-interactable'
import { CachedImage } from 'react-native-cached-image'
import { Player as AudioPlayer } from 'react-native-audio-toolkit'
@samermurad
samermurad / gitHashExtractorIOS.sh
Last active October 16, 2018 10:31
Add Git Hash to iOS App plist: Put this code under a new "run script" in Project>Target>Run Phases> Create new run script
#!/bin/sh
gitHash=$(/usr/libexec/PlistBuddy -c "Print :GitHash" "${PROJECT_DIR}/${INFOPLIST_FILE}")
exitCode=$?
if [ $exitCode == 0 ]; then
gitHash=$(git rev-parse HEAD | cut -c1-10)
/usr/libexec/PlistBuddy -c "Set :GitHash $gitHash" "${PROJECT_DIR}/${INFOPLIST_FILE}"
else
gitHash=$(git rev-parse HEAD | cut -c1-10)
/usr/libexec/PlistBuddy -c "Add :GitHash string $gitHash" "${PROJECT_DIR}/${INFOPLIST_FILE}"
fi

Keybase proof

I hereby claim:

  • I am samermurad on github.
  • I am samermurad (https://keybase.io/samermurad) on keybase.
  • I have a public key ASBT9YNuSzPnwnxv1eLOT3iK1d5u1JHHtZSq_cpLn1eRYgo

To claim this, I am signing this object:

@samermurad
samermurad / RCTWebView.m
Last active January 21, 2018 17:04
REACT NATIVE 0.44.2!!!!!!!!!!!!!!!!!!! This gist fixes the error "Setting onMessage on a WebView overrides existing values of window.postMessage, but a previous value was defined" for iframes
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import "RCTWebView.h"
@samermurad
samermurad / iOSPrintAllFonts.m
Created June 26, 2017 07:50
iOS Print all fonts
for (NSString* famName in [UIFont familyNames]) {
NSLog(@"== %@",famName);
for (NSString* nameInFam in [UIFont fontNamesForFamilyName:famName]) {
NSLog(@"==== %@",nameInFam);
}
}