This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Print pretty errors | |
# Usage: pretty_error <type> <message> <name> | |
pretty_error() | |
{ | |
# Text colors | |
COLOR_NONE='\033[0m' | |
COLOR_RED='\033[0;31m' | |
COLOR_GREEN='\033[0;32m' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>AdjustWindowForFontSizeChange</key> | |
<true/> | |
<key>AllowClipboardAccess</key> | |
<true/> | |
<key>AnimateDimming</key> | |
<true/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sed -E "s/^$1=[^ ]*$/$1=$2/g" $3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.fn.format = function() { | |
return this.each(function() { | |
var $this = $(this); | |
var time = $this.attr("datetime"); | |
var localTime = moment.utc(time).local().format(); | |
$this.attr("datetime", localTime).timeago(); | |
return this; | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Validator::extend('image_uri', function($attribute, $value, $parameters, $validator) { | |
$matches = []; | |
$pattern = '/^data:image\/(jpe?g|png|bmp|gif|svg);base64\,.+$/'; | |
return preg_match($pattern, $value, $matches) > 0 && in_array($matches[1], $parameters); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var activities = { | |
resting: { bpm: 70 }, | |
walking: { bpm: 90 }, | |
running: { bpm: 150 }, | |
}; | |
var activityStatus = { | |
previousActivity: activities.resting, | |
activity: activities.resting, | |
inTransition: false, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Auth from '../../modules/Auth'; | |
const LOGIN_NAMED_ROUTE = 'login'; | |
const EXPIRED_ERROR = 'token_expired'; | |
export default function () { | |
return { | |
request: (request) => { | |
let token = Auth.token(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Support; | |
class Str extends \Illuminate\Support\Str | |
{ | |
/** | |
* Returns the searchable string. | |
* | |
* @param string $string String to convert |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use PhpCsFixer\Config; | |
use PhpCsFixer\Finder; | |
$rules = [ | |
'array_syntax' => ['syntax' => 'short'], | |
'binary_operator_spaces' => ['align_equals' => false], | |
'blank_line_after_namespace' => true, | |
'blank_line_after_opening_tag' => true, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default class FileReaderPromise { | |
constructor(file) { | |
this.file = file; | |
} | |
readAsText() { | |
return new Promise((resolve, reject) => { | |
const reader = new FileReader(); | |
reader.onload = e => resolve(e.target.result); | |
reader.onerror = e => reject(new Error(`Error reading ${this.file.name}: ${e.target.result}`)); |
OlderNewer