Skip to content

Instantly share code, notes, and snippets.

View victorjonsson's full-sized avatar
🎯
Focusing

Victor Jonsson victorjonsson

🎯
Focusing
View GitHub Profile
<div id="editable-area">
<p>
<em class="start-info">Double click on the text to edit</em>
<em class="edit-info" style="display: none">
Start typing to change the text
<span class="info mac">(cmd + &uarr; or cmd + &darr; to change font size)</span>
<span class="info windows">(ctrl + &uarr; or ctrl + &darr; to change font size)</span>
</em>
</p>
<div class="editable">
<?php
/**
* Class that manages all post meta attached to posts by my plugin. This class can be used as an
* ordinary PHP object (stdClass)
*
* @requires PHP version >= 5.1, WordPress version >= 1.6
* @package MyPlugin
* @since 0.1
*/
<?php
/**
* Class that contains all the options for my plugin. This class can be used as an
* ordinary PHP object (stdClass)
*
* @requires PHP version >= 5.1, WordPress version >= 1.6
* @package MyPlugin
* @since 0.1
*/
@victorjonsson
victorjonsson / jquery.editable.js
Last active October 12, 2015 04:58
jQuery plugin that makes any HTML element editable
This plugin has moved to
https://github.com/victorjonsson/jquery-editable
@victorjonsson
victorjonsson / php-composer-collection.txt
Created October 19, 2012 09:02
Collection of nice PHP modules (composer)
- Wide set of classes for encryption
https://github.com/phpseclib/phpseclib
- Image manipulation
https://github.com/Gregwar/ImageBundle
- CLI utilities
https://github.com/jlogsdon/php-cli-tools
@victorjonsson
victorjonsson / tinymce.js
Created August 8, 2012 17:38
listen to keypress within tinyMCE
tinyMCE.editors[0].onKeyPress.add(function(ed, e) {
alert(e.keyCode);
});
@victorjonsson
victorjonsson / bash-hax.sh
Last active October 8, 2015 00:09
nice to have bash commands (svn...)
# Delete all missing files (!)
$ svn rm $( svn status | sed -e '/^!/!d' -e 's/^!//' )
# grep all lines not starting with ?
$ ... | grep -v '^?'
# List large directories
$ sudo du -h / | grep ^[0-9.]*G
@victorjonsson
victorjonsson / form-example.html
Created July 21, 2012 07:22
jQuery Form Validator, example
<form action="" onsubmit="return $(this).validate()">
<p>
Name (4 characters minimum):
<input name="user" data-validation="validate_min_length length4" />
</p>
<p>
Birthdate (yyyy-mm-dd):
<input name="birth" data-validation="validate_birthdate" />
</p>
<p>
@victorjonsson
victorjonsson / pie-chart-count-down2.html
Created July 20, 2012 19:52
Pie chart count down example 2
<!DOCTYPE html>
<html>
<head>
<script src="js/jquery.min.js"></script>
<script src="js/jquery.piechartcountdown.min.js"></script>
</head>
<body>
<div id="counter"></div>
<a href="#" id="count-down-button">Count down</a>
<script type="text/javascript">
@victorjonsson
victorjonsson / pie-chart-count-down.html
Last active October 7, 2015 10:37
Pie chart count down example
...
<body>
<div id="counter"></div>
<a href="#" id="start-counter">Count down</a>
<script src="js/jquery.min.js"></script>
<script src="js/jquery.piechartcountdown.min.js"></script>
<script>
$('#start-counter').click(function() {