Skip to content

Instantly share code, notes, and snippets.

@tayler
tayler / PHP and CI currency converter
Created December 20, 2012 01:36
This is a simple currency converter. The list of allowed currencies and exchange rates are stored in a single database table with the following fields: currency_id (int), currency_code (3 letter string), exchange_rate (float, stored as the rate from US dollars to the given currency)
/* ==========================================================================
Model
============================================================================= */
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Exchange_calculator_model extends CI_Model {
public function __construct() {
$this->load->database();
}
@tayler
tayler / gist:4699834
Last active December 12, 2015 02:38
standard ajax post with jQuery
// http://www.jqapi.com/#p=jQuery.ajax
var email = $("input#email").val();
var user = $("input#user").val();
var pass = $("input#pass").val();
var dataToSend = {
email: email,
username: user,
password: pass
@tayler
tayler / gist:59ae66762f496ff4c0c4
Created August 28, 2014 16:36
AWS Elastic Beanstalk .ebextension config file in JSON (I could only find examples in YAML)
{
"option_settings": [
{
"option_name":"foo",
"value": "fooisfoo"
},
{
"option_name": "DEPLOYMENT",
"value": "development"
},
@tayler
tayler / api.py
Last active August 29, 2015 14:27
import json, base64, pprint
import requests as r
requests.packages.urllib3.disable_warnings()
def make_request(username, password):
RI_API_USER = username
RI_API_PASSWORD = password