Skip to content

Instantly share code, notes, and snippets.

View freekrai's full-sized avatar

Roger Stringer freekrai

View GitHub Profile
; site info
site.name = My Moustache Site
site.url = http://mysiteurl/
; rendering vars
views.root = views
views.layout = layout
; session vars
cookies.secret = IeNj0yt0sQu33zeflUFfym0nk1e
<?php
require("jolt.php");
include("Services/Twilio.php");
$_GET['route'] = isset($_GET['route']) ? '/'.$_GET['route'] : '/';
$app = new Jolt('site',false);
$app->option('source', 'config.ini');
$client = new Services_Twilio($app->option('twilio.accountsid'), $app->option('twilio.authtoken') );
$fromNumber = $app->option('twilio.fromNumber');
$app->store('client',$client);
curl "http://google-api-php-client.googlecode.com/files/google-api-php-client-0.6.2.tar.gz" -O
tar -xvf google-api-php-client-0.6.2.tar.gz
<?php
require_once 'google-api-php-client/src/Google_Client.php';
require_once 'google-api-php-client/src/contrib/Google_CustomsearchService.php';
session_start();
$client = new Google_Client();
$client->setApplicationName('My Google SMS Search Replacement');
$client->setDeveloperKey('Your Developer Key Here');
$search = new Google_CustomsearchService($client);
<?php
require_once('mailer/class.phpmailer.php');
$myName = "YourName";
$email_pattern = "/^([a-z0-9\.\-\+\_\']+)@[a-z0-9\-\+\_]+\.[a-z0-9\-\+\_]*(\.?)[a-z0-9]+$/";
$email_address = trim($_POST['Body']);
$email = new PHPMailer();
$email->From = 'FromEmail';
$email->AddReplyTo('FromEmail', $myName);
$email->Mailer = 'mail';
@freekrai
freekrai / uuid.php
Last active December 28, 2015 10:49
Generate UUID in PHP
<?php
function generate_uuid() {
return sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ),
mt_rand( 0, 0xffff ),
mt_rand( 0, 0x0fff ) | 0x4000,
mt_rand( 0, 0x3fff ) | 0x8000,
mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff )
);
}
@freekrai
freekrai / config.ini
Created January 5, 2014 03:32
config.ini for live blogging with twilio and simperium demo @ http://rogerstringer.com/2014/01/05/live-blogging-twilio-simperium
; site info
site.name = My Live Blog
site.url = http://mysiteurl/
; rendering vars
views.root = views
views.layout = layout
; session vars
cookies.secret = IeNj0yt0sQu33zeflUFfym0nk1e
@freekrai
freekrai / index.php
Last active January 2, 2016 06:29
index.php for live blogging with twilio and simperium demo @ http://rogerstringer.com/2014/01/05/live-blogging-twilio-simperium
<?php
include("jolt.php");
require 'Services/simperium.php';
require 'Services/Twilio.php';
require 'functions.php';
$app = new Jolt();
$app->option('source', 'config.ini');
@freekrai
freekrai / functions.php
Created January 5, 2014 03:35
functions.php for live blogging with twilio and simperium demo @ http://rogerstringer.com/2014/01/05/live-blogging-twilio-simperium
<?php
function slugify( $string ){
$string = strtolower( trim($string) );
$slug=preg_replace('/[^A-Za-z0-9-]+/', '-', $string);
return $slug;
}
function cropResize($img,$out='',$dSize=170){
$x = @getimagesize($img);
$sw = $x[0];
@freekrai
freekrai / home.php
Last active January 2, 2016 06:29
home.php for live blogging with twilio and simperium demo @ http://rogerstringer.com/2014/01/05/live-blogging-twilio-simperium
<div class="jumbotron">
<h1>Live Blog</h1>
</div>
<br />
<section id="talkwrap" style="overflow: auto;margin-bottom: 10px;">
<div id="talk"></div>
</section>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="https://js.simperium.com/v0.1/"></script>
<script>