⌘T | go to file |
⌘⌃P | go to project |
⌘R | go to methods |
⌃G | go to line |
⌘KB | toggle side bar |
⌘⇧P | command prompt |
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
public static function getContentModules() { | |
$db = Db::getInstance(); | |
$query = "SELECT content_module.content_module_id , " . | |
" content_module.name, content_module.created_by, " . | |
" createtime, deletetime, (select count(*) from page p " . | |
" WHERE p.content_module_id = " . | |
" content_module.content_module_id AND p.deletetime is null) " . | |
" as numberOfPages from content_module WHERE deletetime IS NULL"; | |
try { | |
$stmt = $db->prepare($query); |
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 Collection (modelname) { | |
this.modelname = modelname; | |
this.collection = {} | |
this.length = 0 | |
} | |
Collection.prototype.add = function(model) { | |
this.collection[model[modelname+"Id"]] = model; | |
this.lenth++ | |
} |
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'), | |
cluster = require('cluster') | |
function hydraServer(requestListener, heads){ | |
var server, | |
i; | |
if(cluster.isMaster) { | |
for(i = 0; i < heads; i++) { | |
cluster.fork() | |
} |
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 Map = (function() { | |
function Map (name) { | |
this.init() | |
this.name = name; | |
} | |
Map.prototype.init = function() { | |
} |
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
SELECT * FROM media | |
INNER JOIN media_tag | |
ON media_tag.media_id = media.media_id | |
INNER JOIN tag | |
ON tag.tag_id = media_tag.tag_id | |
WHERE tag.name IN ('tag1','tag2', 'tag3') |
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
jQuery.fn.httpReq = function(opts) { | |
var oriErrorHandler = opts.error | |
function errorHandler (argument) { | |
//gjør standrd ting her | |
oriErrorHandler() | |
} | |
opts['error'] = errorHandler |
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 | |
public function __get($name, $value) { | |
if ($name == "tariff" && get_called_class() != get_class($this)) { | |
return (intval($this->$name) / 100); | |
} else if ($name == "durationType" && get_called_class() != get_class($this)) { | |
} else { | |
return $this->$name; | |
} | |
} |
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 needle = "search for this" | |
var haystack = "search in this string" | |
var regexp = new RegExp("(\.*)("+needle+")(\.*)") | |
regexp.exec(haystack) // === null || [matches] | |
haystack.match(regexp) // === null || [matches] |