Skip to content

Instantly share code, notes, and snippets.

View philippspinnler's full-sized avatar

Philipp Spinnler philippspinnler

View GitHub Profile
@philippspinnler
philippspinnler / simple-neuron.py
Last active September 4, 2025 07:06
Simple Neuron
# We set a fixed starting point for random numbers so we get the same results each time
import random
random.seed(42)
# Our learning data
x_data = [1, 2, 3, 4, 5] # Input numbers
y_data = [2, 4, 6, 8, 10] # Output numbers (each is 2 times the input)
# Starting guesses for our formula (y = w*x + b)
w = random.random() # This should end up close to 2
@philippspinnler
philippspinnler / merge.js
Created March 31, 2015 07:34
Angular function to merge two objects. This method will be in angular 1.4 but is missing in previous versions.
function merge(dst, src) {
var h = dst.$$hashKey;
if (!angular.isObject(src) && !angular.isFunction(src)) return;
var keys = Object.keys(src);
for (var j = 0, jj = keys.length; j < jj; j++) {
var key = keys[j];
var src_new = src[key];
if (angular.isObject(src_new)) {