Skip to content

Instantly share code, notes, and snippets.

View Neppord's full-sized avatar

Samuel Ytterbrink Neppord

View GitHub Profile
@Neppord
Neppord / router.js
Created July 11, 2012 07:39
How does the automatic find binding work?
App.Router = Em.Router.extend({
root: Em.Route.extend({
route: '/',
post: Em.Route.extend({
route: '/:post_user/:post_date',
connectOutlets: function (router, context) {
// Should give the Post with the user, and the date?
}
})
})
@Neppord
Neppord / problem.py
Created July 17, 2012 18:32
Pyjaco Discussion
class MyClass:
value = 0
"""jsspace
MyClass.value = 0;
"""
@Neppord
Neppord / while.c
Created August 12, 2012 16:16
c refactor
int main ()
{
do
{
if(strlen(perstyp[k].namn)==0) break; //räknar ut antal sparade
k++;
}
while(1);
}
@Neppord
Neppord / Makefile
Created August 12, 2012 17:43
trying some c
run_test: test
./test
run: main
./main
test: test.c person.c person.h
gcc -o test test.c person.c
build: main.c person.c person.h
gcc -o main test.c person.c
@Neppord
Neppord / alarm.py
Created September 13, 2012 21:26
sticky trigger
import random
class Sensor(object):
OFFSET = 16
def pop_next_pressure_psi_value(self):
pressure_telemetry_value = self.sample_pressure()
return Sensor.OFFSET + pressure_telemetry_value
def __iter__(self):
@Neppord
Neppord / alarm.py
Created September 14, 2012 15:55 — forked from objarni/alarm.py
fuse variation
import random
class Sensor(object):
OFFSET = 16
def pop_next_pressure_psi_value(self):
pressure_telemetry_value = self.sample_pressure()
return Sensor.OFFSET + pressure_telemetry_value
def __iter__(self):
@Neppord
Neppord / test.py
Created October 20, 2012 21:28
debug msg decerator
@lambda func:(lambda *a, **k: (print(repr(a), repr(k)), func(*a, **k))[1])
def my_id_func(*a):
return a
# -*- coding: utf-8 -*-
"""
>>> update_item(Item("a", 1, 2))
a, 0, 1
>>> update_item(Item("a", 1, 1))
a, 0, 0
>>> update_item(Item("a", 1, 0))
a, 0, 0
>>> update_item(Item("a", 0, 3))
a, -1, 1
@Neppord
Neppord / model.js
Last active December 12, 2015 03:18
Trying to understand DS.Model
window.Models = EM.Namespace.create();
DS.RESTAdapter.map('Models.model', {
primaryKey: 'idx'
})
Models.model = DS.Model.extend({
init: function () {
this.super();
Em.run.next({
@Neppord
Neppord / fb.py
Last active December 12, 2015 05:29
fizz buzz
def check(number):
pass
def run_tests():
assert check(1) == 1, "one is not devicible with 3 or 5 so leave it alone"
if __name__ == "__main__":
run_tests()