Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View gentoid's full-sized avatar
😃

Viktor Lazarev gentoid

😃
View GitHub Profile
<?php die('This file is not really here!');
/**
* ------------- DO NOT UPLOAD THIS FILE TO LIVE SERVER ---------------------
*
* Implements code completion for CodeIgniter in phpStorm
* phpStorm indexes all class constructs, so if this file is in the project it will be loaded.
* -------------------------------------------------------------------
* Drop the following file into a CI project in phpStorm
* You can put it in the project root and phpStorm will load it.
@gentoid
gentoid / style.css
Created January 3, 2013 11:39
CSS3 Circle load rotator
/*** Loader ***/
.loader-ball1 {
background-color: rgba(0,0,0,0);
border:5px solid rgba(0,183,29,.9);
opacity:.5;
border-top:5px solid rgba(0,0,0,0);
border-left:5px solid rgba(0,0,0,0);
border-radius:50px;
box-shadow: 0 0 35px #009720;
width:50px;
<?php
$modx = new modX();
$modx->setLogTarget(XPDO_CLI_MODE ? 'ECHO' : 'HTML');
$modx->initialize('mgr');
$modx->setLogLevel(modX::LOG_LEVEL_INFO);
$modx->exec("UPDATE {$modx->getTableName('modResource')} SET uri = '' WHERE uri_override = 0");
//$modx->call('modResource', 'refreshURIs', array(&$modx));
foreach ($modx->getIterator('modResource', $criteria) as $resource) {
@gentoid
gentoid / callback.php
Created January 22, 2013 11:56
json_encode. Workaround for PHP < 5.1.6
/**
* Workaround for PHP < 5.1.6
*/
if (!function_exists('json_encode')) {
function json_encode($data) {
switch ($type = gettype($data)) {
case 'NULL':
return 'null';
case 'boolean':
return ($data ? 'true' : 'false');
@gentoid
gentoid / callback.php
Created January 22, 2013 11:56
Is it HTTP_X_REQUESTED_WITH?
if (!isset($_SERVER['HTTP_X_REQUESTED_WITH']) || $_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest') {
return;
}
@gentoid
gentoid / breakPoint
Created February 10, 2013 19:38
Breakpoints for adaptive design
function isBreakPoint(bp) {
// The breakpoints that you set in your css
var bps = [320, 480, 768, 1024];
var w = $(window).width();
var min, max;
for (var i = 0, l = bps.length; i < l; i++) {
if (bps[i] === bp) {
min = bps[i-1] || 0;
max = bps[i];
break;
@gentoid
gentoid / highlight
Created February 10, 2013 19:41
Highlight text
function highlight(text, words, tag) {
// Default tag if no tag is provided
tag = tag || 'span';
var i, len = words.length, re;
for (i = 0; i < len; i++) {
// Global regex to highlight all matches
re = new RegExp(words[i], 'g');
if (re.test(text)) {
@gentoid
gentoid / Gradient 3D text
Created February 16, 2013 15:21
Gradient 3D text (source is http://codepen.io/anon/pen/JzjdL)
<h1 class="text"><span>Gradient 3D text</span></h1>
<style>
body {
background-color: #272727;
}
h1 {
font-family: "Arial", sans-serif;
font-size: 85px;
text-align: center;
<h1 class="loader">
<span>З</span>
<span>а</span>
<span>г</span>
<span>р</span>
<span>у</span>
<span>з</span>
<span>к</span>
<span>а</span>
</h1>
<IfModule filter_module>
<IfModule version.c>
<IfVersion <= 2.2>
FilterDeclare COMPRESS
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/html
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/css
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/plain
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/x-component
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/javascript