Skip to content

Instantly share code, notes, and snippets.

@DataWraith
DataWraith / Neural_Net_demo.rb
Created July 1, 2010 19:14
Example of a _very_ simple feed-forward neural network.
class Link
def initialize(to, weight)
@to = to
@weight = weight
end
def propagate(activation)
puts " propagating #{activation} * #{@weight} = #{@weight * activation} to #{@to.name}"
puts " old activation: #{@to.activation}"
@benburry
benburry / echo.py
Last active October 7, 2019 05:05
Python 2 - mock & unittest example for Popen
from subprocess import Popen, PIPE
def shell_out(command):
return Popen(command.split(' '), stdout=PIPE,stderr=PIPE).communicate()[0].strip('\n').split('\n')
def main():
return shell_out('echo one\ntwo\nthree\n')
@supereggbert
supereggbert / index.html
Last active October 15, 2023 23:19
3D Surface Plot in D3.js
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
body{
font-family: sans;
padding: 10px;
}
svg path{
@lost-theory
lost-theory / gist:3925738
Created October 21, 2012 04:29
different delimiters in jinja2 + flask
from flask import Flask, render_template_string, request
class CustomFlask(Flask):
jinja_options = Flask.jinja_options.copy()
jinja_options.update(dict(
block_start_string='<%',
block_end_string='%>',
variable_start_string='%%',
variable_end_string='%%',
comment_start_string='<#',
/* VT100 terminal reset (<ESC>c) */
console.log('\033c');
/* numbers comparations */
> '2' == 2
true
> '2' === 2