Skip to content

Instantly share code, notes, and snippets.

View webcracy's full-sized avatar

Alexandre Loureiro Solleiro webcracy

View GitHub Profile
@webcracy
webcracy / honeybadger_dokku_deploy_hook.md
Created March 11, 2021 11:43
How to add a Honeybadger deploy hook/ping to a Dokku deployment

Ping Honeybadger when you deploy a Rails app to Dokku

Define a postdeploy action in your app.json file to ping Honeybadger when you deploy your Rails app to a Dokku instance.

The Honeybadger CLI deploy command requires you set the --repository and --revision options.

You can use environment variables for this, or for example hardcode your repository URL (as in the example below).

Dokku provides a $GIT_REV environment variable by default, which is useful to set the --revision option.

@webcracy
webcracy / issues_to_csv.rb
Created October 12, 2014 20:24
Export GitHub issues to CSV
#! /usr/bin/env ruby
# coding: UTF-8
require 'rubygems'
require 'octokit'
## SETUP
# Generate a token in https://github.com/settings/tokens/new
# Only the `repo` scope is needed
GH_TOKEN = ENV["GH_TOKEN"] || "<your auth token>" # put your token in the file or use ENV var
GH_REPO = ARGV[0] || "account/repo" # setup a default repo and/or pass repo as argument
@webcracy
webcracy / manybots_js_demo.html
Created February 18, 2012 02:36
Demo Manybots Visualization
<html>
<head>
<title>Visualize your data</title>
<link rel="stylesheet" href="https://www.manybots.com/stylesheets/manybots.css" type="text/css" media="screen">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
<script src="https://www.manybots.com/javascripts/manybots.js" type="text/javascript"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/raphael/2.0.1/raphael-min.js" type="text/javascript">
</script>
<script type="text/javascript" src="http://g.raphaeljs.com/g.raphael.js">
@webcracy
webcracy / sopa_wired.html
Created January 18, 2012 16:55
SOPA on Wired.com
<!-- SOPA scripts From Wired.com homepage on Jan 18, 2012 -->
<style type="text/css">
#sopa-nav-button {
background: url('/images/home/sopa_nav_button.png?ver=001') no-repeat 0px -30px;
width: 150px;
height: 30px;
overflow: hidden;
cursor: pointer;
}
@webcracy
webcracy / botbot.py
Created December 5, 2011 16:03
Manybots - Python Natural Language Parsing
from nltk import pos_tag, word_tokenize
from en import verb # from http://nodebox.net/code/index.php/Linguistics
import re, pprint
from nltk.probability import ConditionalFreqDist
import os
def ie_preprocess(sentence):
sentence = word_tokenize(sentence)
sentence = pos_tag(sentence)
@webcracy
webcracy / manybots_auth_token_example.rb
Created November 25, 2011 14:43
Manybots API - Auth Token example
# encoding: UTF-8
require 'rubygems'
require 'json/add/core'
require 'httparty'
TOKEN = 'YOUR API TOKEN' #find it in your /account page
module Manybots
@webcracy
webcracy / activity_get_example.js
Created November 22, 2011 10:47
Manybots - Activity Streams examples
{
"data": {
"items": [
{
"id": "http://examplemanybotsserver.com/activities/170",
url: "http://examplemanybotsserver.com/activities/170",
"title": "<%= "<a href='http://examplemanybotsserver.com/users/1'>Alex Solleiro</a> joined <a href='http://examplemanybotsserver.com'>Manybots Server</a>."%>",
"summary": "Welcome to Manybots Server",
"published": "2010-11-09 17:22:41 UTC",
"tags": [ "manybots", "account"],
@webcracy
webcracy / dashboard_controller.rb
Created November 3, 2011 16:39
Manybots - Ruby on Rails tutorial
class DashboardController < ApplicationController
before_filter :authenticate_user!
def index
end
def post_activity
test_activity = Manybots::Feed::Item.new_test_activity(current_user)
activity_from_manybots = current_user.post_to_manybots!(test_activity)
@webcracy
webcracy / slide.jquery.js
Created October 4, 2011 13:00
Dead simple JS / jquery slideshow
$('.slide').each(function() {
$(this).hide();
});
(function shownext(jq){
jq.eq(0).fadeIn(500, function(){
$(this).delay(5500).fadeOut(250, function() {
if ((jq=jq.slice(1)).length == 0)
(jq=$('.slide')).length && shownext(jq);
else
@webcracy
webcracy / tvi_video_poller.rb
Created November 8, 2010 14:02
Poll and Scrape TVI website for a given News Show and do growl notification
require 'rubygems'
require 'open-uri'
require 'cgi'
require 'hpricot'
require 'ruby-growl'
url = "http://www.tvi.iol.pt/frame_videos_tvi.html"
growl = Growl.new 'localhost', 'ruby-growl', ["ruby-growl Notification"]
loop do