Skip to content

Instantly share code, notes, and snippets.

Mohammad Redolance

Block or report user

Report or block Redolance

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
Redolance / preview-image-in-browser.html
Created Jun 14, 2018
preview image in browser object URLs
View preview-image-in-browser.html
<!-- The following code uses object URLs, which is much more efficient than data URL for viewing large images (A data URL is a huge string containing all of the file data, whereas an object URL, is just a short string referencing the file data in-memory):
<!-- java script only -->
<img id="blah" alt="your image" width="100" height="100" />
<input type="file" onchange="document.getElementById('blah').src = window.URL.createObjectURL(this.files[0])">
<!-- version jquery. -->
Redolance / js-FileReader-for-image-without-upload.html
Last active Jun 14, 2018
preview image on browser before ubload js
View js-FileReader-for-image-without-upload.html
<form id="form1" runat="server">
<input type='file' id="imgInp" />
<img id="blah" src="#" alt="your image" />
function readURL(input) {
Redolance / get_param.js
Created Jun 13, 2018
get param from url with jquery
View get_param.js
// the function
$.urlParam = function(name){
var results = new RegExp('[\?&]' + name + '=([^]*)').exec(window.location.href);
if (results==null){
return null;
return results[1] || 0;
Redolance / create_or_update.php
Created Jun 13, 2018
Create custom filed , or just update it if its already exist .
View create_or_update.php
$deal_id = $_POST['deal_id'];
if ( get_post_meta($deal_id, 'redo_expired_votes', true) ){
$ex_votes = get_post_meta($deal_id, 'redo_expired_votes', true);
$ex_vote = $ex_votes + 1;
update_post_meta($deal_id,'redo_expired_votes', $ex_vote);
add_post_meta($deal_id, 'redo_expired_votes', '1', true);
You can’t perform that action at this time.