Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View Pamblam's full-sized avatar
🕶️
Coding

Rob Parham Pamblam

🕶️
Coding
  • Our Town America
  • Tampa Bay, Florida
View GitHub Profile
@Pamblam
Pamblam / runcmd.php
Last active August 13, 2021 15:24
run a command
<?php
/**
* Run a command with optional stdin
* @param string $cmd - the command to run
* @param string|string[] $stdin - the stdin to feed to the command
* @param string $cwd - the working directory in which to run the command
* @return object containing exit_status, stdout, stderr and elapsed
*/
function runcmd($cmd, $stdin=null, $cwd=null){
@Bharat-B
Bharat-B / imap.php
Last active October 10, 2020 07:30
php-imap-class
<?php
class IMAP {
protected $constring;
protected $connection;
protected $extensions = array( "txt", "jpg", "jpeg", "png", "xls", "doc", "docx", "xlsx", "zip", "rar", "pdf" );
protected $mimeType = array( "text", "multipart", "message", "application", "audio", "image", "video", "other" );
@joashp
joashp / PushNotifications.php
Last active July 28, 2023 12:33
Simple PHP script to send Android Push Notification, iOS Push Notification and Windows Phone 8 Push Notification
<?php
// Server file
class PushNotifications {
// (Android)API access key from Google API's Console.
private static $API_ACCESS_KEY = 'AIzaSyDG3fYAj1uW7VB-wejaMJyJXiO5JagAsYI';
// (iOS) Private key's passphrase.
private static $passphrase = 'joashp';
// (Windows Phone 8) The name of our push channel.
private static $channelName = "joashp";
@prime31
prime31 / gist:5675017
Last active April 2, 2024 03:55
Simple PHP script showing how to send an Android push notification. Be sure to replace the API_ACCESS_KEY with a proper one from the Google API's Console page. To use the script, just call scriptName.php?id=THE_DEVICE_REGISTRATION_ID
<?php
// API access key from Google API's Console
define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' );
$registrationIds = array( $_GET['id'] );
// prep the bundle
$msg = array
@stephenhardy
stephenhardy / git-clearHistory
Created April 26, 2013 22:14
Steps to clear out the history of a git/github repository
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@ykarikos
ykarikos / png2svg.sh
Created June 7, 2012 22:17
Convert png to svg using imagemagick and potrace
#!/bin/bash
if [ "$1" == "" ]; then
echo Usage: $0 pngfile
exit 0;
fi
FILE=`basename $1 .png`
if [ ! -e $FILE.png ]; then