Skip to content

Instantly share code, notes, and snippets.

View Narven's full-sized avatar
👾
Walking to the fridge...

P Ξ D R O L U Z Narven

👾
Walking to the fridge...
View GitHub Profile
@Narven
Narven / jquery_cron_job
Created May 1, 2013 16:23
jquery kind of cron job :P
// CHECK NEW MESSAGES (CRON)
(function checkNewMessages() {
$.ajax({
url: "<?=site_url('message/process')?>",
type: 'post',
data: {'job': 'checkNewMessages'},
success: function(data) {
//console.info(data);
var data = $.parseJSON(data);
//console.info(data);
@Narven
Narven / redirect to previous url
Last active December 18, 2015 22:38
redirect to last url
$this->redirect(Yii::app()->request->urlReferrer);
@Narven
Narven / site protection temporary solutions
Created October 21, 2013 10:06
site protection temporary solutions https://coderwall.com/p/-3oqoa?&p=1&q= this is more for my own reminder and place to come back to for reference Simple rules that have been tested for years to plug most any whole in your site. Not to replace good coding practice, or directly address the root issue, but to act as a simple first line defense as…
# URL Filtering helps stop some hack attempts
#IF the URI contains a "http:"
RewriteCond %{QUERY_STRING} http\: [OR]
#OR if the URI contains a "["
RewriteCond %{QUERY_STRING} \[ [OR]
#OR if the URI contains a "]"
RewriteCond %{QUERY_STRING} \] [OR]
#OR if the URI contains a "<script>"
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
#OR script trying to set a PHP GLOBALS variable via URL
/**
* Git Pull
*
* @author Adam Patterson
* http://www.adampatterson.ca/blog/2011/10/diy-simple-staging-server/
*
* Use: echo pull();
*/
function pull ( )
<?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.
// to delete all DS_Store files in the dir
find . -name '*.DS_Store' -type f -delete
/.buildpath
/build/
*/archive/
__MACOSX
.DS_Store
@Narven
Narven / disable_mysql_foreign_key
Created November 6, 2013 14:59
disables and enables mysql foreign keys
SET FOREIGN_KEY_CHECKS=0;
SET FOREIGN_KEY_CHECKS=1;
@Narven
Narven / php_memory_limit
Created November 6, 2013 15:44
php set memory limit to unlimited... god mode :D
ini_set('memory_limit', '-1');

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta charset='UTF-8'>
<meta name='keywords' content='your, tags'>
<meta name='description' content='150 words'>
<meta name='subject' content='your website's subject'>
<meta name='copyright' content='company name'>
@Narven
Narven / _form.twig
Created November 26, 2013 01:31 — forked from jamband/_form.twig
<div class="form">
{% set form = this.beginWidget('CActiveForm', {
'id': 'hoge-form',
'enableAjaxValidation': false,
}) %}
<p class="note">Fields with <span class="required">*</span> are required.</p>
{{ form.errorSummary(model) }}