Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Created by PhpStorm.
* User: Craig
* Date: 10/17/2014
* Time: 8:36 PM
*/
class DB {
<?php
class Brewery {
private $key;
private $url = 'http://api.brewerydb.com/v2/';
public function __construct($key) {
$this->key = $key;
@csalajan
csalajan / gist:11236412
Created April 23, 2014 23:43
Delete Function
public function postDelete(){
$id = Input::get('id');
try{
$equipment = Equipment::findOrFail($id);
$equipment -> delete();
}
catch(Exception $e){
return Redirect::to('inventory/equipment')->with(array('status' => 201, 'message' => 'Failed to Delete Equipment', 'error' => $e));
}
@csalajan
csalajan / gist:11236378
Created April 23, 2014 23:42
Delete Function
public function postDelete(){
$id = Input::get('id');
try{
$equipment = Equipment::findOrFail($id);
$equipment -> delete();
}
catch(Exception $e){
//return Response::json(array('status' => 400, 'message' => 'equipment not found', 'error' => $e), 400);
return Redirect::to('inventory/equipment')->with(array('status' => 201, 'message' => 'Failed to Delete Equipment', 'error' => $e));
}
@csalajan
csalajan / gist:6489511
Last active December 22, 2015 14:59
blah
message = '''From: Bosapp Portal <[email protected]>
Subject: Password recovery
MIME-Version: 1.0
Content-type: text/html
<html>
<body>
<a href={0}>Here is your password reset link.</a> <br />
<img src=http://static.giantbomb.com/uploads/original/1/17172/1419618-unicorn2.jpg> <br />
</body>
function payroll_table(data, s_date) {
var html = '<table class="table table-striped table-bordered tablesorter" cellspacing="0" cellpadding="0" id="payrollTable">\
<thead>\
<tr>\
<th width="175px">Employee</th>\
<th colspan="7"></th>\
</tr>\
</thead>\
<tbody>';
from django.http import HttpResponse
from scheducal.models import Category
from scheducal.lib.obj_helper import get_obj_or_none
from scheducal.forms.category import CategoryForm
from django.utils import simplejson
from django.core import serializers
from django.views.decorators.http import require_http_methods
from django.views.decorators.csrf import csrf_exempt
@require_http_methods(['GET'])
@csalajan
csalajan / urls.py
Created August 19, 2013 16:56
urls
from django.conf.urls import(
patterns,
url,
include,
)
from tokenauth import views
urlpatterns = patthers('tokenauth.views',
url(r'^login/$',
views.login.as_view(),