Skip to content

Instantly share code, notes, and snippets.

func (p *Project) insertSshkey() {
homeDir := fileUtil.FindUserHomeDir()
cmd := exec.Command("cat", homeDir+"/.ssh/"+p.sshkey.name+".pub", "|", "ssh", p.projectname.name+"@"+p.host.name, "'cat", ">>", "~/.ssh/authorized_keys'")
err := cmd.Run()
if err != nil {
...
}
@lucasrenan
lucasrenan / media_magick_sortable.js
Created October 22, 2012 22:48
media magick - sortable js
function initUploader(relation){
$(".attachmentUploader" + "." + relation).pluploadIt();
$("a." + relation + "ToggleSortable").bind('click', function () {
mediaMagick.toggleSortable($("div.attachmentUploader." + relation + " .loadedAttachments"), '/update_priority', {
linkSelector: 'a.' + relation + 'ToggleSortable',
loadData: function () {
return {
elements: function () {
return $("div.attachmentUploader." + relation + " .loadedAttachments").sortable('toArray');
@wbotelhos
wbotelhos / gist:1901194
Created February 24, 2012 14:16
jQuery show and hide methods
if (boo) {
$(elem).show();
} else {
$(elem).hide();
}
$(elem)[boo ? 'show' : 'hide']();
$(elem).toggle(boo);
@wbotelhos
wbotelhos / gist:1171694
Created August 25, 2011 19:59
JSON formatado no console
// Exibindo o JSON no console
curl "http://api.twitter.com/1/trends.json" | python -mjson.tool
// Salvando em algum arquivo
curl "http://api.twitter.com/1/trends.json" | python -mjson.tool > response.json