Skip to content

Instantly share code, notes, and snippets.

View Llewellynvdm's full-sized avatar
🏗️
Working on Joomla Component Builder

<<eWɘ>>yn Llewellynvdm

🏗️
Working on Joomla Component Builder
View GitHub Profile
@Llewellynvdm
Llewellynvdm / gist:e1e03371b07524fce72d
Last active March 8, 2016 09:30
Moving data from JMS Music to Sermon Distributor
class Moving extends JModelList
{
public function getData()
{
// start up the DB
$db = JFactory::getDBO();
// move the preachers
$this->movePreachers($db);
// move Series
$this->moveSeries($db);
@Llewellynvdm
Llewellynvdm / getBiblejQueryScript
Last active July 22, 2023 11:15
Here is a jQuery script to make an API call from your own application
jQuery.ajax({
url:'https://archived.getbible.net/json',
dataType: 'jsonp',
data: 'p=John1&v=kjv',
jsonp: 'getbible',
success:function(json){
// set text direction
if (json.direction == 'RTL'){
var direction = 'rtl';
} else {
@Llewellynvdm
Llewellynvdm / curl.md
Created June 15, 2017 17:34 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@Llewellynvdm
Llewellynvdm / id_rsa_encryption.md
Created July 4, 2017 12:52
Encrypt/Decrypt a File using your SSH Public/Private Key on Mac OS X

A Guide to Encrypting Files with Mac OS X

This guide will demonstrate the steps required to encrypt and decrypt files using OpenSSL on Mac OS X. The working assumption is that by demonstrating how to encrypt a file with your own public key, you'll also be able to encrypt a file you plan to send to somebody else using their private key, though you may wish to use this approach to keep archived data safe from prying eyes.

Too Long, Didn't Read

Assuming you've already done the setup described later in this document, that id_rsa.pub.pcks8 is the public key you want to use, that id_rsa is the private key the recipient will use, and secret.txt is the data you want to transmit…

Encrypting

$ openssl rand 192 -out key

$ openssl aes-256-cbc -in secret.txt -out secret.txt.enc -pass file:key

@Llewellynvdm
Llewellynvdm / Requests.php
Created August 6, 2017 20:30 — forked from xeoncross/Requests.php
cURL asynchronous requests using curl_multi and callbacks
<?php
/**
* Make asynchronous requests to different resources as fast as possible and process the results as they are ready.
*/
class Requests
{
public $handle;
public function __construct()
{
@Llewellynvdm
Llewellynvdm / fancyDate.txt
Last active March 2, 2018 02:36
fancyDate
/**
* Change to nice fancy date (change was made)
*/
public static function fancyDate($date)
{
if (!self::isValidTimeStamp($date))
{
$date = strtotime($date);
}
return date('jS \o\f F Y',$date);
@Llewellynvdm
Llewellynvdm / explanation.md
Created February 4, 2018 00:18 — forked from masak/explanation.md
How is git commit sha1 formed

Ok, I geeked out, and this is probably more information than you need. But it completely answers the question. Sorry. ☺

Locally, I'm at this commit:

$ git show
commit d6cd1e2bd19e03a81132a23b2025920577f84e37
Author: jnthn <jnthn@jnthn.net>
Date:   Sun Apr 15 16:35:03 2012 +0200

When I added FIRST/NEXT/LAST, it was idiomatic but not quite so fast. This makes it faster. Another little bit of masak++'s program.

@Llewellynvdm
Llewellynvdm / .gitignore
Last active May 30, 2022 13:49 — forked from mrkmg/file_extension_to_mimetype.php
File Extension to Mimetype
.idea
@Llewellynvdm
Llewellynvdm / display.js
Last active February 3, 2022 16:46
Upload Script
// see if we have a banner
<?php if (isset($this->item->banner) && [[[Component]]]Helper::checkString($this->item->banner)) : ?>
jQuery('<img src="<?php echo $this->item->banner; ?>" class="your-class-banner" alt="banner">').insertAfter(jQuery('#jform_banner').closest('.control-group'));
<?php endif; ?>
@Llewellynvdm
Llewellynvdm / CustomScriptDocument.php
Created April 6, 2018 07:33
Drag and Drop Upload functionality in JCB
// load the links on the page
$document->addScriptDeclaration("var documentsLinks = " . json_encode($this->item->links) . ";");