Skip to content

Instantly share code, notes, and snippets.

View edmore's full-sized avatar

Edmore Moyo edmore

  • Cape Town, South Africa
View GitHub Profile
@edmore
edmore / sound.go
Last active December 19, 2015 21:58
Using Go interfaces for Duck typing like features
// Simple Duck Typing in Go
package main
import "fmt"
type Animal interface {
sound() string
getName() string
}
@edmore
edmore / feeds.go
Last active December 15, 2015 16:09
Go implementation
package main
import (
"github.com/garyburd/redigo/redis"
"log"
"os"
"os/exec"
"sync"
)
@edmore
edmore / feeds.rb
Last active December 15, 2015 16:09
Ruby implementation
#! /usr/local/bin/ruby
require 'rubygems'
require 'redis'
require 'fileutils'
app_root = "/usr/local/camera_dashboard"
redis = Redis.new
cmds = []
venue_list = redis.lrange("venues", 0, -1)
@edmore
edmore / updown3.rb
Created February 12, 2013 18:19
Check if site is down from (using headless webkit)
#! /usr/bin/env ruby
##########################################################
# Description - Check whether site is up or down via the
# command line.
# Author - www.edmoremoyo.com
# Dependency - phantomjs ( http://phantomjs.org/ )
##########################################################
url = ARGV[0]
@edmore
edmore / updown2.rb
Created February 12, 2013 18:18
Check if site is down from terminal (via proxy)
#! /usr/bin/env ruby
##########################################################
# Description - Check whether site is up or down via the
# command line.
# Added feature - proxy access
# Author - www.edmoremoyo.com
##########################################################
require "net/http"
@edmore
edmore / updown1.rb
Created February 12, 2013 18:09
Check if site is down from terminal
#! /usr/bin/env ruby
##########################################################
# Description - Check whether site is up or down via the
# command line.
# Author - www.edmoremoyo.com
##########################################################
require "net/http"
require "uri"
@edmore
edmore / sound_loop.html
Created June 12, 2012 17:07
Sound playback loop html 1st draft
<html>
<head>
<title> Sound Loop </title>
<style>
#container{ font-size: 6em; float: left; }
#question{
float: right;
border: 1px solid #000;
}
#question_header{
@edmore
edmore / sound_loop.js
Created June 12, 2012 04:30
Sound playback loop function 1st draft
var sounds = [["How are you", "hi.mp3"], ["Who is this", "who.mp3"], ["How was school", "how.mp3"], ["What is this","what.mp3"], ["Who is this", "who.mp3"], ["1 + 2", "math.mp3"]],
presets = ["Who is this", "What is this"];
function loop(){
setTimeout(function(){
var sound = sounds.splice( 0, 1 ),
clearDivContents = function( klasses ){
console.log( klasses );
for( var i=0; i < klasses.length; i+=1 ){
$( klasses[i] ).children().detach();
@edmore
edmore / meta_set_get.rb
Created May 1, 2012 15:57
Meta programming Setters and Getters
class Object
def self.my_attr_accessor( *names )
names.each do |name|
define_method( "#{name}=" ) do |value|
instance_variable_set( "@#{name}", value )
end
define_method( name ) do
instance_variable_get( "@#{name}" )
end
end
@edmore
edmore / zsh_oh_my_zsh
Created March 28, 2012 11:53
zsh and oh-my-zsh installation
git clone git://zsh.git.sf.net/gitroot/zsh/zsh
cd zsh
cat INSTALL
Follow the install instructions
Then its time for oh-my-zsh :
https://github.com/robbyrussell/oh-my-zsh
Follow the instructions for installation.