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
define('COOKIE_PREFIX', 'pre_'); | |
function logged_in_user(){ | |
$var = COOKIE_PREFIX."user"; | |
if(isset($_COOKIE[$var])){ | |
return $_COOKIE[$var]; | |
}else{ | |
return 'Guest'; | |
} | |
} |
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 | |
$string = 'Lorem ipsum dolor sit amet, consectetur http://google.com</a> adipiscing elit. http://google.com/ Pellentesque vel lectus nec arcu malesuada eleifend eget non lectus. Nullam id tortor velit. Pellentesque ac nunc dui. Nunc dapibus, metus ac ullamcorper <a href="http://google.com" onclick="fff d">luctus</a>, arcu dolor pulvinar massa, ut gravida justo nulla a risus. Integer sit amet urna ut mauris scelerisque sollicitudin. Nulla fringilla ligula nec mi vehicula in hendrerit libero volutpat. <a href="http://google.com">http://google.com</a>'; | |
class LinkLocator { | |
//If you change this regex, change the duplicate bit in the main regex. I should really be doing this progmatically | |
protected static $attrRegex = '(?:\S+?=(?:(?:\'.*?\')|(?:".*?")\s*))'; | |
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 URL | |
{ | |
public function auto($string, $type = 'both', $attr = false, $echo = false) | |
{ | |
if ($type == 'both' || $type == 'url') | |
{ | |
$regex = '/(?<anchor><a(?:\s+(?<attr>(?:\S+?=(?:(?:\'.*?\')|(?:".*?")\s*))+))?>(?<text>.*?)<\/a\s*>)|(?<!>)(?<url>(?<proto>https?:\/{2})(?<domain>[a-zA-Z0-9\-.]+\.[a-zA-Z]{2,3})(?<path>\/\S*)?)/i'; | |
return preg_replace_callback($regex, function($matches) | |
{ |
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
body:after { | |
content: "Content of what you want"; | |
display: block; | |
} |
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 | |
$string = '/index/hi | |
/user/dfhds | |
/register/ddd | |
/etc/blah | |
/etc/'; | |
preg_match_all("/^\/(?!(user|index|register))\w+\/\w*$/m", $string, $matches); | |
print_r($matches); |
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 Utils = require('../../utils') | |
, CustomEventEmitter = require("../../emitters/custom-event-emitter") | |
, Dot = require('dottie') | |
module.exports = (function() { | |
var AbstractQuery = function(database, sequelize, callee, options) {} | |
/** | |
Inherit from CustomEventEmitter | |
*/ |
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
// This works | |
var Something = db.define('something', { | |
action: Sequelize.ENUM('OPTIONA', 'OPTIONB') | |
}); | |
// This doesn't | |
var Something = db.define('something', { | |
action: { | |
type: Sequelize.ENUM('OPTIONA', 'OPTIONB') | |
} |