Skip to content

Instantly share code, notes, and snippets.

rikukissa / .gitignore
Last active Dec 17, 2015
Darker theme for Shout. Has a bit more eye-friendly color scheme and hides some IMO unnecessary features such as "Leave" and "Submit" buttons.
patricksurry /
Last active Feb 6, 2018
Imitate hand-drawn (imperfect) circles using cubic Bézier segments

Imitate hand-drawn (imperfect) circles using cubic Bézier segments, based on a Bézier approximation to a perfect circle. TLDR: a good approximation to a quarter circle of unit radius is a cubic Bézier curve with control points P0 = (0,1), P1 = (c,1), P2 = (1,c), P3 = (1,0) where c = 0.551915024494. By varying the points in a sensible way, we can do a good impression of hand-drawn circles.

hasantayyar /
Created Jan 9, 2014
Solution if you are using dropbox and git same time and if you get this error "fatal: Reference has invalid format: refs/heads/master conflicted copy"
find . -type f -name "* conflicted copy*" -exec rm -f {} \;
awk '!/conflicted/' .git/packed-refs > temp && mv temp .git/packed-refs
hubgit /
Last active Jan 19, 2021
Remove metadata from a PDF file, using exiftool and qpdf. Note that embedded objects may still contain metadata.

Anonymising PDFs

PDF metadata

Metadata in PDF files can be stored in at least two places:

  • the Info Dictionary, a limited set of key/value pairs
  • XMP packets, which contain RDF statements expressed as XML

PDF files

View urbanspoon_reservations.rb
require 'rubygems'
require 'mechanize'
EMAIL = ''
SCHEDULE_RANGE = { :start_time => '19:00', :end_time => '20:30' }
leetrout / monokai.ksf
Created Apr 24, 2012
My Monokai Theme for Komodo Edit
View monokai.ksf
Version = 4
Booleans = {'caretLineVisible': True, 'preferFixed': True, 'useSelFore': True}
CommonStyles = {'attribute name': {'fore': 7872391},
'attribute value': {'fore': 3100463},
'bracebad': {'back': 65535, 'bold': 1, 'fore': 16777215},
'bracehighlight': {'bold': 1, 'fore': 16777215},
'classes': {'bold': True, 'fore': 3272098},
'comments': {'fore': 7301991, 'italic': 1},
cballou / get-ip-address-optimized.php
Created Mar 26, 2012
PHP - Advanced Method to Retrieve Client IP Address
View get-ip-address-optimized.php
function get_ip_address() {
foreach ($ip_keys as $key) {
if (array_key_exists($key, $_SERVER) === true) {
foreach (explode(',', $_SERVER[$key]) as $ip) {
// trim for safety measures
$ip = trim($ip);
// attempt to validate IP
if (validate_ip($ip)) {
gourneau / imagemagick_php_thumbnail.php
Created Nov 29, 2010
Create a thumbnail or resize an image with Imagemagick in PHP
View imagemagick_php_thumbnail.php
//Dynamically resize images
function thumb_create($file, $width , $height ) {
/*** the image file ***/
$image = $file;
/*** a new imagick object ***/