Skip to content

Instantly share code, notes, and snippets.

View alexweissman's full-sized avatar
💭
For the glory of the swarm

Alex Weissman alexweissman

💭
For the glory of the swarm
View GitHub Profile
var CryptoJS = require('crypto-js');
var timestamp = Date.now().valueOf();
var secret = pm.collectionVariables.get('secret');
var payload = pm.request.body.raw;
var signature = CryptoJS.HmacSHA256(timestamp + '.' + payload, secret);
pm.request.headers.add({
key: 'Stripe-Signature',
@slaveofcode
slaveofcode / Ranking.php
Created September 13, 2019 10:00 — forked from slogsdon/Ranking.php
Reddit Ranking Algorithms in PHP
<?php
/**
* Ranking Library
* contains alogrithms for story ranking
* Basically a PHP Implementation of reddits algorithms
*
* @author Lucas Nolte <lnolte@i.biz>
* @since 0.1
* @package Polska Wiadomosc
* @subpackage Libraries
<?php
public function clipGetVideo($request, $response, $args) {
$clipid = $args['clipid'];
$clip = GameClip::where('id', $clipid)->first();
$fh = fopen($clip->File, 'rb');
$stream = new \Slim\Http\Stream($fh);
@sdnts
sdnts / example.md
Last active January 10, 2023 20:50
Postman pm.sendRequest example

To send a request via the sandbox, you can use pm.sendRequest.

pm.test("Status code is 200", function () {
    pm.sendRequest('https://postman-echo.com/get', function (err, res) {
        pm.expect(err).to.not.be.ok;
        pm.expect(res).to.have.property('code', 200);
        pm.expect(res).to.have.property('status', 'OK');
    });
});
#!/bin/bash
sudo apt-add-repository -y ppa:ondrej/php
sudo apt-get update
sudo apt-get -y install apache2
sudo apt-get -y install php7.0
@alexweissman
alexweissman / BelongsToManyThrough.php
Last active May 12, 2023 07:58
Custom BelongsToManyThrough relationship for Laravel/Eloquent
<?php
/**
* UserFrosting (http://www.userfrosting.com)
*
* @link https://github.com/userfrosting/UserFrosting
* @copyright Copyright (c) 2013-2017 Alexander Weissman
* @license https://github.com/userfrosting/UserFrosting/blob/master/licenses/UserFrosting.md (MIT License)
*/
namespace UserFrosting\Sprinkle\Core\Model\Relations;
@alexweissman
alexweissman / README.md
Last active January 23, 2021 18:18
Migrating email accounts from a cPanel hosting environment to Mail-in-a-Box

Migrating email accounts from a cPanel hosting environment to Mail-in-a-Box

Part 1: Pregame

  1. Send a mass email to all of your account holders, letting them know that you will be migrating their email accounts to a new server. Send them the instructions from MiaB control panel for connecting to your MiaB server from their mobile/Outlook/Gmail/etc, if applicable. Also, send them a link to the new webmail address. Be sure to give adequate advanced notice (several days, if possible). Advise them to not change their passwords during this time (their passwords will be preserved during migration).
  2. Create a new "test" email account in the MiaB control panel for your domain. This will let MiaB set up the DNS records needed for the domain.

Part 2: Copy credentials

Copy the email account credentials from your cPanel host to MiaB:

@Jarred-Sumner
Jarred-Sumner / comcast.js
Last active September 7, 2022 01:30
Comcast injects this into webpages to show copyright notices
// Comcast Cable Communications, LLC Proprietary. Copyright 2014.
// Intended use is to display browser notifications for critical and time sensitive events.
var _ComcastAlert = (function(){
return {
SYS_URL: '/e8f6b078-0f35-11de-85c5-efc5ef23aa1f/aupm/notify.do'
, dragObj: {zIndex: 999999}
, browser: null
, comcastCheck: 1
, comcastTimer: null
, xmlhttp: null
@mindplay-dk
mindplay-dk / session-life-cycle.md
Last active March 28, 2024 19:52
Complete overview of the PHP SessionHandler life-cycle

This page provides a full overview of PHP's SessionHandler life-cycle - this was generated by a set of test-scripts, in order to provide an exact overview of when and what you can expect will be called in your custom SessionHandler implementation.

Each example is a separate script being run by a client with cookies enabled.

To the left, you can see the function being called in your script, and to the right, you can see the resulting calls being made to a custom session-handler registed using session_set_save_handler().

@guycalledseven
guycalledseven / osx_yosemite_disable_features.sh
Last active August 16, 2021 01:57
Disabling OSX Yosemite annoyances / features I have no use of
# Tested on OSX Yosemite 10.10.4
# there is also an updated version (work in progress) for El Capitan here https://gist.github.com/guycalledseven/31ffe35eca056838b06b
# XXX TODO
# should I disable com.google.Keystone.Agent ??
# http://applehelpwriter.com/2014/07/13/how-to-remove-googles-secret-update-software-from-your-mac/
# Stop DS_Store file creation on network connections
# restart Finder afterwards