Skip to content

Instantly share code, notes, and snippets.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>se.jherrlin</groupId>
<artifactId>server</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
@jherrlin
jherrlin / Django-Admin-Honeypot-Test
Created December 18, 2015 20:03
Test after change of IPAddressField to GenericIPAddressField
py.test tests/ --cov admin_honeypot --cov-report term-missing --pep8 admin_honeypot
================================================================================ test session starts ================================================================================
platform darwin -- Python 2.7.10, pytest-2.8.5, py-1.4.31, pluggy-0.3.1
rootdir: /Users/nils/.virtualenvs/jherrlin-django1.9/lib/python2.7/site-packages/django-admin-honeypot, inifile: setup.cfg
plugins: cov-2.2.0, django-2.9.1, pep8-1.0.6
collected 17 items
tests/__init__.py .
tests/settings.py .
In template:
<li><a href="{% url 'ProjectsListView'%}">Projects</a></li>
In urls.py
url(r'^$', ProjectsListView.as_view(), name='ProjectsListView'),
Genom att använda "name" i url så kan man koppla den urlen till en länk i templaten.
/*
DHCP-based IP printer
This sketch uses the DHCP extensions to the Ethernet library
to get an IP address via DHCP and print the address obtained.
using an Arduino Wiznet Ethernet shield.
Circuit:
Ethernet shield attached to pins 10, 11, 12, 13
// This is the working sketch
// THIS IS THE WORKING ONE!!
// With ESP8266
#include <OneWire.h>
#include <DallasTemperature.h>
#include <SoftwareSerial.h>
#define ONE_WIRE_BUS 3
#define SSID "network"
class Car(object):
def __init__(self, color, gears): # This is the constructor with 2 arguments as input
self.color = color # This is object attribute
self.gears = gears
print('Color is : {}'.format(self.color)) # Prints when constructor is called
print('Number of gears: {}'.format(self.gears))
car1 = Car('Yellow', 5) # Create a new instance of Car
What i wanna do:
- Get all repos from a github organization.
- Save them to the database.
- Get all contributors from the repos that we just stored in the database.
- Create a two way relationship Contributor <-> Project
# Models.py
class Project(TimeStampedModel):
@jherrlin
jherrlin / gist:ce109d4f4ea0e633fb57
Created July 25, 2015 18:21
AngularJS / ui-router / ngResource
# app.js
angular.module('myApp', [
'ui.router',
'ngResource',
'services',
'factories',
'controllers'