Skip to content

Instantly share code, notes, and snippets.

View roosnic1's full-sized avatar
🎉

Nicolas Roos roosnic1

🎉
View GitHub Profile
const filePath = path.join(__dirname, '../users.csv')
fs.readFile(filePath, async (error, data) => {
if (error) {
return console.log('error reading file', error)
}
const users = await neatCsv(data)
const periodsDb = await csvdb(`${__dirname}/../periods.csv`)
const lineDb = await csvdb(`${__dirname}/../lineitems.csv`)
<h1>{{ question.question_text }}</h1>
{% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %}
<form action="{% url 'vote' question.id %}" method="post">
{% csrf_token %}
{% for choice in question.choice_set.all %}
<input type="radio" name="choice" id="choice{{ forloop.counter }}" value="{{ choice.id }}">
<label for="choice{{ forloop.counter }}">{{ choice.choice_text }}</label><br>
{% endfor %}
<h1>{{ question.question_text }}</h1>
<ul>
{% for choice in question.choice_set.all %}
<li>{{ choice.choice_text }}</li>
{% endfor %}
</ul>
from django.contrib import admin
from .models import Question, Choice
class ChoiceInline(admin.TabularInline):
model = Choice
fields = ('choice_text', 'votes',)
fk_name = "question"
from django.db import models
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
class Choice(models.Model):
question = models.ForeignKey(Question, on_delete=models.CASCADE)
choice_text = models.CharField(max_length=200)
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index'),
]
class FileUploadParser:
customer = ""
fixCompany = ""
fixName = ""
fixStreet = ""
fixZip = ""
fixCity = ""
fixCountry = ""
fixPhone = ""
fixMail = ""
@roosnic1
roosnic1 / main.py
Created April 8, 2018 09:30
Python Tkinter GUI and Thread example (Python 2.7)
from Tkinter import *
import Queue
import time
import threading
def bluetooth_loop(thread_queue=None, text_input=""):
time.sleep(15)
thread_queue.put(text_input)
class App:
@roosnic1
roosnic1 / index.js
Created March 20, 2018 09:54
Write to bluetooth
const noble = require('noble');
noble.on('discover', (peripheral) => {
console.log('Found device', peripheral.advertisement.localName);
if(peripheral.id === '9e359b047dfa4f07a404476dfacdd68a') {
console.log('Connectiing to Biscuit');
peripheral.connect((err) => {
if(err) {
console.log('Could not connect', err);

Keybase proof

I hereby claim:

  • I am roosnic1 on github.
  • I am roosnic1 (https://keybase.io/roosnic1) on keybase.
  • I have a public key ASCMP_jeG0OPgDc4LW9KcYpv_GZA-dR7D-kUI2TY4n9NpQo

To claim this, I am signing this object: