Skip to content

Instantly share code, notes, and snippets.

View carlogilmar's full-sized avatar
🎨
Creator of Visual Partner-Ship

Carlo Gilmar carlogilmar

🎨
Creator of Visual Partner-Ship
View GitHub Profile
vertx.eventBus().consumer( "com.makingdevs.my.first.verticle" ){ message ->
String deploymentId = vertx.getOrCreateContext().deploymentID
println "This consumer has this deployment ID ${deploymentId})"
println "The message received by this verticle is ${message.body}"
}
vertx.eventBus().consumer("com.makingdevs.ping"){ message ->
println "Message Received: ${message.body()}" // Pong!
message.reply("ping")
}
vertx.eventBus().send("com.makingdevs.ping", "pong"){ reply ->
if(reply.suceeded()){
println "Reply Received: ${reply.result().body()}" // Ping!
}
}
for i in 1...50 {
if i%5==0 && i%3==0 {
print("Fizzbuzz 🍻 ")
}
else if i%5 == 0{
print("Buzz")
}
else if i%3==0{
print("Fizz")
}
func sendSlackMessage(message:String, emoji:String){
let slackUrl = "http://your-slack-channel-url.com"
Alamofire.request(slackUrl,
method: .post,
parameters:
["channel": "#general",
"username": "Home Office Bot",
"text":message, "icon_emoji":emoji],
encoding: JSONEncoding.default)
.responseString{ response in
@carlogilmar
carlogilmar / fibonacci.swift
Created November 29, 2017 05:13
Fibonacci First Solution
func fib1(n: UInt) -> UInt {
if(n<2){
return n
}
return fib1(n: n-2) + fib1(n: n-1)
}
fib1(n: 20)
@carlogilmar
carlogilmar / fibonnaci_2.swift
Created November 29, 2017 05:16
Second Fibonacci Solution
/*Segunda Versión*/
var fibMemo: [UInt:UInt] = [0: 0, 1: 1]
func fib2(n:UInt)-> UInt{
if let result = fibMemo[n] {
return result
} else {
fibMemo[n] = fib2(n: n-1) + fib2(n: n-2)
}
return fibMemo[n]!
@carlogilmar
carlogilmar / fibonnaci_3.swift
Created November 29, 2017 05:17
Third Fibonacci Solution
/* Tercera Versión */
func fib3(n:UInt) -> UInt{
if (n==0){
return n
}
var last: UInt = 0
var next: UInt = 1
for _ in 1..<n{
(last, next) = (next, last+next)
set -g prefix C-a
unbind C-b
set -sg escape-time 1
set -g base-index 1
setw -g pane-base-index 1
bind r source-file ~/.tmux.conf \; display "Configuración recargada"
bind C-a send-prefix
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
set -g prefix C-a
unbind C-b
set -sg escape-time 1
set -g base-index 1
setw -g pane-base-index 1
bind r source-file ~/.tmux.conf \; display "Configuración recargada"
bind C-a send-prefix
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
@carlogilmar
carlogilmar / norm.zsh-theme
Last active May 5, 2018 19:51
Prompt for oh my zsh norm theme
PROMPT='%{$fg[yellow]%}𝝺 %{$fg[green]%}%c 🍷 $(git_prompt_info)%{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%} %{$reset_color%}"
ZSH_THEME_GIT_PROMPT_SUFFIX=" %{$fg[red]%}❯%{$fg[yellow]%}❯%{$fg[green]%}❯ "