A very simple example of using a map of channels for pub/sub in go.
To run it go here http://play.golang.org/p/eXwppMgHR3
| # Author: Pieter Noordhuis | |
| # Description: Simple demo to showcase Redis PubSub with EventMachine | |
| # | |
| # Update 7 Oct 2010: | |
| # - This example does *not* appear to work with Chrome >=6.0. Apparently, | |
| # the WebSocket protocol implementation in the cramp gem does not work | |
| # well with Chrome's (newer) WebSocket implementation. | |
| # | |
| # Requirements: | |
| # - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby |
| // Skeleton jQuery plugin | |
| function($) | |
| { | |
| $.fn.myPlugin = function( options ) | |
| { | |
| // options. | |
| $.fn.myPlugin.settings = $.extend( {}, $.fn.myPlugin.defaults, options ); | |
| // Go through the matched elements and return the jQuery object. |
| <!DOCTYPE html> | |
| <!-- Helpful things to keep in your <head/> | |
| // Brian Blakely, 360i | |
| // http://twitter.com/brianblakely/ | |
| --> | |
| <head> | |
| <!-- Disable automatic DNS prefetching. | |
| /* | |
| Here's a small IPv4 example: it asks for a portbase and a destination and | |
| starts sending packets to that destination. | |
| */ | |
| #include "rtpsession.h" | |
| #include "rtpudpv4transmitter.h" | |
| #include "rtpipv4address.h" | |
| #include "rtpsessionparams.h" | |
| #include "rtperrors.h" |
| package main | |
| import ( | |
| "bytes" | |
| "exec" | |
| "log" | |
| "os" | |
| ) | |
| // Pipeline strings together the given exec.Cmd commands in a similar fashion |
| #! /bin/bash | |
| create_tag(){ | |
| TAG=deployed_at_$(date +"%F_%H-%M") | |
| git tag -m '' -a $TAG | |
| git push --tags | |
| } | |
| quick_deploy(){ | |
| echo 'Starting quick deploy...' |
| #!/bin/bash | |
| # This script builds the iOS and Mac openSSL libraries | |
| # Download openssl http://www.openssl.org/source/ and place the tarball next to this script | |
| # Credits: | |
| # https://github.com/st3fan/ios-openssl | |
| # https://github.com/x2on/OpenSSL-for-iPhone/blob/master/build-libssl.sh | |
A very simple example of using a map of channels for pub/sub in go.
To run it go here http://play.golang.org/p/eXwppMgHR3
| # Last updated May, 2024 for Apple silicon Macs | |
| # Install Homebrew if you don't already have it: https://brew.sh | |
| # install nano from homebrew | |
| brew install nano nanorc | |
| # update your nanorc file | |
| echo 'include "'"$(brew --cellar nano)"'/*/share/nano/*.nanorc"' >> ~/.nanorc | |
| # close and re-open your terminal and you'll have syntax highlighting |
| package main | |
| import ( | |
| "github.com/garyburd/redigo/redis" | |
| ) | |
| var ErrLockMismatch = errors.New("key is locked with a different secret") | |
| const lockScript = ` | |
| local v = redis.call("GET", KEYS[1]) |