Skip to content

Instantly share code, notes, and snippets.

View Mnunez903's full-sized avatar
👨‍💻
Your friendly neighborhood Bx-Guy

Michael Julio Nuñez Mnunez903

👨‍💻
Your friendly neighborhood Bx-Guy
View GitHub Profile

Keybase proof

I hereby claim:

  • I am mnunez903 on github.
  • I am michael_nunez (https://keybase.io/michael_nunez) on keybase.
  • I have a public key ASCl3qbgwieL1ScyGWhi3TR0_s-MoXqCOaslovEEylOU1go

To claim this, I am signing this object:

@Mnunez903
Mnunez903 / Refactoringquestion.js
Last active January 29, 2018 23:53
Javascript refactoring question. Which is better?
_isStarFilledIn(starNumber: number): boolean {
// A
if (this.state.hoverRating) {
return starNumber <= this.state.hoverRating;
} else if (this.state.rating) {
return starNumber <= this.state.rating;
} else {
return false;
}
// B
@Mnunez903
Mnunez903 / AorB.js
Last active December 27, 2017 17:20
AorB way of writing this script.
// A
function isValid(keyword) {
// .. does stuff and thangs
}
const partition = require('lodash/partition');
const isEmpty = require('lodash/isEmpty');
function validateCharacters(keywordsObject) {
const [approved, rejected] = partition(keywordsObject.approved, isValid)
@Mnunez903
Mnunez903 / cloudSettings
Last active July 18, 2018 01:03
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-07-18T01:03:08.483Z","extensionVersion":"v3.0.0"}
defmodule MyList do
def choose(a, _, true), do: a
def choose(_, b, false), do: b
def maximus([], value), do: value
def maximus([head|tail]), do: maximus([head|tail], 0)
def maximus([head|tail], value ) do
maximus(tail, choose(head, value, head>value))
end
end
@Mnunez903
Mnunez903 / GuessThatNumber.ex
Created August 26, 2016 23:14
Guesses a number between 1 and 1000. You can also give it your own range.
defmodule Chop do
def guess(x, y \\ 1..1000) do
first..last = y
halfOfRange = div(first+last,2)
IO.puts "is it #{halfOfRange}?"
decide(x, y, x > halfOfRange, x == halfOfRange)
end
def decide(x, y, false, false) do
guess(x, y.first..div(y.first+y.last,2))
@Mnunez903
Mnunez903 / fibonacci.ex
Created August 19, 2016 21:27
Fibonacci in Ruby and Elixir with a timer display in seconds
defmodule Fibonacci do
def start(n) do
start = :os.system_time(:seconds)
fibonacciNumber = go(n)
finish = :os.system_time(:seconds)
totalTime = finish - start
IO.puts "The fibonacciNumber was #{fibonacciNumber}."
IO.puts "Fibonacci for number placed #{n} finished in #{totalTime} seconds!"
end
fizzbuzz = fn
(0, 0, _) -> "FizzBuzz"
(0, _, _) -> "Fizz"
(_, 0, _) -> "Buzz"
(_, _, c) -> c
end
app = fn (n) ->
fizzbuzz.(rem(n, 3), rem(n, 5), n)
end
We couldn’t find that file to show.
@Mnunez903
Mnunez903 / QuoteApp_.idea_.name
Created February 28, 2013 17:01
QuoteApp. moved to a better file name
QuoteApp