Skip to content

Instantly share code, notes, and snippets.

@elpuri
elpuri / Button.qml
Created December 28, 2010 19:36
A button component in QML
import Qt 4.7
BorderImage {
id: buttonbase
signal clicked
property int hitboxExtension : 20
property alias text : label.text
property bool pressed: hitbox.pressed && hitbox.containsMouse
@mattbriancon
mattbriancon / DetectBufferTimeout.java
Created April 12, 2011 19:05
Spin up a thread to check whether MediaPlayer is buffering smoothly
boolean hasUpdated = false;
boolean doneBuffering = false;
long bufferTimeout = 500;
// put this somewhere smart
new Thread(new Runnable() {
public void run() {
while(!doneBuffering) {
Thread.sleep(bufferTimeout);
@addyosmani
addyosmani / pubsub.md
Created October 28, 2011 06:49
Four ways to do Pub/Sub with jQuery 1.7 and jQuery UI (in the future)

#Four Ways To Do Pub/Sub With jQuery and jQuery UI (in the future)

Between jQuery 1.7 and some of work going into future versions of jQuery UI, there are a ton of hot new ways for you to get your publish/subscribe on. Here are just four of them, three of which are new.

(PS: If you're unfamiliar with pub/sub, read the guide to it that Julian Aubourg and I wrote here http://msdn.microsoft.com/en-us/scriptjunkie/hh201955.aspx)

##Option 1: Using jQuery 1.7's $.Callbacks() feature:

$.Callbacks are a multi-purpose callbacks list object which can be used as a base layer to build new functionality including simple publish/subscribe systems. We haven't yet released the API documentation for this feature just yet, but for more information on it (including lots of examples), see my post on $.Callbacks() here:

@milankorsos
milankorsos / debug.js
Created November 24, 2011 16:05
define cookie controlled custom outputs for your modules
//Use $.cookie('quickbrowse-debug', true, {expires: 7, path: '/'}) to set.
// ... and $.cookie('quickbrowse-debug', null) to delete.
var qbConsole;
if(!$.cookie('quickbrowse-debug')) {
qbConsole = {};
qbConsole.log = function(){};
} else {
qbConsole = console;
}
@ryandotsmith
ryandotsmith / a-backbone-js-demo-app-sinatra-backend.md
Created January 22, 2012 01:42
Backbone demo app with sinatra backend

A Backbone.js demo app (Sinatra Backend)

Oct 16 2010

Updates

  • 04/10/2011 - Updated application.js and application.rb thanks to @rebo's comments

In this article, I will walk through some simple steps to get a [demo app][2] up and running with [Backbone.js][3] and [Sinatra][4] on [Heroku][5].

@pviojo
pviojo / <domain>.conf
Created June 14, 2012 00:04
Nginx conf. Wordpress blog in a subdirectory (/blog)
server {
listen 80;
server_name <domain>
server_name_in_redirect off;
access_log logs/<domain>.access.log;
error_log logs/<domain>.error.log;
gzip_static on;
@wangii
wangii / hack.sh
Created June 18, 2012 00:37 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@lukecanvin
lukecanvin / backbone.localCache.js
Created July 20, 2012 08:56
Online/offline syncing for Backbone
Backbone.serverSync = Backbone.sync;
Backbone.pingUrl = '/Ping';
Backbone.localID = function() {
var localID = (localStorage.localID ? parseInt(localStorage.localID) : 0);
localID++;
localStorage.localID = localID.toString()
return -localID;
}
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active November 5, 2024 18:44
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@zoellner
zoellner / grideye.ino
Last active September 23, 2017 12:22
Grideye demo for Grid-EYE Evaluation Unit with COM-00759 RG LED Array (8x8). based on http://pewa.panasonic.com/assets/pcsd/manuals/grid-eye/grid-eye-arduino-code-examples.pdf . corrected errors in original code. Now using SPI library and serial output of data
#include <Wire.h>
#include <SPI.h>
//define our colors for LED Array
#define GREEN 0x01
#define RED 0x02
#define ORANGE 0x03
//define the SPI pins for the LED Array
#define SLAVESELECT 10//ss
char ledArray [64];
byte pixelTempL;