Skip to content

Instantly share code, notes, and snippets.

Avatar

Dineshkumar Raman radik909

View GitHub Profile
@radik909
radik909 / contributing.md
Last active Dec 22, 2017
React Js - Contribution
View contributing.md

Tools 💪

  • Prefer latest node version(>=8.0)
  • Use yarn over npm

Code formatting

  • Use Prettier for formatting your code.
  • Integrate Prettier with your editor.
View react-native.md

React Native - initialization

Node

Make sure you have Node version > 6

CRNA

I recommend using CRNA to build ReactNative apps.

@radik909
radik909 / fibonacci.exs
Last active Nov 13, 2017
Find first n fibonacci numbers (using Stream in Elixir)
View fibonacci.exs
defmodule Fibonacci do
def run(num) when num > 0 do
Stream.unfold({1, 1}, fn {a, b} ->
{a, {b, a + b}}
end)
|> Enum.take(num)
end
end
IO.gets("Enter the limit: ")
@radik909
radik909 / factorial.exs
Last active Sep 7, 2016
Elixir - Factorial for a given non-negative number
View factorial.exs
defmodule Factorial do
@moduledoc """
Factorial for a given non-negative number
"""
def run(0), do: 1
def run(num) when num > 0 do
Enum.reduce 1..num, 1, &(&1 * &2)
end
def run(_), do: nil
end
@radik909
radik909 / prime.exs
Last active Jul 7, 2016
Elixir - Problems Solving - Prime number
View prime.exs
defmodule Prime do
@moduledoc """
A number 'n' is prime only when it is not divisible by any number between 2 and √n
"""
def run(2), do: true
def run(num) when num > 2 and rem(num, 2) != 0 do
is_prime(3, num, round(:math.sqrt(num) + 1))
end
def run(_), do: false
You can’t perform that action at this time.