This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); | |
/** | |
* Generic CodeIgniter Database Model - One table version | |
* | |
* Set your Database table and table fields at the top, | |
* and screw creating models for interfacing with one table. | |
* | |
* Disclaimer: I'll answer questions or whatever, but I'm creating | |
* this to speed my own development up. I hope it helps, but it's not supported. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | |
class My_Controller extends CI_Controller { | |
public function upload_files() | |
{ | |
if ($this->input->get('qqfile')) | |
{ | |
$file = $this->input->get('qqfile'); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php defined('BASEPATH') OR exit('No direct script access allowed'); | |
/** | |
* CodeIgniter MY_Model class | |
* | |
* Basic data access functionality for CodeIgniter projects | |
* | |
* @package CodeIgniter | |
* @subpackage Core | |
* @category Core |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
adapted from http://rosstanner.co.uk/2012/01/php-tutorial-twitter-statuses/ | |
*/ | |
class Mytweets extends CI_Model { | |
// define the account username | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function new_registration($username, $email, $password, $confirmation_code) | |
{ | |
// Store the new user's information in the database. | |
$key = $this->config->item('encryption_key'); | |
$salt1 = hash('sha512', $key . $password); | |
$salt2 = hash('sha512', $password . $key); | |
$hashed_password = hash('sha512', $salt1 . $password . $salt2); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class CI_Date { | |
public $sec_in_min, $min_in_hour, $hr_in_day, $day_in_wk, $sec_in_wk, $sec_in_day, $min_in_wk, $min_in_day, $hr_in_wk; | |
public function __construct() { | |
$this->sec_in_min = 60; | |
$this->min_in_hr = 60; | |
$this->hr_in_day = 24; | |
$this->day_in_wk = 7; | |
$this->day_in_yr = 365; | |
$this->sec_in_hr = $this->sec_in_min * $this->min_in_hr; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# node.js app under nginx | |
upstream node { | |
server 127.0.0.1:8001; | |
} | |
server { | |
listen 80; | |
server_name node; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* The API controller | |
Exports 3 methods: | |
* post - Creates a new thread | |
* list - Returns a list of threads | |
* show - Displays a thread and its posts | |
*/ | |
var Thread = require('../models/thread.js'); | |
var Post = require('../models/post.js'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# chkconfig: 35 99 99 | |
# description: Node.js /home/nodejs/sample/app.js | |
# | |
. /etc/rc.d/init.d/functions | |
USER="nodejs" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require("http"), | |
url = require("url"), | |
path = require("path"), | |
fs = require("fs") | |
port = process.argv[2] || 8888; | |
http.createServer(function(request, response) { | |
var uri = url.parse(request.url).pathname | |
, filename = path.join(process.cwd(), uri); |
NewerOlder