Skip to content

Instantly share code, notes, and snippets.

View setkyar's full-sized avatar
🧘‍♂️

Set Kyar Wa Lar (Universe) setkyar

🧘‍♂️
View GitHub Profile
@jonlabelle
jonlabelle / laravel4-log-sql-queries-and-url.php
Created July 8, 2013 18:06
Laravel 4: Log all SQL queries and request URL. You can add it in `app/routes.php`.
Event::listen('illuminate.query', function($sql)
{
Log::info('Request URL: '.Request::url() .' Query: '.$sql);
});
@msurguy
msurguy / upload.php
Created April 18, 2013 17:54
Automatic image rotation from mobile Recently I had a use case when I needed to automatically rotate uploaded pictures according to the sensor data embedded in the image (think iPhone, iPad, Android phones, DSLR cameras, etc) I ended up using PHP Imageworkshop (http://phpimageworkshop.com/documentation.html) for all my image processing needs so …
//retrieve the image
$image = Input::file('image');
// initialize imageworkshop layer
$layer = PHPImageWorkshop\ImageWorkshop::initFromPath($image['tmp_name']);
if (File::is('jpg', $image['tmp_name']))
{
$exif = exif_read_data($image['tmp_name']);
@alexkingorg
alexkingorg / wp-stats.php
Created January 3, 2012 04:28
WordPress per-year blog stats
<?php
header('Content-type: text/plain');
global $wpdb;
?>
<table class="numbers">
<thead>
<tr>
<th>&nbsp;</th>
@basvandorst
basvandorst / Greplin-palindrome.php
Created December 12, 2011 19:02
PHP: Find longest palindrome
<?php
/**
* Easy way to find the longest palindrome in a string
*
* Solution for: http://challenge.greplin.com/
* The Greplin Programming Challenge: Version 1
*
* @author Bas van Dorst <info@basvandorst.nl>
*/
$data = "FourscoreracecarsthatandsevenyearsagoourfaathersbroughtforthonthiscontainentanewnationconceivedinzLibertyanddedicatedtothepropositionthatallmenarecreatedequalNowweareengagedinagreahtcivilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetractTgheworldadswfilllittlenotlenorlongrememberwhatwesayherebutitcanneverforgetwhattheydidhereItisforusthelivingrathertobededicatedheretotheulnfinishedworkwhichtheyw
@cjonstrup
cjonstrup / Laravel\app\commands\ViewsCommand.php
Last active August 1, 2019 21:17
Clear Laravel 4.* app/storage/views artisan views:clear
<?php
use Illuminate\Console\Command;
use Illuminate\Filesystem\Filesystem;
class ViewsCommand extends Command {
/**
* The console command name.
*
* @var string
# Before Script
before_script:
- composer self-update
- composer install --prefer-dist > /dev/null
- cp .env.example .env
- php artisan key:generate
- php artisan migrate:refresh
# Services
services:
@andjc
andjc / myanmar.css
Last active November 16, 2020 02:13
Skeleton CSS file for languages written in the Myanmar script.
/* @import url(http://fonts.googleapis.com/earlyaccess/notosansmyanmar.css); */
/* @import url(http://fonts.googleapis.com/earlyaccess/padauk.css); */
@counter-style hyphen {
system: cyclic;
symbols: "-";
suffix: " ";
}
@counter-style myanmar-parens {
@JeffreyWay
JeffreyWay / PhotoApiTest.php
Created May 21, 2013 22:37
Testing APIs in Laravel. Thoughts?
<?php
class PhotoApiTest extends TestCase {
public function setUp()
{
parent::setUp();
Route::enableFilters();
@eimg
eimg / mmstrlen.php
Created May 31, 2012 12:03
Count no. of syllabes in a Myanmar Unicode string.
<?php
function mmstrlen($str) {
$standalones = array("ဤ", "၍", "ဪ", "၏", "၊", "။", "၌");
$consonants = array("က", "ခ", "ဂ", "ဃ", "င", "စ", "ဆ", "ဇ", "ဈ", "ည", "ဍ", "ဌ", "ဋ", "ဎ", "ဏ", "တ", "ထ", "ဒ", "ဓ", "န", "ပ", "ဖ", "ဗ", "ဘ", "မ", "ယ", "ရ", "လ", "ဝ", "သ", "ဟ", "ဠ", "အ");
$numbers = array("၀", "၁", "၂", "၃", "၄", "၅", "၆", "၇", "၈", "၉");
$len = mb_strlen($str, "UTF-8");
$count = 0;
for($i = 0; $i < $len; $i++) {