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
async function clockifyRequest(endpoint, token, method = 'GET', body) { | |
const fetchParams = { | |
headers: { | |
'X-Api-Key': token, | |
'Accept': 'application/json', | |
'Content-Type': 'application/json' | |
}, | |
method: method, | |
} | |
if (!!body) { |
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
# Formatting json | |
alias jq=/d/Tools/jq-win64.exe | |
# Enable highlighting in grep | |
alias grep='grep --color=auto' | |
# Better file listing | |
alias ll='ls -lhFA --color --group-directories-first' | |
# alias ports='netstat -tulanp' | |
alias ..="cd .." | |
# Search processes table ex: psg bash, psg apache2 | |
alias psg="ps aux | grep -v grep | grep -i -e VSZ -e" |
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 | |
// $query would be a query builder object | |
$bindings = $query->getBindings(); | |
foreach ($bindings as $i => $binding) { | |
if ($binding instanceof \DateTime) { | |
$bindings[$i] = $binding->format('\'Y-m-d H:i:s\''); | |
} elseif (is_string($binding)) { | |
$bindings[$i] = "'$binding'"; | |
} |
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
// USAGE: | |
// Assuming you have gulp installed globally | |
// npm install -g gulp-soften yargs gulp-eol gulp-trimlines path-exists | |
// gulp --folder public_html OR gulp --folder public_html/styles | |
var base = process.env.USERPROFILE + '/AppData/Roaming/', | |
node_modules = base + 'npm/node_modules/'; | |
var gulp = require(node_modules + 'gulp'); |
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
tinymce.PluginManager.add('charcount', function(editor) { | |
editor.on('init', function() { | |
function getCharacterLength() { | |
var text = editor.getContent({format: 'text'}); | |
// trim and transform newlines ("\n" has a length of 2) to spaces (length = 1) | |
text = text.trim().replace(/(\n)+/g, " "); | |
return text.length; | |
} |
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
// disable :hover on touch devices | |
// based on https://gist.github.com/4404503 | |
// via https://twitter.com/javan/status/284873379062890496 | |
// + https://twitter.com/pennig/status/285790598642946048 | |
// re http://retrogamecrunch.com/tmp/hover | |
// NOTE: we should use .no-touch class on CSS | |
// instead of relying on this JS code | |
function removeHoverCSSRule() { | |
if ('createTouch' in document) { | |
try { |
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 | |
class ImageResizeController extends BaseController { | |
/** | |
* This method catches urls like /imagecache/width/height/path/to/original_image.jpg and | |
* creates the image if public/imagecache/width/height/path/to/original_image.jpg doesn't exist. | |
* | |
* Urls like this are used for returning a resized version of /path/to/original_image.jpg |
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 | |
class DropzoneController extends BaseController { | |
public function upload() { | |
$r = Util::uploadUnique('file', Config::get('website.dropzone_uploads')); | |
extract($r); | |
//return response |
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 | |
class AdminRedactorController extends AdminController { | |
private $publicFolder = 'redactor_uploads'; | |
private $uploadFolder = 'public/' . $publicFolder; | |
public function fileUpload(){ |
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 | |
class Core_Base | |
{ | |
/** | |
* the constructor will assign | |
* - the values specified in the constructor's arguments, in that specific order as the object's properties | |
* - if an array is passed as argument, the values from that array will be passed as the object's properties | |
* - the object's properties which have no value assigned will be set to false to prevent name collisions in the mustache templates | |
*/ |
NewerOlder