Skip to content

Instantly share code, notes, and snippets.

@tomasgreen
tomasgreen / timechanger.php
Last active August 29, 2015 14:19
Change time and move photos to folder by device
<?php
date_default_timezone_set('Europe/Stockholm');
if ($handle = opendir('./')) {
echo "Directory handle: $handle\n";
echo "Entries:\n";
while (false !== ($entry = readdir($handle)))
{
$ext = strtolower(pathinfo($entry, PATHINFO_EXTENSION));
if($ext == "jpg" || $ext == "jpeg")
{
@tomasgreen
tomasgreen / jsondb.js
Last active August 29, 2015 14:16
Simple json database
'use strict';
/**
* Author: Tomas Green
* License: MIT
*/
/*
Using the database:
@tomasgreen
tomasgreen / removelock.txt
Created February 13, 2015 08:21
Remove lock from multiple files in Mav OS X
chflags -R nouchg
@tomasgreen
tomasgreen / findtrailing.txt
Last active August 29, 2015 14:11
Detect trailing commas in javascript
We can all agree that trailing commas in IE7 is a drag. The solutions I've found invovles some kind of automatic removal which feels a little over the top. So I've decived to go the easy way.
This regex can be used with the find function in your text editor. So simple and within your control.
,(\n|\s*)+(\s*\/\/.*\n)*\s*[\}\)\]]
@tomasgreen
tomasgreen / spinv2.svg
Created September 22, 2014 16:41
Animated SVG spinner "ala loading".
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tomasgreen
tomasgreen / spin.svg
Created September 22, 2014 15:11
spin.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tomasgreen
tomasgreen / jquery.flexHeight.js
Last active August 29, 2015 13:56
Simple jquery script enabling flexible textarea height
(function ($) {
/* Simple jquery script enabling flexible textarea height. This seems to actually work and doens't require anything more than... this */
$.fn.flexHeight = function () {
var $obj = $(this);
if (!$obj.length) {
return;
}
if ($obj.attr('flexHeightInitialized')) {
$obj.trigger('propertychange');
return;