Skip to content

Instantly share code, notes, and snippets.

View seanmcn's full-sized avatar
🐝

Seán McNamara seanmcn

🐝
View GitHub Profile
@seanmcn
seanmcn / Model_addProject.php
Last active August 29, 2015 14:10
Using Codeigniter's ActiveRecord
/*
* Model for Projects
*/
function addProject($client, $projectName, $price, $deadline, $notes) {
$project = array(
"client_id" => $client,
"user_id" => $this->session->userdata('user_id'),
"name" => $projectName,
"price" => $price,
"deadline" => $deadline,
@seanmcn
seanmcn / Controller_addProject.php
Last active August 29, 2015 14:10
Using Codeigniter Form + Validation Libraries
/*
* Controller for Projects
*/
public function addProject() {
$this->load->helper('form');
$this->load->library('form_validation');
$config = array(
array(
'field' => 'client',
'label' => 'Client Name',
@seanmcn
seanmcn / MySQL Data to CSV.php
Last active August 29, 2015 14:10
Converts mySQL data to CSV data
<?php
/* Database Info */
$server = "localhost";
$username = "username";
$password = "password";
$databaseName = "databaseName";
/* Table we want to export */
$tableName = "tableName";
/* Optional WHERE Statement */
//$whereStatement = "WHERE field = value";
@seanmcn
seanmcn / createFilesNumeric.php
Last active December 17, 2015 07:49
Simple script to create any number of files in a folder.
<?php
$count = 1;
while($count <= 20) {
$path = "D:\\web\\www\\website\\folder\\";
$filename = $count.".html";
$file = fopen($path.$filename, "w");
echo $filename." has been created! <br />";
$count++;
}
?>
@seanmcn
seanmcn / jQueryDroppable.js
Last active March 11, 2016 07:41
jQuery Droppable (Accept only one Draggable)
$(".drop_area").droppable({
tolerance: "intersect",
accept: ".drop_item",
greedy: true,
drop : function(event, ui) {
$(this).droppable( "option", "disabled", true );
},
out : function(event, ui) {
$(this).droppable( "option", "disabled", false );
},