Skip to content

Instantly share code, notes, and snippets.

.hide-text {
text-indent: 100%;
white-space: nowrap;
overflow: hidden;
}
function utf8mail($to,$s,$body,$from_name="x",$from_a = "[email protected]", $reply="[email protected]")
{
$s= "=?utf-8?b?".base64_encode($s)."?=";
$headers = "MIME-Version: 1.0\r\n";
$headers.= "From: =?utf-8?b?".base64_encode($from_name)."?= <".$from_a.">\r\n";
$headers.= "Content-Type: text/plain;charset=utf-8\r\n";
$headers.= "Reply-To: $reply\r\n";
$headers.= "X-Mailer: PHP/" . phpversion();
mail($to, $s, $body, $headers);
}
./configure \
--prefix=/usr \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--sysconfdir=/private/etc \
--with-apxs2=/usr/sbin/apxs \
--enable-cli \
--with-config-file-path=/etc \
--with-libxml-dir=/usr \
--with-openssl=/usr \
@WISHPRO
WISHPRO / eloquent.md
Last active August 29, 2015 14:17 — forked from msurguy/eloquent.md

Conventions:

Defining Eloquent model (will assume that DB table named is set as plural of class name and primary key named "id"):

class Shop extends Eloquent {}

Using custom table name

protected $table = 'my_shops';

<?php
/**
* Display a thumbnail from YouTube based off the embed code saved in the
* video post format metabox used by the CF Post Formats plugin
*
* @link https://github.com/crowdfavorite/wp-post-formats
* @link http://stackoverflow.com/a/6382259
*/
global $post;
@WISHPRO
WISHPRO / eloquent.php
Last active August 29, 2015 14:17 — forked from ziadoz/eloquent.php
<?php
class Post
{
protected $table = 'posts';
/**
* You can define your own custom boot method.
*
* @return void
**/
@WISHPRO
WISHPRO / cache.conf
Last active August 29, 2015 14:17 — forked from ziadoz/cache.conf
# Nginx FastCGI Cache: http://seravo.fi/2013/optimizing-web-server-performance-with-nginx-and-php
# More Caching: https://www.digitalocean.com/community/tutorials/how-to-setup-fastcgi-caching-with-nginx-on-your-vps
# Apache Bench Mac: http://kevify.com/2013/ab-on-mac/
fastcgi_cache_path /var/cache/nginx levels=1:2 keys_zone=MYAPP:100m inactive=60m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
server {
listen 80;
<?php
/* * **
*
* This script converts an existing MySQL database to migrations in Laravel 4.
*
* 1. Place this file inside app/controllers/
*
* 2. In this file, edit the index() method to customize this script to your needs.
* - inside $migrate->ignore(), you pass in an array of table
#!/bin/bash
myproject='myproject'
mywwwdir='public_html'
# initialize project
composer create-project laravel/laravel $myproject 4.2.*
cd $myproject
perl -pi -e "s|/public|/../${mywwwdir}|" bootstrap/paths.php