Skip to content

Instantly share code, notes, and snippets.

@mbarrerar
mbarrerar / gist:7ed96bade9d245d69ad7f5c4c15bef9e
Created May 8, 2019 21:47 — forked from ocke/gist:6723065
PHP implementation of SSO with JWT
<?php
// load JWT class
// Class can be found here: https://github.com/firebase/php-jwt
include __DIR__.'/JWT.class.php';
$JWT = new JWT();
// Zendesk provides a timestamp in the get.
$now = (!empty($_GET['timestamp'])) ? $_GET['timestamp'] : time();
@mbarrerar
mbarrerar / jquery.deferred.promise.js
Created March 26, 2019 22:34 — forked from pbojinov/jquery.deferred.promise.js
simple jQuery Deferred example
function getData() {
var deferred = $.Deferred();
$.ajax({
'url': 'http://google.com',
'success': function(data) {
deferred.resolve('yay');
},
'error': function(error) {
deferred.reject('boo');
@mbarrerar
mbarrerar / Utils.php
Created April 12, 2017 17:39 — forked from aemxn/Utils.php
Utils.php
<?php
require '../vendor/autoload.php';
require_once 'Config.php';
if(PHP_DEBUG_MODE){
error_reporting(-1);
ini_set('display_errors', 'On');
}
// authorized user id from db - global var
<?php
class CalendarEvent {
/**
*
* The event ID
* @var string
*/
private $uid;
<?php
//Using composer to get the Sabre lib
require dirname ( __FILE__ ) . '/../vendor/autoload.php';
use Sabre\VObject\Component\VCalendar;
// Create a message
$message = Swift_Message::newInstance ( 'Message Title' )
->setFrom ( array( '[email protected] ' => 'John Doe' ) )
->setTo ( array( $email ) )
->setSubject ( "Cool message subject" )
# Nginx+Unicorn best-practices congifuration guide. Heartbleed fixed.
# We use latest stable nginx with fresh **openssl**, **zlib** and **pcre** dependencies.
# Some extra handy modules to use: --with-http_stub_status_module --with-http_gzip_static_module
#
# Deployment structure
#
# SERVER:
# /etc/init.d/nginx (1. nginx)
# /home/app/public_html/app_production/current (Capistrano directory)
#
# autoload concerns
module YourApp
class Application < Rails::Application
config.autoload_paths += %W(
#{config.root}/app/controllers/concerns
#{config.root}/app/models/concerns
)
end
end