Skip to content

Instantly share code, notes, and snippets.

@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;
@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 / 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 / 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 / removelock.txt
Created February 13, 2015 08:21
Remove lock from multiple files in Mav OS X
chflags -R nouchg
@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 / 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 / openratio.json
Last active August 17, 2016 13:25
openratio.json
[{
"titel": "This is a title",
"description": "This is not a title",
"url": "https://www.google.se"
},{
"titel": "This is a new title",
"description": "This is not a new title",
"url": "https://www.microsoft.com"
}]
@tomasgreen
tomasgreen / accesstoken.json
Last active November 2, 2017 10:17
test accestoken
{
"accessToken":"nemuHiGezkQMMLgQigFmUvHkHaCd7tIrLcGSQwcxN2AbUpzeurIie1XOGtQhkraF",
"refreshToken":"jPv66wZnJVEugcYyrQtEi3GKRyCE6c7K",
"displayName": "Tomas Green",
"expires": "2017-06-21T15:29:32Z"
}
@tomasgreen
tomasgreen / vsts-testarticles.json
Last active June 8, 2018 12:05
VSTS testarticles
[{
"id": "1507B534-CA5F-4B6D-97D5-B5B5194710FE",
"title": "Nihil explicabo animi maiores necessitatibus et non eveniet.",
"body": "Dolorum illum voluptatem labore totam. Est aperiam est et hic. Autem in perspiciatis sed dolorem qui consectetur hic ut officia. Nisi aliquid alias et tempora vero. Fugiat et debitis consequatur officia consequatur iste facere impedit aut. Nihil illum commodi consequatur delectus commodi accusantium laboriosam in nihil.",
"created": "2018-03-15T17:03:27",
"user": {
"id": "492208F5-C6AB-4267-B8ED-8B2E57C3A2B2",
"name": "Autumn Pouros",
"email": "Dina_Fisher1@yahoo.com"
}