Skip to content

Instantly share code, notes, and snippets.

View grobertson's full-sized avatar

Grant Robertson grobertson

View GitHub Profile
/* Melbus CDCHGR Emulator
* Program that emulates the MELBUS communication from a CD-changer (CD-CHGR) in a Volvo V70 (HU-xxxx) to enable AUX-input through the 8-pin DIN-contact.
* This setup is using an Arduino Nano 5v clone
*
* The HU enables the CD-CHGR in its source-menue after a successful initialization procedure is accomplished.
* The HU will remove the CD-CHGR everytime the car starts if it wont get an response from CD-CHGR (second init-procedure).
*
* Karl Hagström 2015-11-04
* mod by S. Zeller 2016-03-14
*
@grobertson
grobertson / gps_demo.py
Created February 21, 2020 08:50 — forked from wolfg1969/README.md
python-gps sample codes
import gps, os, time
session = gps.gps()
while 1:
os.system('clear')
session.query('admosy')
# a = altitude, d = date/time, m=mode,
# o=postion/fix, s=status, y=satellites
@grobertson
grobertson / Satya_further_reading.MD
Last active February 13, 2020 05:11
Further reading suggested by Satya
def get_width(self, width):
"""Returns an acceptable width from a requested width.
Per https://developers.facebook.com/docs/plugins/embedded-posts/, FB
embeds must be between 350 and 750 pixels wide.
If no width passed, default to 360, else get as close to requested
width as possible while following FB's guidelines.
"""
if not width:
from django import forms
from haystack.forms import SearchForm
from datetime import datetime, timedelta
ORDER_BY_CHOICES = (
('r', "Relevance"),
('d', "Descending"),
('a', "Ascending")
)
{% load static from staticfiles %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Crop Imported Image">
<title>Cropper</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.2/css/bootstrap.min.css">
- Customizeable copyright element in channel
- Customizeable logo image element in channel
- Related items are now tollerant of unicode characters (i.e. Feed doesn't 500 when related item titles contain unicode)
from django.test import TestCase
from django.test.client import Client, RequestFactory
from dd.grabit.views import save_image_from_url
from django.contrib.auth.models import User
class GrabitViewsTestCase(TestCase):
def setUp(self):
self.user = User.objects.create_superuser('foo', 'foo@bar.com', 'bar')
self.rf = RequestFactory()
<script>
/*! modernizr 3.2.0 (Custom Build) | MIT *
* http://modernizr.com/download/?-mediaqueries !*/
!function(e,n,t){function o(e,n){return typeof e===n}function a(){var e,n,t,a,s,i,r;for(var l in f)if(f.hasOwnProperty(l)){if(e=[],n=f[l],n.name&&(e.push(n.name.toLowerCase()),n.options&&n.options.aliases&&n.options.aliases.length))for(t=0;t<n.options.aliases.length;t++)e.push(n.options.aliases[t].toLowerCase());for(a=o(n.fn,"function")?n.fn():n.fn,s=0;s<e.length;s++)i=e[s],r=i.split("."),1===r.length?Modernizr[r[0]]=a:(!Modernizr[r[0]]||Modernizr[r[0]]instanceof Boolean||(Modernizr[r[0]]=new Boolean(Modernizr[r[0]])),Modernizr[r[0]][r[1]]=a),d.push((a?"":"no-")+r.join("-"))}}function s(e){var n=u.className,t=Modernizr._config.classPrefix||"";if(p&&(n=n.baseVal),Modernizr._config.enableJSClass){var o=new RegExp("(^|\\s)"+t+"no-js(\\s|$)");n=n.replace(o,"$1"+t+"js$2")}Modernizr._config.enableClasses&&(n+=" "+t+e.join(" "+t),p?u.className.baseVal=n:u.className=n)}function i(){return"function"!=typeof n.create
dailydot_database_backups
dd-stage-additional-advertoria
dd-stage-ajfavicon
dd-stage-ajfixtc
dd-stage-ajrendererless
dd-stage-arsenionew-follow
dd-stage-arsrevcontentjs
dd-stage-autosave
dd-stage-bump-to-cms-version-0
dd-stage-closure-carousel