Skip to content

Instantly share code, notes, and snippets.

View blackode's full-sized avatar
:octocat:
Pushed code so fast, even my coffee is still loading. ☕💻 #CodingFuel

Ankanna blackode

:octocat:
Pushed code so fast, even my coffee is still loading. ☕💻 #CodingFuel
View GitHub Profile
@blackode
blackode / sublime_text_2_useful_shortcuts.md
Created June 20, 2016 17:44 — forked from nuxlli/sublime_text_2_useful_shortcuts.md
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 - Useful Shortcuts

Tested in Mac OS X: super == command

Open/Goto


  • super+t: go to file
  • super+ctrl+p: go to project
  • super+r: go to methods
@blackode
blackode / tmux-cheatsheet.markdown
Created July 28, 2016 10:24 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@blackode
blackode / elixir_pocket_syntax.md
Last active December 23, 2021 21:35
Elixir in Pocket

Elixir Pocket Syntax

Uncommon Logical stuff of Elixir modules,definitions and some coding snippets that makes our life easy and fast. We go with very basic to the different approach.

1. Creating Private Functions

Code

@blackode
blackode / execution_time.ex
Created February 11, 2017 18:38
Execution Time for function in elixir
defmodule ExecutionTime do
def time_of(function, args) do
{time, result} = :timer.tc(function, args)
IO.puts "Time: #{time}ms"
IO.puts "Result: #{result}"
end
end
@blackode
blackode / terminal_width_height.ex
Last active May 6, 2019 12:04
Terminal height and width ... elixir
defmodule TerminalWidthHeight do
def term_dimensionns do
{:ok,width} = :io.columns
{:ok,height} = :io.rows
IO.inspect {width,height}
end
end
@blackode
blackode / password_lock.ex
Created February 14, 2017 10:07
GenServer Example
defmodule PasswordLock do
use GenServer
# -------------#
# Client - API #
# -------------#
@moduledoc """
Documentation for PasswordLock.
locks the password
@blackode
blackode / password_logger.ex
Created February 14, 2017 10:18
GenServer for simple logging mechanism
defmodule PasswordLogger do
use GenServer
# -------------#
# Client - API #
# -------------#
@moduledoc """
Documentation for Password_logger.
loggs the password
defmodule PasswordLockTest do
use ExUnit.Case
doctest PasswordLock
setup do
{:ok,server_pid} = PasswordLock.start_link("foo")
{:ok,server: server_pid}
end
test "unlock success test", %{server: pid} do
@blackode
blackode / start_link.exs
Created February 14, 2017 10:33
GenServer start_link definition
@blackode
blackode / unlock_reset.exs
Created February 14, 2017 10:34
unlock and reset definition
@doc """
Unlocks the given password
"""
def unlock(server_pid, password) do
GenServer.call(server_pid, {:unlock, password})
end
@doc """
resets the given password
"""