Skip to content

Instantly share code, notes, and snippets.

View victorjonsson's full-sized avatar
🎯
Focusing

Victor Jonsson victorjonsson

🎯
Focusing
View GitHub Profile
@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 / 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
<?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
*/
<?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
*/
<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">
// Make the element editable by double clicking on it
$('#some-element').editable();
// There are some options you can configure when initiating
// the editable feature as well as a callback function that
// will be called when textarea gets blurred.
$('#some-element').editable({
touch : true, // Whether or not to support touch (default true)
lineBreaks : true, // Whether or not to convert \n to <br /> (default true)
toggleFontSize : true, // Whether or not it should be possible to change font size (defualt true)
var mval = require('mval'),
MANIFEST = mval.MANIFEST;
// Validate android manifest file
var errors = mval.validate('AndroidManifest.xml', MANIFEST.ANDROID);
if( errors.length > 0 ) {
throw new Error('AndroidManifest.xml is invalid \n'+errors.join('\n'));
}
// You can of course also validate ordinary objects
@victorjonsson
victorjonsson / gist:6728599
Last active December 24, 2015 02:09
Tail -f but with PHP in a browser
<?php
error_reporting(E_ALL);
$file = '/var/log/fpm/fpm-php.log';
echo '<h5>'.$file.'</h5>';
$offset = filesize($file) - 80240;
if( $offset < 0 )
$offset = 0;
<script>
setWallPaperAd('URL-till-bild', 'URL-man-klickar', '#000000');
</script>
@victorjonsson
victorjonsson / arlima-inline-articles.php
Created February 27, 2014 08:14
arlima, inline-articles
<?php
$current_renderer = false;
// Always catch which renderer that is at work
add_action('arlima_list_begin', function($renderer) use($current_renderer) {
$current_renderer = $renderer;
});
// Move "children" into "inline-children" and create their template object