Skip to content

Instantly share code, notes, and snippets.

@AVGP
AVGP / my-element.html
Last active May 4, 2023 14:05
A simple web component boilerplate
<template>
<style>
</style>
</template>
<script>
var Element = null;
(function(currentScript) {
var elemPrototype = Object.create(HTMLDivElement.prototype); // pick the appropriate prototype for your element!
@AVGP
AVGP / hg-prompt.bash
Last active October 26, 2015 13:02
Shell prompt that displays the current user, the working directory and the current mercurial bookmark.
DEFAULT="[0m"
PINK="[35m"
GREEN="[32m"
ORANGE="[33m"
hg_branch() {
BOOKMARK=`hg branch 2> /dev/null`
if [ -n "$BOOKMARK" ]; then
BOOKMARK="\e${DEFAULT} on \e${ORANGE}$BOOKMARK\e${DEFAULT}"
fi
@AVGP
AVGP / webcamtexture-script.js
Created February 1, 2015 16:13
Three.js livecoding arena - WebcamTexture
// Setup your scene here
var tex = null;
var mat = new THREE.MeshBasicMaterial({});
var box = new THREE.Mesh(
new THREE.BoxGeometry(100, 100, 100),
mat
);
window.THREE = THREE;
var script = document.createElement("script");
@AVGP
AVGP / app.js
Created January 21, 2015 18:31
Karma sample
// js/app.js
function add(a, b) {
return a+b;
}
function say(text) {
document.body.textContent = text;
}
@AVGP
AVGP / index.js
Created November 22, 2014 17:39
Demo of node.js SOAP client
var soap = require("soap");
soap.createClient("http://www.w3schools.com/webservices/tempconvert.asmx?WSDL", function(err, client) {
if(err) {
console.error("Can't create client", err);
return;
}
client.CelsiusToFahrenheit({Celsius: "25"}, function(err, result) {
if(err) {
console.error("Can't call method", err);
@AVGP
AVGP / ar_heading.js
Created November 20, 2014 14:27
Handy function to get the difference between target heading and current heading
function getAngle(currentHeading, target) {
if(currentHeading > 180) {
target += 360;
}
return Math.abs(currentHeading - target);
}
@AVGP
AVGP / apotd.go
Created September 25, 2014 08:29
Agile Principle of the day - simple HTTP quote service
package main
import(
"fmt"
"math/rand"
"time"
"net/http"
)
func main() {
@AVGP
AVGP / designer.html
Created August 27, 2014 16:21
designer
<link rel="import" href="../paper-tabs/paper-tabs.html">
<link rel="import" href="../paper-tabs/paper-tab.html">
<link rel="import" href="../paper-button/paper-button.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
### Keybase proof
I hereby claim:
* I am avgp on github.
* I am g33konaut (https://keybase.io/g33konaut) on keybase.
* I have a public key whose fingerprint is C6C5 0090 A5BD DA3A BA52 26DA 78C5 C26F 75B1 EB5E
To claim this, I am signing this object:
@AVGP
AVGP / mkleeenux.bash
Created January 6, 2014 07:05
Creating a debian image for the EEE pc
#!/bin/bash
mkdir leeenux
cd leeenux
lb config --packages "openssh-client acpid acpi cpufrequtils pm-utils eeepc-acpi-scripts git-core vim gcc g++ libstdc++6 wpasupplicant xserver-xorg xserver-xorg-input-synaptics xserver-xorg-video-intel xserver-xorg-video-fbdev libgl1-mesa-dri pciutils firmware-iwlwifi firmware-atheros linux-sound-base alsa-base alsa-utils xfce4 xfce4-terminal xfce4-mixer xinit wireless-tools dhcpcd locate x11-xserver-utils gajim chromium-browser openoffice.org luvcview vlc okular xtightvncviewer netbeans-ide" --hostname moon --binary-images usb-hdd --bootappend-live "acpi_osi=Linux nomodeset locales=de_DE.UTF-8 keyboard-layouts=de" --apt-recommends false --binary-indices false --language de --distribution squeeze --archive-areas "main contrib non-free"
echo "deb http://ftp.debian.org/debian/ squeeze main contrib non-free" >> config/chroot_sources/full.chroot
echo "deb-src http://ftp.debian.org/debian/ squeeze main contrib non-free" >> config/chroot_sources/full.chroot
mkdir -p config/chr