Skip to content

Instantly share code, notes, and snippets.

View Sitebase's full-sized avatar
🤘

Wim Mostmans Sitebase

🤘
View GitHub Profile
@Sitebase
Sitebase / gist:e68497ef7c4bad436385
Created December 9, 2014 09:25
Snippet for implementing video attach to a form with BuboBox
<div class="bbbx-widget" data-widget="11"></div>
<script type="text/javascript">
var bbbx_widget_id = 11;
var bbbx_visual = false;
var bbbx_share_enabled = false;
function bbbx_config() {
this.subscribe('published', function(e) {
BBBX.$('.bubobox_result').html('<a href="javascript:mybb.openPlayer(\'' + e.entryId + '\')">Video bekijken</a> | <a href="javascript:mybb.openRecorder()">Video opnieuw opnemen</a>');
BBBX.$('#video_id').val(e.entryId);
@Sitebase
Sitebase / code.php
Created December 2, 2014 11:18
Example of a very basic unit test in PHP
<?php
function sum( $number1, $number2 )
{
if( ! is_int( $number1 ) || ! is_int( $number2 ) )
throw new Exception( 'Both arguments should be numeric' );
return $number1 + $number2;
}
@Sitebase
Sitebase / gravatar.js
Created November 13, 2014 12:03
Little trick to check if a gravatar is available or not for a certain email address.
var http = require('http'),
md5 = require('MD5');
var options = {
method: 'HEAD',
host: 'www.gravatar.com',
port: 80,
path: '/avatar/' + md5('info@blabla.be') + '?d=http://bla.com'
};
var req = http.request(options, function(res) {
@Sitebase
Sitebase / bbbx-module-bootstrap.js
Created November 13, 2014 08:34
Bootstrap custom BuboBox front-end module
/**
* This is an example BBBX widget module
* It can be used to add additional functionallity to the BuboBox platform in a modularized way
*/
window.bbbx_modules = window.bbbx_modules || []; // Make modules array if not yet exists
window.bbbx_modules.push(function(sandbox, $) {
var NAME = 'custommodule';
var exports = {
@Sitebase
Sitebase / bbbx-login-stack.js
Last active August 29, 2015 14:09
Let users login with their custom account before they can submit an entry.
/**
* BuboBox form callback module
*
* @author Wim Mostmans (wim@bubobox.com)
* @license BSD
*
* Copyright (c) 2014 BuboBox
*/
window.bbbx_modules = window.bbbx_modules || []; // Make modules array if not yet exists
@Sitebase
Sitebase / bbbx-form-callback.js
Last active August 29, 2015 14:08
BuboBox Javascript module that will post the user submitted form data to your server.
/**
* BuboBox form callback module
*
* @author Wim Mostmans (wim@bubobox.com)
* @license BSD
*
* Copyright (c) 2014 BuboBox
*/
window.bbbx_modules = window.bbbx_modules || []; // Make modules array if not yet exists
window.bbbx_modules.push(function(sandbox, $) {
@Sitebase
Sitebase / module.js
Created October 7, 2014 08:39
Example of a custom JavaScript module for the BuboBox widget. This module will add an extra popup menu item with some custom text.
/**
* This is an example BBBX widget module
* It can be used to add additional functionallity to the BuboBox platform in a modularized way
*/
window.bbbx_modules = window.bbbx_modules || []; // Make modules array if not yet exists
window.bbbx_modules.push(function(sandbox, $) {
var NAME = 'custommodule';
/**
@Sitebase
Sitebase / cf-ddns.sh
Last active August 29, 2015 14:06 — forked from larrybolt/cf-ddns.sh
#!/bin/sh
# modified by jfro from http://www.cnysupport.com/index.php/linode-dynamic-dns-ddns-update-script
# Update: changed because the old IP-service wasn't working anymore
# Uses curl to be compatible with machines that don't have wget by default
# modified by Ross Hosman for use with cloudflare.
#
# Place at:
# /usr/local/bin/cf-ddns.sh
# if you're lazy (like me): curl https://gist.githubusercontent.com/Sitebase/8552675cb5401fb42791/raw/e646241fd4fc14a0736eab6b5422ba97a3c1d242/cf-ddns.sh > /usr/local/bin/cf-ddns.sh && chmod +x /usr/local/bin/cf-ddns.sh && vim /usr/local/bin/cf-ddns.sh
# run `crontab -e` and add next line:
@Sitebase
Sitebase / cf-ddns.sh
Last active August 29, 2015 14:06 — forked from larrybolt/cf-ddns.sh
#!/bin/sh
# modified by jfro from http://www.cnysupport.com/index.php/linode-dynamic-dns-ddns-update-script
# Update: changed because the old IP-service wasn't working anymore
# Uses curl to be compatible with machines that don't have wget by default
# modified by Ross Hosman for use with cloudflare.
#
# Place at:
# /usr/local/bin/cf-ddns.sh
# if you're lazy (like me): curl https://gist.githubusercontent.com/larrybolt/6295160/raw/9efbc7850613e06db1b415bdf4fbdd8361209865/cf-ddns.sh > /usr/local/bin/cf-ddns.sh && chmod +x /usr/local/bin/cf-ddns.sh && vim /usr/local/bin/cf-ddns.sh
# run `crontab -e` and add next line:
@Sitebase
Sitebase / run.sh
Created August 27, 2014 13:52
Script to generate all the different cover and icon sizes needed for an iPad app
# How to use:
# 1. Make sure you have a large version of the landscape cover and protrait cover and one large version of the icon
# 2. Put them in the same folder as this script, also add a dist folder, so the folder will look like:
# ipad-landscape.png
# ipad-portrait.png
# icon.png
# thisscript.sh
# dist
# 3. Now run thisscript.sh and the result will be available in the dist folder
log ()