Skip to content

Instantly share code, notes, and snippets.

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

Set Kyar Wa Lar (Universe) setkyar

🧘‍♂️
View GitHub Profile
@setkyar
setkyar / routes.php
Created January 5, 2016 07:51
Log Route Example
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
use Monolog\Formatter\LineFormatter;
use Monolog\Formatter\JsonFormatter;
Route::get('/test', function() {
$user_info = [
'request_time' => date('Y-m-d H:m:i'),
'request_url' => $request->url(),
@setkyar
setkyar / line_break_canvas.html
Created March 15, 2016 11:01
Line break on canvas
<canvas id="myCanvas" width="720" height="379" style="border:1px solid"></canvas>
function wrapText(context, text, x, y, maxWidth, lineHeight) {
var words = text.split(' ');
var line = '';
for (var n = 0; n < words.length; n++) {
var testLine = line + words[n] + ' ';
var metrics = context.measureText(testLine);
var testWidth = metrics.width;
if (testWidth > maxWidth && n > 0) {
@setkyar
setkyar / social-helpers.php
Last active June 19, 2016 04:50
Laravel Social Share Helper
<?php
function createFacebookShare($url, $title)
{
return '
<a href="http://www.facebook.com/share.php?u='. $url .'&title='. $title .'"><i class="fa fa-facebook-square"></i> SHARE</a>
';
}
function createTwitterShare($url, $title)
<?php
/**
* Get Google Page Speed Screenshot
*
* Uses Google's Page Speed API to generate a screenshot of a website.
* Returns the image as a base64 jpeg image tag
*
* Usage Example:
* echo getGooglePageSpeedScreenshot("http://ghost.org", 'class="thumbnail"');
*
@setkyar
setkyar / stacks.js
Created February 28, 2018 03:17
Stacks (Solution)
var Stack = function(){
this.storage = {};
this.count = 0;
};
Stack.prototype.push = function(val) {
this.storage[this.count++] = val;
return this.count;
}
# 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: