Skip to content

Instantly share code, notes, and snippets.

View chasecrawford's full-sized avatar

Chase Crawford chasecrawford

View GitHub Profile
@jcipriano
jcipriano / challenge-response.php
Created June 29, 2017 16:08
PHP example for generating challenge response for Twitter webhooks
<?php
// Example app consumer secret found in apps.twitter.com
const APP_CONSUMER_SECRET = 'z3ZX4v7mAAUGykl3EcmkqbartmuW8VFOOzCloLx9Q45P0hLrFu';
// Example token provided by incoming GET request
$token = $_GET['crc_token'];
/**
* Creates a HMAC SHA-256 hash created from the app TOKEN and
* your app Consumer Secret.
* @param token the token provided by the incoming GET request
__author__ = 'Damon Pollard (@DamonLPollard)'
import re
import random
import json
import requests
WLID_USERNAME = "user@example.com"
WLID_PASSWORD = "password"
@m13z
m13z / twitter_oauth_curl.php
Last active November 22, 2018 02:41
Super simple PHP twitter oauth request without user context (https://dev.twitter.com/docs/auth/application-only-auth)
/*
* using curl
*/
$key = 'YOUR_KEY_HERE';
$secret = 'YOUR_SECRET_HERE';
$api_endpoint = 'https://api.twitter.com/1.1/users/show.json?screen_name=marcosfernandez'; // endpoint must support "Application-only authentication"
// request token
$basic_credentials = base64_encode($key.':'.$secret);
@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/