Skip to content

Instantly share code, notes, and snippets.

View ronaldlangeveld's full-sized avatar

Ronald Langeveld ronaldlangeveld

View GitHub Profile
@ronaldlangeveld
ronaldlangeveld / LevelsLark 1.03
Last active November 23, 2017 07:55 — forked from levelsio/LevelsLark 1.03
LevelsLark Python/Django
# This is a fork from Levelsio's gist.
# Check the original gist (PHP) https://gist.github.com/levelsio/6716e7261c73fd873ba2ce1f4a406012
# I just converted it so it can be used with Django.
# This is all Python3.6
# // <readme>
# /*
# This is a lite version of Olark's and Intercom's functionality (without the chat part).
# It lets you get feedback from users on your site to your email.
@ronaldlangeveld
ronaldlangeveld / rssfeedmodel
Last active December 15, 2017 12:21
RSS Feed Models
from __future__ import unicode_literals
from django.db import models
from django.utils import timezone
# CREATE MODELS HERE
class RSSJFeed(models.Model):
id = models.AutoField(primary_key=True)
time = models.DateTimeField(default=timezone.now)
title = models.CharField(max_length=60)
from django.shortcuts import render
from django.http import HttpResponse, JsonResponse, HttpResponseRedirect
from pullrss.models import RSSData
import feedparser
from django.db import IntegrityError
from time import mktime
from datetime import datetime
from django.shortcuts import render_to_response
from django.template import RequestContext
@ronaldlangeveld
ronaldlangeveld / gist:c3e87f94b97afc66096a40e9440df44c
Created January 4, 2018 18:39
How to add your Python bot as a startup service on your Ubuntu Server
[Unit]
Description=bot
After=network.target
[Service]
User=username
Type=idle
ExecStart=/home/user/bots/venv/bin/python3.6 /home/user/bots/botscript.py
[Install]
@ronaldlangeveld
ronaldlangeveld / gist:6cde23f627dac3e501704a26317f3142
Created January 9, 2018 07:20
USING JSON WITH JAVASCRIPT BASICS
USING JSON WITH JAVASCRIPT BASICS.
CREDIT GOES TO: https://github.com/Fanna1119
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400" rel="stylesheet">
</head>
@ronaldlangeveld
ronaldlangeveld / json
Created March 12, 2018 21:12
json xml to text
import json
import io
mydata = json.load(io.open('library.json', 'r', encoding='utf-8-sig'))
# print(mydata['plist']['dict']['dict']['dict'][1]['string'][0])
a = mydata['plist']['dict']['dict']['dict']
for k in a:
data = k['string']
song = data[0]
artist = data[1]
print(song, ' , ', artist)
//HtML
<form>
{% csrf_token %}
<input type="file" name="pic" accept="image/*" id="image">
<input type="submit" id="send">
</form>
//JS
function ResizeImage() {
var description = $('#imgdescription').val();
var project_name = $('#project_name').val();
if (window.File && window.FileReader && window.FileList && window.Blob) {
var filesToUploads = document.getElementById('imageFile').files;
var file = filesToUploads[0];
if (file) {
var reader = new FileReader();
// Set the image once loaded into file reader
.bigHeaderFont {
font-size: 20em;
}
@media (max-width:1024px) {
.bigHeaderFont {
font-size:10em;
}
import os
import datetime
from datetime import datetime
from flask import Flask
import json
from flask import request, url_for
from flask_sqlalchemy import SQLAlchemy
from flask import jsonify, json, request
from flask_cors import CORS
from flask_bcrypt import Bcrypt