Skip to content

Instantly share code, notes, and snippets.

@p4ul
p4ul / CHANGELOG.md
Created May 5, 2020 02:16
standard commits test

Changelog

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

1.1.0 (2020-05-05)

Bug Fixes

  • works 6 7bbab1a
@p4ul
p4ul / scrape.js
Created March 29, 2020 22:30
country/region bounding box scraper
// go to https://nominatim.openstreetmap.org/search?q=waikato&format=json
// in chrome console paste this
const list = []
const countryRegion = [
'waikato, new zealand',
'perth, australia'
]
for(let i = 0; i < countryRegion.length; i++) {
const searchTerm = countryRegion[i]
@p4ul
p4ul / bookmarklet.js
Last active December 7, 2017 22:16
Identify jobs in returned data
/** copy and paste this in console (f12) after you have clicked log button on a device, tested on Calamp units **/
function checkLogs() {
var flag_type = {
"E":"Job on Working off",
"F":"Job on Working on",
"C":"Both off"
};
var data = $('#headunit_positions').text()
@p4ul
p4ul / test
Created August 15, 2014 03:07 — forked from anonymous/test
lkjlkjlkjlkj
@p4ul
p4ul / jiracount.user.js
Last active August 29, 2015 13:55
Adds "Stories finished this week" to top right of jira rapidboards
// ==UserScript==
// @name Jira Points
// @version 0.1.5
// @description adds issues done this week
// @match https://*.atlassian.net/secure/RapidBoard.jspa*
// ==/UserScript==
// a function that loads jQuery and calls a callback function when jQuery has finished loading
function addJQuery(callback) {
var script = document.createElement("script");
@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):
@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 / 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 / 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 / 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());
}