Skip to content

Instantly share code, notes, and snippets.

View hypeJunction's full-sized avatar

Ismayil Khayredinov hypeJunction

View GitHub Profile
@hypeJunction
hypeJunction / paypal_standards_suck.php
Last active August 29, 2015 14:26
Working with PayPal IPN's malformatted multidimensional arrays
<?php
use PayPal\IPN\PPIPNMessage;
$postData = file_get_contents('php://input');
$ipn = new PPIPNMessage($postData);
if (!$ipn->validate()) {
exit;
@hypeJunction
hypeJunction / 1_phpunit-api.md
Created July 22, 2016 10:15 — forked from loonies/1_phpunit-api.md
PHPUnit Cheat Sheet

PHPUnit API reference

  • version 3.6

TODO

Check those constraints:

$this-&gt;anything()
@hypeJunction
hypeJunction / start.php
Last active July 28, 2016 10:47
Add Friends Of ACL to Elgg access levels
<?php
/**
* Define a new access level to allow owners to save content visible to those who added them as a friend,
* as oppose to Friends access level, which shows content to users that have been added as friends by the owner
*
* Note that Elgg friendships are not reciprocal by default
*
* @author Ismayil Khayredinov <info@hypejunction.com>
* @copyright 2016 (c) Ismayil Khayredinov
@hypeJunction
hypeJunction / start.php
Created December 26, 2016 14:55
Bulk replace language strings in Elgg
<?php
elgg_register_event_handler('upgrade', 'system', 'build_language_file', 999);
/**
* Rename:
* - Friends > Contacts
*
* @global array $GLOBALS
*/
@hypeJunction
hypeJunction / blog.php
Last active April 24, 2017 13:14
Video player in blog summary with hypeEmbed
<?php
// /views/default/object/blog.php
// brief view
preg_match_all("/\[player.*?\]/", $blog->description, $matches);
$embed = elgg_view('output/longtext', [
'value' => $matches[0][0],
]);
@hypeJunction
hypeJunction / homestead-serve-elgg.sh
Created July 21, 2017 12:15
Elgg NGINX vhost config for Homestead
#!/usr/bin/env bash
declare -A params=$5 # Create an associative array
paramsTXT=""
if [ -n "$5" ]; then
for element in "${!params[@]}"
do
paramsTXT="${paramsTXT}
fastcgi_param ${element} ${params[$element]};"
done
fi
@hypeJunction
hypeJunction / refund.php
Last active June 26, 2023 02:58
Stripe Subscription Cancellation and Prorated Refund
<?php
class StripeSubscriptionHandler {
/**
* Cancel a Stripe subscription, optionally prorating and refunding the unused amount
*
* @param string $id Stripe Subscription ID
* @param bool $at_period_end Type of cancellation
* If set to true, will cancel the subscription at its end
@hypeJunction
hypeJunction / README.md
Last active May 26, 2023 18:16
NOAA NCEI Web Services Taxonomies

NCDC Climate Data Online National Centers for Environmental Information Web Services https://www.ncdc.noaa.gov/cdo-web/webservices

Web services wouldn't let me find locations or look up taxonomies by name, so I created my own mappings.

@hypeJunction
hypeJunction / README.md
Created April 23, 2018 10:38
Elgg project management

The easiest way to install and manage your Elgg project

Step 1. Install Composer

https://getcomposer.org/download/

Step 2. Intall Elgg as a Composer Project

composer self-update
@hypeJunction
hypeJunction / temper.js
Created January 4, 2019 09:32
Vuetify Custom Input Example
import VTextField from 'vuetify/lib/components/VTextField/VTextField';
import VRating from 'vuetify/lib/components/VRating/VRating';
import { convertToUnit } from 'vuetify/lib/util/helpers';
export default {
name: 'input-temper',
extends: VTextField,
props: {