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 | |
| public function replicateWithRelations(QuestionCategory $questioncategory) | |
| { | |
| $newCategory = $questioncategory->replicate(); | |
| $newCategory->name = "Kopyası: ".$questioncategory->name; | |
| $newCategory->push(); | |
| $questioncategory->relations = []; | |
| //load relations on EXISTING MODEL |
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
| ^(?=.*\d)(?=.*[a-z])[\w~@#$%^&*+=`|{}:;!.?\"()\[\]-]{6,8}$ |
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 | |
| /** | |
| * Calculate how much a profile is completed | |
| * | |
| * @param $profile | |
| * @return float|int | |
| */ | |
| function calculate_profile($profile) | |
| { | |
| if ( ! $profile) { |
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
| <script> | |
| function printDiv(divName){ | |
| var printContents = document.getElementById(divName).innerHTML; | |
| var originalContents = document.body.innerHTML; | |
| document.body.innerHTML = printContents; | |
| window.print(); | |
| document.body.innerHTML = originalContents; |
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
| # FORCE PORT 80 (insecure / regular traffic) | |
| RewriteEngine On | |
| RewriteCond %{HTTPS} on | |
| RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] | |
| ########################################################### | |
| #FORCE PORT 443 && REMOVE WWW. (secure / SSL) | |
| RewriteCond %{SERVER_PORT} 80 | |
| RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R,L] |
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 CryptoJS = require('crypto-js'); | |
| function uploadImage(uri) { | |
| let timestamp = (Date.now() / 1000 | 0).toString(); | |
| let api_key = 'your api key' | |
| let api_secret = 'your api secret' | |
| let cloud = 'your cloud name' | |
| let hash_string = 'timestamp=' + timestamp + api_secret | |
| let signature = CryptoJS.SHA1(hash_string).toString(); | |
| let upload_url = 'https://api.cloudinary.com/v1_1/' + cloud + '/image/upload' |
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 | |
| /** | |
| * Find Damerau–Levenshtein distance between two string | |
| * | |
| * @param string $source | |
| * @param string $dest | |
| * @return int Damerau–Levenshtein distance | |
| */ | |
| function distance($source, $dest) |
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 | |
| /* | |
| * Remote File Copy PHP Script 2.0.0 | |
| * | |
| * Copyright 2012, Sebastian Tschan | |
| * https://blueimp.net | |
| * | |
| * Licensed under the MIT license: | |
| * http://www.opensource.org/licenses/MIT | |
| */ |
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
| $(document).ready(function($) { | |
| if(window.location !== window.parent.location){ | |
| $('header, footer').hide(); | |
| } | |
| }); |
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 | |
| // Converts a number into a short version, eg: 1000 -> 1k | |
| // Based on: http://stackoverflow.com/a/4371114 | |
| function number_format_short( $n, $precision = 1 ) { | |
| if ($n < 900) { | |
| // 0 - 900 | |
| $n_format = number_format($n, $precision); | |
| $suffix = ''; | |
| } else if ($n < 900000) { |