Skip to content

Instantly share code, notes, and snippets.

<?php
namespace App;
class HomeController {
private $app;
public function __construct() {
$this->app = \Slim\Slim::getInstance();
}
@malgorath
malgorath / Error
Created November 25, 2014 17:25
Can not load site on one system but works on another. Running on a Vagrant Box of the exact same settings on both systems.
Illuminate\Database\QueryException thrown with message "SQLSTATE[42S22]: Column not found: 1054 Unknown column 'updated_at' in 'order clause' (SQL: select * from `news` order by `updated_at` desc limit 3)"
Stacktrace:
#28 Illuminate\Database\QueryException in /home/vagrant/Code/canineharmony/vendor/laravel/framework/src/Illuminate/Database/Connection.php:625
#27 HomeController:index in <#unknown>:0
#26 Illuminate\Routing\Router:Illuminate\Routing\{closure} in <#unknown>:0
#25 PDOException in /home/vagrant/Code/canineharmony/vendor/laravel/framework/src/Illuminate/Database/Connection.php:299
#24 PDO:prepare in /home/vagrant/Code/canineharmony/vendor/laravel/framework/src/Illuminate/Database/Connection.php:299
#23 Illuminate\Database\Connection:Illuminate\Database\{closure} in /home/vagrant/Code/canineharmony/vendor/laravel/framework/src/Illuminate/Database/Connection.php:617
#22 Illuminate\Database\Connection:runQueryCallback in /home/vagrant/Code/canineharmony/vendor/laravel/framework/src/Illuminate/Database
gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.4.4
- RUBY VERSION: 2.1.5 (2014-11-13 patchlevel 273) [x86_64-darwin14.0]
- INSTALLATION DIRECTORY: /Users/scott/.gem/ruby/2.1.5
- RUBY EXECUTABLE: /Users/scott/.rubies/ruby-2.1.5/bin/ruby
- EXECUTABLE DIRECTORY: /Users/scott/.gem/ruby/2.1.5/bin
- SPEC CACHE DIRECTORY: /Users/scott/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Users/scott/.rubies/ruby-2.1.5/etc
- RUBYGEMS PLATFORMS:
@malgorath
malgorath / index.php
Created December 10, 2014 20:00
/public/index.php
<?php
require '../vendor/autoload.php';
require '../config.php';
session_start();
# initialize $app to contain slim framework
$app = new \Slim\Slim();
# setup configurations for $app
$app->config('debug', true);
@malgorath
malgorath / send_form.txt
Created January 19, 2015 19:02
Text file for emailing
Boarding Form for {{ request.form['dog_name'] }} the {{ request.POST['dog_breed'] }}
------------------------------------------------------------------------------------
{% for field in form %}
{{ field.label }}: {{ field.value }}
{% endfor %}
Sent from {{ request.META['REMOTE_ADDR'] }} at {% now "jS F Y H:i" %}
@malgorath
malgorath / gist:438f1048f2908e13b4b5
Created March 3, 2015 21:50
manage.py migrate blog with widgy error
(testing)SCOTTs-Mac-Pro-2:malgorath1 scott$ ./manage.py migrate blog
/Users/scott/.virtualenvs/testing/lib/python2.7/site-packages/widgy/utils.py:152: RemovedInDjango18Warning: `SelectRelatedManager.get_query_set` method should be renamed `get_queryset`.
class SelectRelatedManager(models.Manager):
/Users/scott/.virtualenvs/testing/lib/python2.7/site-packages/scss/__init__.py:86: RuntimeWarning: Scanning acceleration disabled (_speedups not found)!
RuntimeWarning
Operations to perform:
Apply all migrations: blog
Running migrations:
from django.contrib import admin
from django.contrib.flatpages.models import FlatPage
# Note: we are renaming the original Admin and Form as we import them!
from django.contrib.flatpages.admin import FlatPageAdmin as FlatPageAdminOld
from django.contrib.flatpages.admin import FlatpageForm as FlatpageFormOld
from django import forms
from ckeditor.widgets import CKEditorWidget
@malgorath
malgorath / form.html
Last active August 29, 2015 14:20
How to include a form.html in any other type of .html file in DJANGO
<form action="/form/submit" method="POST">
<strong>I.Q.:</strong>
<input type="text" name="IQ" />
<input type="submit" value="Send My IQ" />
</form>
@malgorath
malgorath / CreateArticlesTable.php
Created June 22, 2015 17:57
Articles Migration File for Laravel 5.1
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateArticlesTable extends Migration
{
/**
* Run the migrations.
*
@malgorath
malgorath / gist:dcbe2763ba9c4afeb833
Created July 29, 2015 21:48
brew install python3 error
brew install python3
==> Downloading https://www.python.org/ftp/python/3.4.3/Python-3.4.3.tar.xz
Already downloaded: /Library/Caches/Homebrew/python3-3.4.3.tar.xz
==> ./configure --prefix=/usr/local/Cellar/python3/3.4.3_2 --enable-ipv6 --datar
==> make
==> make install PYTHONAPPSDIR=/usr/local/Cellar/python3/3.4.3_2
import time
ImportError: No module named 'time'
make[2]: *** [Python Launcher.app] Error 1
make[1]: *** [install_PythonLauncher] Error 2