09. April 2016

My Second Take on React Native

I learned a lot by doing just this two pages react native project. It’s a battle when studying a new language, framework or library. You have to understand how the things connect, work and behave. It’s also different when you’re just watching a tutorial or reading a book/blog than doing it actually.

Dive Right In

Sometimes it’s a good idea to dive into the sea of React Native and start swimming, but if you have more time, I would study React first, then when you have a better understanding of what’s going with the framework, go and jump into React Native.

Getting MAIN.JS Get Going First

By default, when you create a new project in React Native, you get IOS and Android in a separate file. This really good if you want a different look and feel on each platform, but if your planning to use one design for both platforms, it’s better to create one file and calling them in each platform.

MAIN.JS
'use strict';
import React, {
  Component,
  StyleSheet,
  Navigator,
  View,
  Text
} from 'react-native';

module.exports = class StaticPizza extends Component   {
    //CODE GOES HERE
}
INDEX.IOS.JS and INDEX.ANDROID.JS
'use strict';
import React, {
  AppRegistry,
  Component
} from 'react-native';

import Main from './src/main';

AppRegistry.registerComponent('StaticPizza', () => Main);

I like this module, exactly what I was looking. This is really great if you’re leaning towards ios development. It’s easy to use and flexible.

GITHUB Link: https://github.com/react-native-fellowship/react-native-navbar

Styling and Flexbox

At first, Flexbox can be tricky, challenging and frustrating sometimes, but once you get to know it, its really cool. I like that REACT is limited when it comes to styling, just what you need to make a really good looking APP. They say “but out of limitations comes creativity” which is true.

I will try to explore more on React Native and build some small project on it. Hopefully, publish one or two this year if time permits.

02. March 2016

Open Multiple URL in Chrome from Terminal

Working on a CMS can be tedious, especially if most of the configuration is done in the admin panel. Going to a page by page is time-consuming. In my case I have to update a bunch of sites, to cut down the time of updating them. I create a small script the open all the tabs for me.

Open your bash_profile.

subl ~/.bash_profile

or you can do

sudo vim ~/.bash_profile

Create an alias/shortcut to open your google chrome

alias chrome="/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"

Now create function with one argument(url/webpage)

function openTab(){
    chrome "$1"
}

Close your .bash_profile, open your terminal and source the file

source ~/.bash_profile

Execute the bash function

openTab http://www.google.com

Opening multiple URLs and specifying their succeeding path.

function openTab(){
    chrome "$1/user" \
    "$1/mail" \
    "$1/calendar" \
    "$1/maps" \
    "$1/drive"
}

Then I call the function, specifying the domain name as an argument.

openTab http://www.google.com

I’m sorry for using google as our domain sample. Our argument can take any domain/URLs you put in as many as you can. My function is a bit crazy but useful.

function openTab(){
    chrome "$1/user" \
    "$1/admin/config/workflow/workflow/manage/node/fields" \
    "$1/admin/structure/types/manage/e-resource/fields" \
    "$1/admin/structure/types/manage/directory-listing/fields" \
    "$1/admin/structure/types/manage/event/fields" \
    "$1/admin/structure/types/manage/library-branch/fields" \
    "$1/admin/structure/types/manage/news/fields" \
    "$1/admin/structure/types/manage/guide/fields" \
    "$1/node/add/e-resource" \
    "$1/node/add/directory-listing" \
    "$1/node/add/event" \
    "$1/node/add/library-branch" \
    "$1/node/add/news" \
    "$1/node/add/guide"
}

I hope this small scripts can you some day. Chow!!!

22. February 2016

Git Assume Unchanged File

Let’s say you need to setup a new Drupal DEV Site. After pulling all the files you need to configure your settings.php to connect to your database. Now git knows you have changed something.

Git knows Everything

You don’t want to push your credential into git, you always keep it private. So we need tell git not to detect changes in our settings.php.

git update-index --no-assume-unchanged <file>

In our case we need to specify settings.php path

git update-index --no-assume-unchanged sites/default/settings.php

That will tell git to ignore anything we change or update into settings.php.

Another way can do (not related to detecting files) is to prevent any push from the server to our git repo. To do that we need to tell git to disable pushing to origin.

git remote set-url --push origin no_push

This two lines of code helped today. I hope this will help you too. Chow~!!!~

source:git assume unchange source:git disable push