Skip to content

Instantly share code, notes, and snippets.

View gaving's full-sized avatar
🎯
Focusing

Gavin Gilmour gaving

🎯
Focusing
View GitHub Profile
@MathRivest
MathRivest / gitlab.rb
Last active August 29, 2015 14:01
Dashing - Gitlab Latest Commits
GITLAB_BASE_URL = ""
GITLAB_TOKEN = ""
# Retrieve the repositories and commits in gitlab
SCHEDULER.every '5m', :first_in => 0 do |job|
uri = URI("#{GITLAB_BASE_URL}projects?private_token=#{GITLAB_TOKEN}")
response = Net::HTTP.get(uri)
data = JSON.parse(response)
var http = require('http'),
io = require('socket.io'),
redis = require('redis');
server = http.createServer(function(req,response) {});
server.listen(8080);
var redisConn = redis.createClient();
var socket = io.listen(server);
@3rd-Eden
3rd-Eden / socket.io.broadcast.http.url.js
Created November 30, 2010 21:20
Broadcast messages through socket.io based on server urls.
var http = require("http"), io = require("socket-io")
.. do your require stuff
var server = http.createServer(function(req,res){
.. determine the location, and if its the same use the socket.io broadcast fn to send a message
if( req url is the same as /ping )
socketio.broadcast("pong")
});
10:02 < gavin> just jammin, im jammin
10:02 < gavin> who sang that again is that marley
10:02 < gavin> i need to put it on
10:02 < mike> yeah
10:03 < mike> I remember years ago the photocopier in the office jammed and one of the guys started singing that
10:03 < mike> in tears
10:03 < gavin> lol
#!/usr/bin/zsh
typeset -Ag abbreviations
abbreviations=(
"pinc" "/usr/{lib,share}/perl5/{core,site,vendor}_perl/"
"Paralel" "Parallel"
"Paralell" "Parallel"
"Para::Fork" "Parallel::ForkManager"
"D::D" "Data::Dumper"
@adamlundrigan
adamlundrigan / README.md
Created April 13, 2012 18:13
Having problems running Git command via a Phing exectask in a Git post-receive hook

Problem

Running git command through a Phing ExecTask:

<exec command="git remote rm origin" dir="${build.src}" checkreturn="false" />

This works when phing build.setup is executed directly from command prompt. However, the same process fails when run from a Git post-receive hook with this message:

@canuto
canuto / tasks-spec.coffee
Created September 18, 2012 08:15
Mocha test for simple task REST API using supertest
request = require 'supertest'
assert = require 'assert'
app = (require '../../app').app # remember to export app from your app file!!
before(done)->
# some code to remove all tasks
# ...
done() # asynch callback to tell mocha to go to the next step/spec
describe 'simple todo API',->
@viktorkelemen
viktorkelemen / gist:3992144
Created November 1, 2012 06:18
Retrieving the results of last command
zmodload -i zsh/parameter
insert-last-command-output() {
LBUFFER+="$(eval $history[$((HISTCMD-1))])"
}
zle -N insert-last-command-output
bindkey "^X^L" insert-last-command-output
@leon
leon / ui-router-resolve.js
Created September 13, 2013 13:47
ui-router resolve
$stateProvider.state('main', {
abstract: true,
url: '/:account',
resolve: {
auth: function ($q, $state, $stateParams, $location, AccountRepo, Security) {
return AccountRepo.auth().then(function (user) {
// If not logged in redirect to login with path preserved
if (user === false) {
$state.go('account.login', {redirect: $location.url()});
return $q.reject('not logged in');
@wa0x6e
wa0x6e / README.md
Last active December 23, 2015 01:59
Redis widget for Dashing

Redis widget for Dashing

Description

Redis dashing widget to display the number of connected clients to a redis server, as well as the instance memory usage.

Dependencies