Skip to content

Instantly share code, notes, and snippets.

View iZaL's full-sized avatar

Afzal Abbas iZaL

View GitHub Profile
@iZaL
iZaL / install_ffmpeg_ubuntu.sh
Created March 27, 2016 10:38 — forked from xdamman/install_ffmpeg_ubuntu.sh
Install latest ffmpeg on ubuntu 12.04 or 14.04
#!/bin/bash
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04
# Inspired from https://gist.github.com/faleev/3435377
# Remove any existing packages:
sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev
# Get the dependencies (Ubuntu Server or headless users):
sudo apt-get update
@iZaL
iZaL / 1-react-native-simulator-and-device.md
Created April 2, 2016 14:27 — forked from almost/1-react-native-simulator-and-device.md
Test React Native on the simulator and on a device without editing the code each time!

In the default React Native app scaffolding you have to edit AppDelegate.m to change where it loads the code if you want to test on your device. I use the following snippet to detect if it's being compiled for Debug or Production and for the Simulator or a device. For Production it uses a copy of the code included in the bundle, for Debug on the simualtor it loads from a server on localhost and for Debug on a device it loads from a server on a given IP address.

NOTE: You need to edit YOUR-IP-HERE and change it to the IP to load the code from when in Debug mode on a device. You could use a service like ngrok to make this work from anywhere.

  NSURL *jsCodeLocation;

  // Loading JavaScript code
  #if DEBUG
    // For Debug build load from development server. Start the server from the repository root:
@iZaL
iZaL / generate-iOS-app-icons.sh
Created May 9, 2016 02:54 — forked from marcuswestin/generate-iOS-app-icons.sh
Generate all xcode 5 app icon sizes from one original large icon
mkdir -p generated
sips -Z 29 --out generated/iPhoneSettings-29x29.png sourceIcon.png
sips -Z 58 --out generated/[email protected] sourceIcon.png
sips -Z 80 --out generated/[email protected] sourceIcon.png
sips -Z 120 --out generated/[email protected] sourceIcon.png
sips -Z 29 --out generated/iPadSettings-29x29.png sourceIcon.png
sips -Z 58 --out generated/[email protected] sourceIcon.png
sips -Z 40 --out generated/iPadSpotlight-40x40.png sourceIcon.png
public function addItem(Requests\Frontend\addProductToCart $request)
{
if ($this->cart->getItemsCount() > 1) {
$product = $this->productRepository->model->with('parent')->find($request->product_id);
$parentCategory = $product->parent->first();
$cartItemIds = $this->cart->getItems()->pluck('id')->toArray();
if ($parentCategory->limited) {
$cartProducts = $this->productRepository->model->with('parent')->whereIn('id', $cartItemIds)->get();
$parentCategories = $cartProducts->pluck('parent')->flatten();
import React,{ Component } from 'react';
import { View,Text,StyleSheet} from 'react-native';
export default class App extends Component {
constructor() {
super();
this.state = {
loanAmount:'50000',
interestRate:'5',
@iZaL
iZaL / ex-navigation.md
Created December 20, 2016 14:05 — forked from knowbody/ex-navigation.md
My exponent's ex-navigation docs/thoughts

Exponent - ex-navigation

This is for now, for my personal use only, things might not be correctly explained here. For the official docs please check: https://github.com/exponentjs/ex-navigation/blob/master/README.md

Navigation bar configuration

On every screen you can use the built-in navigation bar, you can add a title, left button, right button or change navigation bar’s style. All you need to do is pass appropriate params to navigationBar in the route configuration:

import React, { Component } from 'react';
const walk = require('babylon-walk');
const babylon = require('babylon');
const glob = require('glob');
const fs = require('fs');
const path = require('path');
const zip = (a, b, fn) => a.forEach((el, i) => fn(el, b[i], i));
const promisify = fn => new Promise((res, rej) => {
const done = (err, val) => (err ? rej(err) : res(val));
@iZaL
iZaL / index.html
Created July 9, 2017 15:18 — forked from deltaepsilon/index.html
Firebase 3.0 Authentication Demo
<!--
Install dependencies with Bower:
bower install PolymerElements/paper-elements#^1.0.7
-->
<html>
<head>
<title>Auth Example</title>
<link rel="shortcut icon" href="/favicon.png" type="image/x-icon">
cat ~/.ssh/id_rsa.pub | ssh <user>@<hostname> 'cat >> .ssh/authorized_keys && echo "Key copied"'
@iZaL
iZaL / FlowReactTutorial.js
Created November 27, 2017 08:05 — forked from busypeoples/FlowReactTutorial.js
Flow Fundamentals For ReactJS Developers
// @flow
// Flow Fundamentals For ReactJS Developers
/*
Tutorial for ReactJS Developers wanting to get started with FlowType.
We will go through the basic Flow features to gain a better understanding of how to use FlowType with React.
You can uncomment the features one by one and work through this tutorial.
If you want to learn the very FlowType basics, refer to "Flow Fundamentals for JavaScript Developers" (https://gist.github.com/busypeoples/61e83a1becc9ee9d498e0db324fc641b) first.