This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load the TCP Library | |
net = require('net'); | |
// Keep track of the chat clients | |
var clients = []; | |
// Start a TCP Server | |
net.createServer(function (socket) { | |
// Identify this client |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* global google */ | |
var GoogleMapComponent = Ember.Component.extend({ | |
places: [], | |
width: 500, | |
height: 500, | |
attributeBindings: ['style'], | |
style: function () { | |
return 'width:'+this.width+'px; height:'+this.height+'px'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.hll { background-color: #ffffcc } | |
.c { color: #586E75 } /* Comment */ | |
.err { color: #93A1A1 } /* Error */ | |
.g { color: #93A1A1 } /* Generic */ | |
.k { color: #859900 } /* Keyword */ | |
.l { color: #93A1A1 } /* Literal */ | |
.n { color: #93A1A1 } /* Name */ | |
.o { color: #859900 } /* Operator */ | |
.x { color: #CB4B16 } /* Other */ | |
.p { color: #93A1A1 } /* Punctuation */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
The MIT License (MIT) | |
Copyright (c) 2013 Jean Helou | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
from ggplot import * | |
from sklearn.datasets import fetch_20newsgroups | |
from sklearn.metrics import roc_curve | |
# vectorizer | |
from sklearn.feature_extraction.text import HashingVectorizer | |
# our classifiers | |
from sklearn.naive_bayes import BernoulliNB, MultinomialNB |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module HMM | |
using Distributions | |
import Distributions.rand | |
import Distributions.fit | |
immutable HiddenMarkovModel{TP, K} | |
theta::Vector{TP} | |
A::Matrix{Float64} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def stochastic_linear_gradient_descent(X, y, theta, alpha, tolerance): | |
converged = False | |
prev_cost = 0 | |
n_samples = X.shape[0] | |
while not converged: | |
# use xrange so you dont have to generate the entire range of numbers | |
for i in xrange(n_samples): | |
# you have to sample x and y together | |
# FYI, using one example at a time can be super slow. | |
# you might want to consider using batches which should converge quicker |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib.sessions.backends.base import SessionBase, CreateError | |
from django.conf import settings | |
from django.utils.encoding import force_unicode | |
import redis | |
class SessionStore(SessionBase): | |
""" Redis store for sessions""" | |
def __init__(self, session_key=None): | |
self.redis = redis.Redis( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
import javax.sound.midi._ | |
val synth = MidiSystem.getSynthesizer() | |
synth.open() | |
def note(i: Int) = { | |
val channels = synth.getChannels() | |
channels(0).noteOn(i, 100) | |
Thread.sleep(250) | |
channels(0).noteOff(i) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rouge' | |
module Rouge | |
module Lexers | |
class Android < Rouge::Lexers::Java | |
tag 'android' | |
end | |
end | |
end |