Skip to content

Instantly share code, notes, and snippets.

Avatar

Domingo Aguilera batok

View GitHub Profile
@batok
batok / color.ex
Created Jul 12, 2016
Colorear consola
View color.ex
defmodule Color do
@moduledoc false
def color_reset , do: "\x1b[0m"
def color_red, do: "\x1b[31m"
def color_green, do: "\x1b[32m"
def color_yellow, do: "\x1b[33m"
@doc """
function to add color to string to be used in console apps.
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
View controllers.application.js
import Ember from 'ember';
let { computed, get, set } = Ember;
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
value: '945',
style: 'color: black',
valor: computed('value', {
get(){
let valor = `&#${get(this,'value')}` ;
return valor.htmlSafe();}
@batok
batok / components.one-routable.js
Created Apr 13, 2016
Otra sobre routable components
View components.one-routable.js
import Ember from 'ember';
export default Ember.Component.extend({
isGlimmerComponent: true
});
@batok
batok / components.main-panel.js
Created Apr 12, 2016
Routable Component Demo
View components.main-panel.js
import Ember from 'ember';
export default Ember.Component.extend({
isGlimmerComponent: true
});
View components.my-routable-component.js
import Ember from 'ember';
export default Ember.Component.extend({
isGlimmerComponent: true
});
@batok
batok / app.js
Created Feb 10, 2014
Using sweet.js to write less code in ember.js
View app.js
macro to_string {
case { _ $tok } => { return [makeValue(unwrapSyntax(#{ $tok }), #{ $tok })]; }
}
macro <. {
case { _ $vari} => {
return #{
this.get( to_string $vari )
}
}
}
@batok
batok / paramiko_example.py
Created Apr 10, 2012
Paramiko example using private key
View paramiko_example.py
import paramiko
k = paramiko.RSAKey.from_private_key_file("/Users/whatever/Downloads/mykey.pem")
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
print "connecting"
c.connect( hostname = "www.acme.com", username = "ubuntu", pkey = k )
print "connected"
commands = [ "/home/ubuntu/firstscript.sh", "/home/ubuntu/secondscript.sh" ]
for command in commands:
print "Executing {}".format( command )
View gist:1677103
<script type="text/coffeescript">
$ ->
$("#cambiarinvitado").toggle()
$("#link_cambiar_invitado1").click (event) ->
event.preventDefault()
alert "foo1"
$("#cambiarinvitado").toggle()
$("#link_cambiar_invitado2").click (event) ->
event.preventDefault()
alert "foo2"