Skip to content

Instantly share code, notes, and snippets.

View bernii's full-sized avatar

Bernard Kobos bernii

View GitHub Profile
@kahlil
kahlil / gradient-triangles.css
Created September 16, 2010 10:09
Ingenius solution to create a CSS triangle with a gradient.
/* Code is by A.J. Cates (http://ajcates.com). Find his post here: http://forr.st/~XGU */
#gradient-triangle {
width: 60px;
height: 60px;
position: absolute;
top: 3em;
left: -30px;
clip: rect(auto 30px 60px auto);
}
@ekarulf
ekarulf / code128.py
Created November 16, 2010 04:25
Code128 Python Generator (Uses PIL)
#!/usr/bin/env python
# Copyright (c) 2010 Erik Karulf (erik@karulf.com)
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
@bernii
bernii / sauce-qunit-example.js
Last active December 13, 2015 16:59
Example code using WD.js and QUnit with Sauce Labs
// You need to have the following installed:
// https://github.com/admc/wd
// https://github.com/kriskowal/q
var wd = require('wd')
, Q = require('q')
, request = require('request')
, assert = require('assert')
, host = "ondemand.saucelabs.com"
, port = 80
@bernii
bernii / sauce-jasmine-example.js
Last active December 13, 2015 16:58
Example code using WD.js and Jasmine with Sauce Labs
// You need to have the following installed:
// https://github.com/admc/wd
// https://github.com/kriskowal/q
var wd = require('wd')
, Q = require('q')
, request = require('request')
, assert = require('assert')
, host = "ondemand.saucelabs.com"
, port = 80
@tevino
tevino / fix_virtualenv
Last active March 24, 2024 09:41
Fix python virtualenv after python update
#!/usr/bin/env bash
ENV_PATH="$(dirname "$(dirname "$(which pip)")")"
SYSTEM_VIRTUALENV="$(which -a virtualenv|tail -1)"
BAD_ENV_PATHS="/usr/local"
echo "Ensure the root of the broken virtualenv:"
echo " $ENV_PATH"
@postmodern
postmodern / tcp_client.rs
Last active May 20, 2022 16:01
TCP Client in Rust
#![allow(unused_variables)]
#![allow(unused_imports)]
use std::env;
use std::process;
use std::thread;
use std::io::{self, Read, Write, Error};
use std::net::TcpStream;
use std::net::TcpListener;
@barraponto
barraponto / idletime.js
Last active April 3, 2024 11:17
ES6+ event-based browser idle timer.
const DOCUMENT_EVENTS = [
'mousemove', 'mousedown', 'click',
'touchmove', 'touchstart', 'touchend',
'keydown', 'keypress'
];
export class IdleTimer {
constructor(onIdleTimeout, timeout) {
this.onIdleTimeout = onIdleTimeout;
this.timeout = timeout;