Skip to content

Instantly share code, notes, and snippets.

View tolotrasmile's full-sized avatar
🏆
Positive mindset

Tolotra Raharison tolotrasmile

🏆
Positive mindset
View GitHub Profile
public class Trello
{
public String Letters { get; set; }
public Int64 InitialHash { get; set; }
public Int64 Hash { get; set; }
public Int64 HashDepth { get; set; }
public Trello(String letters, Int64 initialHash, Int64 hashDepth)
{
@tolotrasmile
tolotrasmile / app_.gitignore
Created August 17, 2016 14:48
Android training 1.0
/build
@tolotrasmile
tolotrasmile / MongoDB_macOS_Sierra.md
Created June 7, 2018 13:00 — forked from nrollr/MongoDB_macOS_Sierra.md
Install MongoDB on Sierra using Homebrew

Install MongoDB on macOS Sierra

This procedure explains how to install MongoDB using Homebrew on macOS Sierra 10.12.
Official MongoDB install documentation: here

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
@tolotrasmile
tolotrasmile / .zshrc
Created June 7, 2018 13:14
My ZSH profile
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=/Users/admin/.oh-my-zsh
export PATH=`pwd`/flutter/bin:$PATH
export ANDROID_HOME=/android-sdks
source /usr/local/opt/chruby/share/chruby/auto.sh
@tolotrasmile
tolotrasmile / download_egghead_videos.sh
Created July 27, 2018 13:57 — forked from mnsami/download_egghead_videos.sh
this script is to download egghead videos using youtube-dl
#!/bin/bash
usage() { echo "usage: --coursename [--coursename \"build-a-react-app-with-redux\"] --type [--type \"courses|lessons\"]" 1>&2; exit 1; }
OPTS=$(getopt -o c:t: --long coursename:,type: -n 'download_egghead_videos.sh' -- "$@")
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
eval set -- "$OPTS"
let UserContext = React.createContext();
class App extends React.Component {
state = {
user: null,
setUser: user => {
this.setState({ user });
}
};
const array = [
{ id: 1, category: 'Apple' },
{ id: 1, category: 'Orange' },
{ id: 3, category: 'Orange' },
{ id: 4, category: 'Grape' },
{ id: 5, category: 'Grape' },
]
function groupBy(array, key) {
const keys = (array, key) => array.reduce((acc, item) => acc.add(item[key]), new Set());
// hooks.js
import { useCallback, useEffect, useReducer, useRef } from "react";
export function useRefMounted() {
// To prevent state update when component is unmounted
const isMounted = useRef(true);
useEffect(() => {
return () => {
// called when the component is going to unmount
const {
map,
prop,
compose,
pluck,
sort,
ascend,
multiply,
cond,
T,
function memoize(fn) {
let cache = {}
return function (...args) {
if (cache[args]) {
return cache[args]
}
const res = fn.apply(this, args)
cache[args] = res
return res
}