This file contains 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
app.directive('inputMaxlength', function() { | |
return { | |
require: 'ngModel', | |
link: function (scope, element, attrs, ngModelCtrl) { | |
var maxlength = Number(attrs.inputMaxlength); | |
function fromUser(text) { | |
if (text.length > maxlength) { | |
var transformedInput = text.substring(0, maxlength); | |
ngModelCtrl.$setViewValue(transformedInput); | |
ngModelCtrl.$render(); |
This file contains 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
$scope.onFileSelect = function($files) { | |
// https://github.com/danialfarid/angular-file-upload | |
var file = $files[0]; | |
$scope.upload = $upload.upload({ | |
url: apiEndpoint + '/api/file/upload', | |
// method: 'POST' or 'PUT', | |
// headers: {'header-key': 'header-value'}, | |
// withCredentials: true, | |
//data: {myObj: $scope.myModelObj}, | |
file: file, // or list of files: $files for html5 only |
This file contains 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
$font-mdi : 'Material-Design-Icons'; | |
$mdi-prefix : 'mdi-'; | |
@font-face { | |
font-family: "#{$font-mdi}"; | |
src:url("#{$icons-font-path}#{$font-mdi}.eot?#iefix") format("embedded-opentype"), | |
url("#{$icons-font-path}#{$font-mdi}.woff2") format("woff2"), | |
url("#{$icons-font-path}#{$font-mdi}.woff") format("woff"), | |
url("#{$icons-font-path}#{$font-mdi}.ttf") format("truetype"), | |
url("#{$icons-font-path}#{$font-mdi}.svg##{$font-mdi}") format("svg"); |
This file contains 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 | |
/* | |
* deleteSubField | |
* | |
* This function will delete a value of a sub field entirely and replace the rows correctly. | |
* ACF's built in delete_sub_field only sets the value to null | |
* | |
* @param $field_key (string) the field key of the top level custom field | |
* @param $repeater_key (string) the field key of the repeater element | |
* @param $post_id (int) the post_id of which the repeater is stored in |
This file contains 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
/* | |
* Displaying a single value's Label | |
*/ | |
$field = get_field_object('field_name'); | |
$value = get_field('field_name'); | |
$label = $field['choices'][ $value ]; |
This file contains 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 | |
/** | |
* [Gets the top most parent of a post. If post is top most parent, returns ID] | |
* @return int [ID of top most parent] | |
*/ | |
function get_earliest_relative($post){ | |
if ($post->post_parent){ | |
$ancestors=get_post_ancestors($post->ID); | |
$root=count($ancestors)-1; | |
$parent = $ancestors[$root]; |
This file contains 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 | |
$loader = new PemLoader(); | |
$math = EccFactory::getAdapter(); | |
$this->messages = new MessageFactory($math); | |
$privKeySerializer = new PemPrivateKeySerializer(new DerPrivateKeySerializer()); | |
$pubKeySerializer = new PemPublicKeySerializer(new DerPublicKeySerializer()); | |
$PrivateKeyPath = env('KEY_LOCATION').'my.priv'; | |
$PublicKeyPath = storage_path().'/app/'.uniqid().'.pub'; |
This file contains 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 currencyValidator = { | |
format: function (number) { | |
return (Math.trunc(number * 100) / 100).toFixed(2) | |
}, | |
parse: function (newString, oldNumber) { | |
var CleanParse = function (value) { | |
return { value: value } | |
} | |
var StringParse = function (string) { | |
return parseFloat(string.replace(/,/g, '')) |
This file contains 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\Http\Middleware; | |
use Closure; | |
class ValidateAuthyRequest { | |
/** | |
* Handle an incoming request. | |
* |