Skip to content

Instantly share code, notes, and snippets.

View radik909's full-sized avatar

Dineshkumar Raman radik909

View GitHub Profile
@radik909
radik909 / contributing.md
Last active December 22, 2017 09:08
React Js - Contribution

Tools 💪

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

Code formatting

  • Use Prettier for formatting your code.
  • Integrate Prettier with your editor.

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 September 23, 2024 08:19
Find first n fibonacci numbers (using Stream in Elixir)
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 September 7, 2016 08:44
Elixir - Factorial for a given non-negative number
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 July 7, 2016 20:00
Elixir - Problems Solving - Prime number
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