Skip to content

Instantly share code, notes, and snippets.

Avatar

Philipp Bosch philippbosch

View GitHub Profile
View README.html
<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 Dec 28, 2021
Sine in JS and in Processing
View sine.js
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 Apr 16, 2013
sprintf() in Arduino code
View sprintf.ino
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 Aug 9, 2011
Saving raw POST data to a file field in Django
View raw_post_data_file_field.py
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 Aug 29, 2019
Compass mixins for CSS keyframe animations
View _animations.scss
@import "compass/css3/shared";
@mixin keyframes($name) {
@-webkit-keyframes $name {
@content;
}
@-moz-keyframes $name {
@content;
}
@philippbosch
philippbosch / Dockerfile
Last active Jul 21, 2019
Django Dockerfile
View 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
View pr_review_requests.1m.sh
#!/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 Jul 19, 2010
image-less RGBA backgrounds for real browsers and Internet Explorer
View cross-browser-rgba-mixin.scss
@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;
}
View keybase.md

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 Nov 30, 2016 — forked from wolever/git-blast
git-blast: show git branches sorted by last commit date
View git-blast
#!/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