Skip to content

Instantly share code, notes, and snippets.

View rodocite's full-sized avatar
🎯
Focusing

Rodolfo Yabut rodocite

🎯
Focusing
  • San Francisco
View GitHub Profile
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
klass = if Designer.where(email: resource_params[:email]).exists?
Designer
else
User
end
@rodocite
rodocite / gist:99d470890658a1b1253830204afd0223
Last active June 16, 2017 19:26
This is why we need the pipe operator in every language.
list = [1, [[2], 3]]
list
|> List.flatten
|> Enum.reverse
|> Enum.map(fn(n) -> n * n end)
|> IO.inspect
IO.inspect(Enum.map(Enum.reverse(List.flatten(list)), fn(n) -> n * n end))
@rodocite
rodocite / ets.ex
Last active June 17, 2017 11:39
ETS
defmodule Users do
@users_json "./lib/ets.json"
def hydrate_ets do
@users_json
|> File.read
|> case do
{:ok, file} ->
file
@rodocite
rodocite / .cs
Created February 11, 2020 02:17
Delete all occurrences of a given key in a linked list
public class Solution {
public ListNode RemoveElements(ListNode h, int v) {
if (h == null) return null;
h.next = RemoveElements(h.next, v);
return h.val == v ? h.next : h;
}
}