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 | |
// 1 | |
$_POST['checkbox_2'] = true; | |
$_POST['checkbox_1'] = true; | |
$_POST['checkbox_3'] = true; | |
for ($_POST as $key => $val) { | |
if (preg_match('/checkbox_(\d+)/', $key, $matches)) { |
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 | |
// How to replace middle part of the word | |
// Array of words | |
$array = array('what', 'aaa', 'hellokity'); | |
// Function to return replaced value | |
// Accept value as a string and | |
// replacer as a character to replace each char in middle part of the word |
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 | |
/** | |
* proxy.php | |
* | |
* Responsible to get data from remote domain | |
* | |
* mod_rewrite configuration for .htaccess file | |
* | |
* RewriteEngine on |
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
function enc(exp, private) { | |
return Math.pow(exp, private) % 17; | |
} | |
function calc(pub1, private1, private2) { | |
var a, b; | |
a = enc(pub1, private1); | |
b = enc(pub1, private2); | |
return enc(b, private1) === enc(a, private2); | |
} |
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 | |
/** | |
* html2canvas proxy script | |
* | |
* Provides proxy service for html2canvas.js lib. | |
* Responsible for output javascript callback with image url | |
* to provide work around for the same origin limitation. | |
* | |
* Used to ensure that project images are included in the export PNGs, |
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
/** | |
* isFiles | |
* | |
* Returns true if user tries to drag or drop files | |
* | |
* @param {jQuery Event} e | |
* @return {Boolean} | |
*/ | |
isFiles: function(e) { | |
if ( ! is(e, 'object')) return 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
(function() { | |
"use strict"; | |
var loaded_css_urls = []; | |
function getFontById(fonts, id) { | |
var found_font; | |
fonts.some(function(font) { | |
if (font.id === id) { |
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
function check(s) { | |
var i = 0, l; | |
s = s.replace(/[^\{\}\(\)\[\]]/g, ""); | |
l = s.length; | |
if ( ! l) return true; | |
if (l % 2 !== 0) return 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
<?php | |
error_reporting(E_ALL & ~E_WARNING); | |
// cache time in seconds | |
$cache_time = 5 * 60; // 5 mins | |
$time = floor(time() / $cache_time) * $cache_time; | |
// Getting headers sent by the client. | |
$headers = apache_request_headers(); |
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
// [1,3,8,9,17] -> [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 ] | |
// Using recursion | |
var dates = [1,3,8,9,17]; | |
function nextI (i) {return i+1;} | |
function getMissingElements(nextI, element, currentNextElement) { | |
var nextElement = nextI(element); | |
if (nextElement === currentNextElement) { | |
return []; | |
} | |
return [nextElement].concat(getMissingElements(nextI, nextElement, currentNextElement)); |
OlderNewer