Skip to content

Instantly share code, notes, and snippets.

View philippbosch's full-sized avatar

Philipp Bosch philippbosch

View GitHub Profile
<h2>Installation</h2>
<p>
Drag and drop the following link to your bookmarks bar:<br>
<a href="javascript:(function() { var elem=document.createElement('script'); elem.setAttribute('src', 'https://gist.github.com/philippbosch/5018940/raw/pinterest-slideshow.js?t='+(new Date().getTime())); document.body.appendChild(elem); }())">Slideshow</a>
</p>
@philippbosch
philippbosch / sine.js
Last active December 28, 2021 12:52
Sine in JS and in Processing
var sprintf = require('sprintf').sprintf; // only needed for formatting the console output
var counter = 0;
var increase = Math.PI * 2 / 50;
var i=0;
setInterval(function() {
var val = Math.sin(counter-Math.PI/2)/2+0.5;
counter += increase;
console.log(sprintf("%.3f %" + Math.round(val*60) + "s", val, "."));
@philippbosch
philippbosch / sprintf.ino
Created April 16, 2013 12:59
sprintf() in Arduino code
unsigned int i = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
char buffer[50];
sprintf(buffer, "the current value is %d", i++);
Serial.println(buffer);
@philippbosch
philippbosch / raw_post_data_file_field.py
Created August 9, 2011 10:41
Saving raw POST data to a file field in Django
from django.core.files.base import ContentFile
uploaded_file = ContentFile(request.raw_post_data)
uploaded_file.name = "filename.txt"
my_object.file = uploaded_file
my_object.save()
@philippbosch
philippbosch / _animations.scss
Last active August 29, 2019 00:20
Compass mixins for CSS keyframe animations
@import "compass/css3/shared";
@mixin keyframes($name) {
@-webkit-keyframes $name {
@content;
}
@-moz-keyframes $name {
@content;
}
@philippbosch
philippbosch / Dockerfile
Last active July 21, 2019 20:14
Django Dockerfile
FROM python:3.7
ENV PYTHONUNBUFFERED 1
ENV WERKZEUG_DEBUG_PIN off
ENV DJANGO_SETTINGS_MODULE myproject.settings.dev
RUN apt-get update && \
apt-get install -y gettext postgresql-client libpq-dev \
--no-install-recommends && rm -rf /var/lib/apt/lists/*
RUN mkdir /code
COPY requirements.txt requirements-dev.txt /code/
RUN pip install -r /code/requirements-dev.txt
#!/bin/bash
export PATH=$PATH:/usr/local/bin
COUNT=$(curl -s -H 'Authorization: bearer <TOKEN>' -X POST -d '{"query": "{search(query: \"is:pr is:open archived:false sort:updated-desc review-requested:philippbosch\", type: ISSUE, first: 10){issueCount}}"}' https://api.github.com/graphql | jq .data.search.issueCount)
if [ "$COUNT" -ne "0" ] ; then
echo "$COUNT ⎇|color=#ff9900 size=12 href=https://github.com/pulls?q=is%3Apr+is%3Aopen+archived%3Afalse+sort%3Aupdated-desc+review-requested%3Aphilippbosch"
fi
@philippbosch
philippbosch / cross-browser-rgba-mixin.scss
Created July 19, 2010 10:49
image-less RGBA backgrounds for real browsers and Internet Explorer
@mixin rgba-background($color, $opacity) {
background-color: $color;
background-color: rgba($color, $opacity);
background-color: transparent\9;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#{'#'+hex(round($opacity*255)) + '' + hex(red($color)) + '' + hex(green($color)) + '' + hex(blue($color))},endColorstr=#{'#'+hex(round($opacity*255)) + '' + hex(red($color)) + '' + hex(green($color)) + '' + hex(blue($color))});
zoom: 1;
}

Keybase proof

I hereby claim:

  • I am philippbosch on github.
  • I am philippbosch (https://keybase.io/philippbosch) on keybase.
  • I have a public key whose fingerprint is 9BCE E011 6753 E7FD 928D F104 30C4 4A80 A8D2 4676

To claim this, I am signing this object:

@philippbosch
philippbosch / git-blast
Created November 30, 2016 14:24 — forked from wolever/git-blast
git-blast: show git branches sorted by last commit date
#!/usr/bin/env python
"""
Shows git branches sorted by last commit date, noting when branch has been
merged:
$ git blast
* master 33 minutes ago
david 4 days ago [M]
unholy-david-payments 4 days ago
handsontable-2 5 days ago