Skip to content

Instantly share code, notes, and snippets.

View jordandobson's full-sized avatar
🥽

Jordan Dobson jordandobson

🥽
View GitHub Profile
def start( port = 24842 )
server = TCPServer.new( port )
log "[server log] Server started on localhost: #{port}"
while @session = server.accept
# 1) get the username
username = @session.gets.chomp
log "[server log] Received Client's Username: #{username}"
@jordandobson
jordandobson / Logger.rb
Created April 29, 2010 09:31
Logger for UW Ruby Class
require 'thread'
require 'resolv'
class Logger
def initialize( infile = 'old-log.txt' , outfile = 'new-log.txt', max_threads = 3 )
@cache = {}
@queue = Queue.new
@list = []
@threads = []
require 'socket'
class ChatClient
def initialize
@server = TCPSocket.open( 'localhost', 36963 )
connectToServer
end
def connectToServer
$(function(){
$('#jqt').ajaxComplete(function(){
add_ga(); // add google analytics on each page load
});
$(document).ready(function() {
add_ga(); // add google analytics to the first page
});
function add_ga() {
<link rel="apple-touch-icon-precomposed" media="screen and (resolution: 163dpi)" href="/iOS-57px.png" />
<link rel="apple-touch-icon-precomposed" media="screen and (resolution: 132dpi)" href="/iOS-72px.png" />
<link rel="apple-touch-icon-precomposed" media="screen and (resolution: 326dpi)" href="/iOS-114px.png" />
if (window.devicePixelRatio == 2) {
// All yer codez Here
}
@jordandobson
jordandobson / css_tabbar_highlight_webkit_gradient.css
Created October 15, 2010 22:01
iOS Tab Bar Highlight with Webkit CSS Gradients. Code Sampled from: http://cl.ly/2qas
/* Sets Size of box containing gradients */
.layer{
width: 48px;
height: 32px;
}
/* Final Combined Gradient Image Composition */
.all{
@jordandobson
jordandobson / vignette.css
Created November 25, 2010 09:28
Examples of adding a Vignette to Photos with CSS3 Gradients. Code sampled from: http://cl.ly/3Nxc
/* Border & Vignette Setup */
figure{
position: relative;
display: block;
line-height: 0;
width: 500px;
height: 333px;
margin-bottom: 2em;
border: 1em solid #fff;
@jordandobson
jordandobson / closure.js
Created March 3, 2011 20:17
create closure
(function(countdown, container){
var index;
function log(){
console.log(index);
}
function iterate(){
log();
var Car = function(make, color){
this.make = make;
this.color = color;
};
function logCar(c){
console.log("I'm a " + c.color + " " + c.make);
}
Car.prototype.log = function(){