Skip to content

Instantly share code, notes, and snippets.

View ameernormie's full-sized avatar
💭
A question opens the mind. A statement closes it

Ameer Hamza ameernormie

💭
A question opens the mind. A statement closes it
View GitHub Profile
### Install
brew install rbenv
### Installing Ruby versions
# list all available versions:
$ rbenv install -l
# install a Ruby version:
$ rbenv install 2.0.0-p247
Postgresql
### Install
brew install postgresql
postgres --version
brew services start postgresql
### Upgrade
brew upgrade postgresql
@ameernormie
ameernormie / rust_slices
Created March 13, 2020 18:40
How to use slices in rust
fn main(){
let s = String::from("hello world");
let x = first_word(&s);
println!("first word is {}", x);
}
fn main() {
let s1 = gives_ownership(); // gives_ownership moves its return
// value into s1
let s2 = String::from("hello"); // s2 comes into scope
let s3 = takes_and_gives_back(s2); // s2 is moved into
// takes_and_gives_back, which also
// moves its return value into s3
} // Here, s3 goes out of scope and is dropped. s2 goes out of scope but was
fn main() {
let s = String::from("hello"); // s comes into scope
takes_ownership(s); // s's value moves into the function...
// ... and so is no longer valid here
let x = 5; // x comes into scope
makes_copy(x); // x would move into the function,
// but i32 is Copy, so it’s okay to still
@ameernormie
ameernormie / react-navigation-tree.jsx
Created December 31, 2019 19:19 — forked from slorber/react-navigation-tree.jsx
react-navigation-tree.jsx
const App = createAppContainer(
createStack({
LoggedSwitch: createSwitch({
// When user is authenticated
LoggedIn: createStack({
// The logged in root is generally a tab or drawer navigator
LoggedInRoot: createTabsOrDrawer({
/**
* This service will be used if we don't have access to navigation
* prop in the component. Usually the components that are outside the
* heirarchy of the nav screens don't have access to the navigation params.
*/
import { NavigationActions } from 'react-navigation';
import { defaultTo } from 'ramda';
let _navigator: any;
function setTopLevelNavigator(navigatorRef: any) {
@ameernormie
ameernormie / My First Gist
Created February 28, 2019 12:13
My First Gist
this is my first gist ever.