Skip to content

Instantly share code, notes, and snippets.

CreatePageAction

<?php
use MBITEL\Confluence\EditorActions\CreatePageAction;

$cPager = new CreatePageAction($confluenceClient);
$cPager->createPage($rootPageId);
$cPager->setTextarea($html);
$cPager->setTitle($pageTitle);

The Basics

Anonymous Closures

(function () {
	// ... all vars and functions are in this scope only
	// still maintains access to all globals
}());
import java.io.IOException;
import java.net.URL;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import org.json.*;
import org.openqa.selenium.*;
import org.openqa.selenium.chrome.*;
import org.openqa.selenium.logging.*;
['log', 'warn'].forEach(function(method) {
var old = console[method];
console[method] = function() {
var stack = (new Error()).stack.split(/\n/);
// Chrome includes a single "Error" line, FF doesn't.
if (stack[0].indexOf('Error') === 0) {
stack = stack.slice(1);
}
var args = [].slice.apply(arguments).concat([stack[1].trim()]);
return old.apply(console, args);
/*
* This decorates Handlebars.js with the ability to load
* templates from an external source, with light caching.
*
* To render a template, pass a closure that will receive the
* template as a function parameter, eg,
* T.render('templateName', function(t) {
* $('#somediv').html( t() );
* });
* Source: https://github.com/wycats/handlebars.js/issues/82
@r-sal
r-sal / notes.md
Last active August 29, 2015 14:00

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert $1 -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 $2

Results

@r-sal
r-sal / detecting-duplicate-images-using-python.md
Created April 3, 2014 12:55
detecting-duplicate-images-using-python
#resultswrapper {
}
.stats-wrap {
float: right;
margin-top: 5px;
}
.btn {
display: inline-block;