Skip to content

Instantly share code, notes, and snippets.

View nightillusions's full-sized avatar
🌎
Remote Work

Pascal Jordin nightillusions

🌎
Remote Work
View GitHub Profile
@nightillusions
nightillusions / register-post-type.php
Created May 16, 2017 09:56 — forked from justintadlock/register-post-type.php
Help file when registering post types.
<?php
# Register custom post types on the 'init' hook.
add_action( 'init', 'my_register_post_types' );
/**
* Registers post types needed by the plugin.
*
* @since 1.0.0
* @access public
@nightillusions
nightillusions / facebook-auth.php
Last active February 14, 2018 18:54
Little class to handle Facebook API authentification with the PHP-SDK
<?php
require './vendor/autoload.php';
use Facebook\Facebook;
use Facebook\Exceptions\FacebookResponseException;
use Facebook\Exceptions\FacebookSDKException;
define( 'FB_GROUP_APP_BASE_URL', 'https://wdj.ac' );
define( 'FB_GROUP_APP_CALLBACK_URL', FB_GROUP_APP_BASE_URL . '/facebook-auth.php?action=verify-user' );
define( 'FB_GROUP_APP_ID', '' );
@nightillusions
nightillusions / dialogflow-fulfillment.d.ts
Created October 28, 2019 15:21 — forked from slowtick/dialogflow-fulfillment.d.ts
Fix payload constructor parameters
declare module 'dialogflow-fulfillment' {
import { DialogflowConversation } from 'actions-on-google';
import { Request, Response } from 'express';
export class Card extends RichResponse {
constructor(card: string | object);
public setButton(button: {
text: string,
url: string,
@nightillusions
nightillusions / Typed MD5 Function
Last active September 1, 2020 07:11
A small TypeScript typed MD5 Function
export function md5(inputString: string) {
const hc = "0123456789abcdef";
function rh(n: number) {
let j,
s = "";
for (j = 0; j <= 3; j++)
s +=
hc.charAt((n >> (j * 8 + 4)) & 0x0f) + hc.charAt((n >> (j * 8)) & 0x0f);
return s;
}