Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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 express = require('express') | |
var bodyParser = require('body-parser') | |
var app = express() | |
// create application/json parser | |
var jsonParser = bodyParser.json() | |
app.post('/api/users', jsonParser, function (req, res) { | |
if (!req.body) return res.sendStatus(400) | |
res.json({foo: 'bar'}) | |
}); |
This file contains 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 __autoload($class) | |
{ | |
if (strpos($class, 'CI_') !== 0) | |
{ | |
if (file_exists($file = APPPATH . 'core/' . $class . EXT)) | |
{ | |
include $file; | |
} | |
elseif (file_exists($file = APPPATH . 'libraries/' . $class . EXT)) | |
{ |
This file contains 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 | |
$array = array('hi' => 'a', 'yo' => 'b'); | |
array_walk($array, function(&$value, $key){ | |
$value = strpos('abcdefghijklmnopqrstuvwxyz', $value) + 1; | |
}); | |
print_r($array); // Array ( [hi] => 1 [yo] => 2 ) | |
// < PHP 5.3 | |
function alphanum(&$value, $key){ |
This file contains 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
<snippet> | |
<content><![CDATA[ | |
<div class="clearfix"> | |
<label for="$1">$2</label> | |
<div class="input"> | |
<?=form_input('$1', set_value('$1'), 'id="$1"')?> | |
</div> | |
</div> | |
]]></content> | |
<tabTrigger>formtext</tabTrigger> |
This file contains 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
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
#Removes access to the system folder by users. | |
#Additionally this will allow you to create a System.php controller, | |
#previously this would not have been possible. | |
#'system' can be replaced if you have renamed your system folder. | |
RewriteCond %{REQUEST_URI} ^system.* | |
RewriteRule ^(.*)$ /index.php?/$1 [L] | |
This file contains 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 ( ! function_exists('time_ago')) | |
{ | |
function time_ago($time, $max_units = NULL) | |
{ | |
$lengths = array(1, 60, 3600, 86400, 604800, 2630880, 31570560, 315705600); | |
$units = array('second', 'minute', 'hour', 'day', 'week', 'month', 'year', 'decade'); | |
$unit_string_array = array(); | |
This file contains 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 mysql = require('mysql'); | |
var client = mysql.createClient({ | |
user: 'dennisrasmussen', | |
password: '****************', | |
host: '*****************', | |
database: 'dennisrasmussen', | |
port: 9000 | |
}); |
This file contains 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
info it worked if it ends with ok | |
verbose cli [ 'node', | |
verbose cli '/home/Dennis/npm/cli.js', | |
verbose cli 'install', | |
verbose cli '-g', | |
verbose cli '-f' ] | |
info using npm@1.0.25 | |
info using node@v0.5.5-pre | |
verbose config file /home/Dennis/.npmrc | |
verbose config file /usr/local/etc/npmrc |