Unauthorized access to a PHP page prompts the user for a password. Once the password is entered the original page will show.
- The access is recorded in the session so it only needs to be
Somewhat like dotenv but for PHP.
The goals is to remove all config scattered about in files and have one authoritative source for that config info.
The original PHP mysql library was fairly quick to code due to it's simple functional interface. But there were some rough edges. Also it is now deprecated and most developers are moving to PDO since it is more database independent.
Unfortuantly PDO is overly complicated. This is mostly due to PHP's poor object system and the PDO developers desire to make the system object-oriented.
A generic proxy module.
Since it's a module it can be mixed into any class. This differs from Ruby's Delegator class which require the inheritance chain to include the Delegator module. Since it implements it's magic via method_missing, it will only proxy the method if the method doesn't exist on the base class or any of it's parent classes.
concern :ComposedModel do | |
include ActiveModel::Model | |
def valid? | |
objects.all?(&:valid?) && super | |
end | |
def save! | |
raise ActiveRecord::RecordInvalid, self unless valid? | |
transaction { objects.each &:save! } |
#!/usr/bin/env ruby | |
# Provides a way to list forks on github for a project. | |
# | |
# git-hub-fork-network user project | |
require 'rubygems' | |
require 'octopi' | |
module Octopi | |
class Repository < Base |
<?php | |
/*** A stupid simple PHP-based file manager ***/ | |
// Were to put the files. Assume the "fm" directory where this script | |
// Is located but you can change it to anything you want. | |
$storage_dir = implode(DIRECTORY_SEPARATOR, array(dirname(__FILE__), 'fm')); | |
// Set to the name of the file that is the header and footer of the HTML | |
$header = null; | |
$footer = null; |
import PouchDB from 'pouchdb-browser' | |
import MemoryAdapterPlugin from 'pouchdb-adapter-memory' | |
PouchDB.plugin(MemoryAdapterPlugin) |