Skip to content

Instantly share code, notes, and snippets.

@mirzap
mirzap / rc4.js
Created March 11, 2013 21:42 — forked from farhadi/rc4.js
/*
* RC4 symmetric cipher encryption/decryption
*
* @license Public Domain
* @param string key - secret key for encryption/decryption
* @param string str - string to be encrypted/decrypted
* @return string
*/
function rc4(key, str) {
var s = [], j = 0, x, res = '';

##Objective

Add RESS for conditional content based on screen size. Accomplished by creating a JavaScript cookie

##Problem

When a cookie is set via JavaScript, Laravel's Cookie can't read the cookie. It doesn't work because there is no httpOnly option in Laravel. Symfony cookie does have httpOnly option but it defaults to TRUE. httpOnly has to be set to FALSE in order to access cookies from the browser. See issues:

<?php
/**
* post-process.php
* make sure to include post-process.php in your functions.php. Use this in functions.php:
*
* get_template_part('post-process');
*
*/
function do_insert() {
if( 'POST' == $_SERVER['REQUEST_METHOD']
<!DOCTYPE html>
<html>
<head>
<title>Box Shadow</title>
<style>
.box {
height: 150px;
width: 300px;
margin: 20px;
@mirzap
mirzap / mysql_backup.py
Created August 25, 2013 19:25
Simple MySQL database backup script
#!/usr/bin/env python
import os,time,getpass
def backup():
filestamp = time.strftime('%Y-%m-%d-%H-%M')
print "Enter username:"
username = raw_input()
print "Enter password:"
@mirzap
mirzap / gist:6492804
Created September 9, 2013 08:14
SSH agent
Restart SSH Agent:
killall ssh-agent; eval `ssh-agent`
Add identity to the SSH Agent
ssh-copy-id -i ~.ssh/key_name.pub user@host
or
ssh-add ~/.ssh/your-key
@mirzap
mirzap / vhost
Created January 21, 2014 15:03 — forked from gistwebdev/vhost
#!/bin/bash
#
# Display usage info
vhost-usage() {
cat <<"USAGE"
Usage: vhost [OPTIONS] <name>
-h|--help this screen
-pub to create the webhost root in ~/www/name/public/
-url to specify a local address, default is http://name.local
<?php
/**
* An helper file for Laravel 4, to provide autocomplete information to your IDE
* Generated with https://github.com/barryvdh/laravel-ide-helper
* Updated for Laravel 4.1.20 (2014-02-03)
*
* @author Barry vd. Heuvel <barryvdh@gmail.com>
*/
exit('Only to be used as an helper for your IDE');
<?php
/**
* An helper file for Laravel 4, to provide autocomplete information to your IDE
* Generated with https://github.com/barryvdh/laravel-ide-helper
* Updated for Laravel 4.1.22 (2014-02-03)
*
* @author Barry vd. Heuvel <barryvdh@gmail.com>
*/
exit('Only to be used as an helper for your IDE');
(function() {
'use strict';
var async = require('async'),
fs = require('fs'),
im = require('imagemagick'),
maxworkers = require('os').cpus().length,
path = require('path');