Skip to content

Instantly share code, notes, and snippets.

View paveljurca's full-sized avatar
🎯
Focusing

Pavel paveljurca

🎯
Focusing
View GitHub Profile
@schacon
schacon / example_gist_create.rb
Created August 6, 2008 20:29
gist example api post
require 'net/http'
require 'uri'
# /api/v1/:format/new
# /api/v1/:format/gists/:user
# /api/v1/:format/:gist_id
res = Net::HTTP.post_form(URI.parse('http://gist.github.com/api/v1/xml/new'),
{ 'files[file1.ab]' => 'CONTNETS',
'files[file2.ab]' => 'contents' })
@tmtysk
tmtysk / mediarssgen.rb
Created October 15, 2009 08:37
Creating simple "Media RSS (http://video.search.yahoo.com/mrss)" from jpegs in specified directories and uri.
# mediarssgen.rb
# Creating simple "Media RSS (http://video.search.yahoo.com/mrss)"
# from jpegs in specified directories and uri.
#
# Usage: $ ruby mediarssgen.rb <thumbnail_dir> <image_dir> <uri_root>
require 'rubygems'
require 'libxml'
include LibXML
@defunkt
defunkt / gist:284823
Created January 23, 2010 22:09
Why to not use hub with RubyGems
# No RubyGems
$ time hub version
git version 1.6.0
hub version 0.2.0
real 0m0.047s
user 0m0.015s
sys 0m0.028s
# With RubyGems
use Getopt::Long;
use Data::Dumper;
use Locale::gettext;
use POSIX();
use Math::Trig;
use IO::File;
use Time::HiRes qw(gettimeofday);
use SDL;
use SDL::App;
@isaacs
isaacs / comma-first-var.js
Created April 6, 2010 19:24
A better coding convention for lists and object literals in JavaScript
// See comments below.
// This code sample and justification brought to you by
// Isaac Z. Schlueter, aka isaacs
// standard style
var a = "ape",
b = "bat",
c = "cat",
d = "dog",
"""Retrieve the weather forecast for the current location."""
__author__ = 'Rupert Plumridge <[email protected]>'
__copyright__ = 'Copyleft (c) 2010, The World.'
__license__ = 'Creative Commons Attribution-Non-Commercial-Share Alike 3.0 Unported Licence'
# based on the weather.py script by T.V. Raman <[email protected]>,from Google, from the ASE Python script examples
import urllib2, re
#!/bin/bash
#updated ffmpeg progress indicator
#by Rupert Plumridge
#for updates visit www.prupert.co.uk
#Creative Commons Attribution-Non-Commercial-Share Alike 2.0 UK: England & Wales Licence
# Based on the ffmpegprogress bar from: http://handybashscripts.blogspot.com/2011/01/ffmpeg-with-progress-bar-re-work.html
# which was based on my initital progress script - circle of life and all that ;)
# version 2.0
# 07.04.2011
# now uses apparently better progress detection, based on duration of overall video and progress along the conversion
/*
The below work is licensed under Creative Commons GNU LGPL License.
Original work:
License: http://creativecommons.org/licenses/LGPL/2.1/
Author: Stefan Goessner/2006
Web: http://goessner.net/
Modifications made:
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active April 14, 2025 11:07
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@cowboy
cowboy / HEY-YOU.md
Last active February 27, 2025 12:24
jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery.