Skip to content

Instantly share code, notes, and snippets.

View ahmetvurgun's full-sized avatar

Ahmet Vurgun ahmetvurgun

View GitHub Profile
@vermilion1
vermilion1 / timer.js
Created August 21, 2014 17:44
Advanced timer with ability to pause/resume the callback
/**
* Advanced timer with ability to pause/resume the callback.
* @param {function} callback - Callback to be executed after some delay.
* @param {number} delay - Delay.
* @returns {Object} Timer object with useful methods.
*/
var timer = function (callback, delay) {
var isPaused = true;
var timer, start, clear, pause, resume;
# YOU NEED TO INSERT YOUR APP KEY AND SECRET BELOW!
# Go to dropbox.com/developers/apps to create an app.
app_key = 'YOUR_APP_KEY'
app_secret = 'YOUR_APP_SECRET'
# access_type can be 'app_folder' or 'dropbox', depending on
# how you registered your app.
access_type = 'app_folder'
@shohei
shohei / cam.py
Created April 25, 2013 06:32
from MIT
#
# cam.py
#
# usage: python cam.py [infile] [xoffset yoffset] [display size] [outfile] [undercut]
#
# input:
# *.dxf: DXF (polylines)
# *.cmp,*.sol,*.plc: Gerber
# RS-274X format, with 0-width trace defining board boundary
# *.drl: Excellon drill file, with tool defitions
@marvin
marvin / client.py
Created December 17, 2012 13:50
simple python client/server socket binary stream
import socket
HOST = 'localhost'
PORT = 9876
ADDR = (HOST,PORT)
BUFSIZE = 4096
videofile = "videos/royalty-free_footage_wien_18_640x360.mp4"
bytes = open(videofile).read()
@beaspider
beaspider / lazyload.js
Created December 6, 2012 15:41
lazy load js
// can be used for JSONP calls too
var loadScript = function(url, callback) {
var script = document.createElement('script');
script.setAttribute('src', url);
script.setAttribute("type","text/javascript");
script.setAttribute('async', true);
// wait for script to load
var onLoaded = function(script,callback) {
return function() {
// remove the script
@zhchbin
zhchbin / index.html
Created November 30, 2012 02:09
Node-webkit hotkey api proposal
<!DOCTYPE>
<html>
<head>
<title>Hotkey Demo</title>
<script type="text/javascript" src='keymap.js'></script>
<script type="text/javascript">
function log(message) {
document.getElementById('log').textContent += message + '\n';
}
var gui = require('nw.gui');
@daneden
daneden / dabblet.css
Created October 10, 2012 09:26
CSS Photo Album
/* CSS Photo Album */
/* Rebound of this shot by @daryl: http://drbl.in/fwwM */
* {
margin: 0;
padding: 0;
position: relative;
box-sizing: border-box;
}
@noonien
noonien / async_loader.js
Created July 16, 2012 17:36
Asynchronous Javascript/CSS loader.
AL = function(type, url, callback) {
var el, doc = document;
switch(type) {
case 'js':
el = doc.createElement('script');
el.src = url;
break;
case 'css':
el = doc.createElement('link');
@yorikvanhavre
yorikvanhavre / pyjs.py
Created April 9, 2012 00:30
call pyqt4 stuff from javascript
import sys
from PyQt4 import QtCore, QtGui, QtWebKit
import WebGui
"""Html snippet."""
html = """
<html><body>
<center>
<script language="JavaScript">
document.write('<p>Python ' + pyObj.pyVersion + '</p>')
@gabrielgilini
gabrielgilini / xhr.js
Created September 22, 2011 13:53
Simple XMLHttpRequest example
(function()
{
var global = this;
var createXmlHttpRequest = (function()
{
var i,
fs = [// for legacy eg. IE 5
function()
{