Skip to content

Instantly share code, notes, and snippets.

@p4ul
p4ul / teamviewer.bat
Created October 12, 2011 22:25
use this with my teamviewer:// protocol hander
@echo off
REM place this in C:\ and install teamviewer.reg below. Then you should be able to
REM openteamviewers from the webbrowser with teamviewer://1234
set protocolString=%1
REM uncomment below for testing
REM set protocolString="teamviewer://795143153"
set protocolString=%protocolString:"=%
@p4ul
p4ul / gist:1896018
Created February 24, 2012 00:15 — forked from adamsilver/gist:701596
Qunit 'raises' assertion for JsTestDriver adapter
window.raises = function(fn, msg) {
try {
fn();
ok(false, msg ? msg : '')
} catch(e) {
ok(e.name === "AssertError" ? false : true, msg ? msg : '');
}
};
@p4ul
p4ul / mimeapps.list
Created May 3, 2012 02:34 — forked from marfillaster/mimeapps.list
Sublime Text ubuntu xdebug url handler
#~/.local/share/applications/mimeapps.list
[Added Associations]
#...
x-scheme-handler/subl=subl-urlhandler.desktop
@p4ul
p4ul / jquery.ba-tinypubsub.js
Created May 29, 2012 05:17 — forked from cowboy/HEY-YOU.md
jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery.
/* jQuery Tiny Pub/Sub - v0.7 - 10/27/2011
* http://benalman.com/
* Copyright (c) 2011 "Cowboy" Ben Alman; Licensed MIT, GPL */
(function($) {
var o = $({});
$.subscribe = function() {
o.on.apply(o, arguments);
@p4ul
p4ul / gist:2956382
Created June 19, 2012 20:34
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
@p4ul
p4ul / trello.js
Created July 15, 2012 23:21
JS Clips for trello
/**
sum everything in format ($100) for list one
**/
var sum = 0;
$('.list:eq(0) .list-card-title').each(function(d,v){
matches = $(v).text().match(/([0-9]+)(?=\))/);
if(matches !== null) {
sum += parseInt(matches.pop());
}
@p4ul
p4ul / getupdates.sh
Created January 22, 2013 23:20
check svn for updates and get formatted text for redmine broadcast
echo -e "Files to change:\n" \
&& svn st -u | grep -v ? \
&& echo -e "\nChange Log:\n" \
&& svn log -r BASE:HEAD | grep -v -e '^\-\|^$\|^r[0-9].'| sort -u | awk '{print "* " $0}'
@p4ul
p4ul / upme.php
Last active December 11, 2015 22:18
This is a script that will update a Drupal site from git (github), clear the cache and send a deployment notice to New Relic. This can be called from github service hooks, CI server or browser. This is not recommended for a production environment unless you add some security / firewall rules etc.
<pre>
<?php
/**
Modify the capitalised variables with your info.
Call this from your github webservice hook / CI server.
If you are not using new relic you need to remove that cruft.
(the last 3 lines)
@p4ul
p4ul / pull-updates.php
Created August 14, 2013 06:50
quick in dirty self updater for use with github webhooks
<pre>
<?php
// ---------------------- CONFIG DETAILS ----------------------
//branch in git
$BRANCH = 'master';
// --------- You should not need to edit below here ------------
$current_sha1 = `git rev-parse $BRANCH`;
$status_of_branch = `git ls-remote origin -h refs/heads/$BRANCH`;
@p4ul
p4ul / avg_line_length.py
Created November 6, 2013 07:12
Gets the average lines of code for each file type. Execute this script in the console under a directory that contains your code and it will output a table that lists lines of code for each file type. There is some basic skipping of things like minified files and images. Requires textable (https://pypi.python.org/pypi/texttable) install via `pip …
#!/usr/bin/python
import texttable as tt
import fnmatch
import os
import operator
from collections import Counter
import mimetypes
def file_len(fname):