Latest Posts

FACTS

Date: 02/15/2017, Author: Lostwake, Category: Other

Its a fact.

Settings for JS Datepicker only allow Weekdays and Future Days

Date: 02/10/2017, Author: Lostwake, Category: JavaScript

Here is how it is done

<p>Date: <input type="text" id="datepicker"></p>

$("#datepicker").datepicker({
beforeShowDay: function(date) {
var day = date.getDay();
return [day == 1 || day == 2 || day == 3 || day == 4 || day == 5,""];
},
minDate: 1
});

Bootstrap Carousel That Fades Insteade of Slides

Date: 12/21/2016, Author: Lostwake, Category: CSS Tricks

Source: http://www.1squarepear.com/adding-a-responsive-bootstrap-image-carousel-that-fades-instead-of-slides/

Demo: http://www.1squarepear.com/_docs/bootstrap_carousel_fade.html

 

Make a normal bootstrap carousel and add this to your css code:

.carousel-fade .carousel-inner .item {
  -webkit-transition-property: opacity;
  transition-property: opacity;
}
.carousel-fade .carousel-inner .item,
.carousel-fade .carousel-inner .active.left,
.carousel-fade .carousel-inner .active.right {
  opacity: 0;
}
.carousel-fade .carousel-inner .active,
.carousel-fade .carousel-inner .next.left,
.carousel-fade .carousel-inner .prev.right {
  opacity: 1;
}
.carousel-fade .carousel-inner .next,
.carousel-fade .carousel-inner .prev,
.carousel-fade .carousel-inner .active.left,
.carousel-fade .carousel-inner .active.right {
  left: 0;
  -webkit-transform: translate3d(0, 0, 0);
          transform: translate3d(0, 0, 0);
}
.carousel-fade .carousel-control {
  z-index: 2;
}

REGEX Get Everything in a Pattern

Date: 12/21/2016, Author: Lostwake, Category: PHP Quick Reference

Great REGEX tip for getting almost any pattern:

preg_match ('/[Slide](.*?)[/Slide]/s', $content, $matches);

Be Annoying and Alert Visitors Before They Leave Your Page

Date: 12/18/2016, Author: Lostwake, Category: JavaScript

Don't reinvent the wheel:

So before you think about implementing those solutions and all required workarounds, realize you're reinventing the wheel and you're prone to running into problems others have already solved for you.

If your application already uses jQuery, you may as well use tested, maintained code instead of rolling your own, and use a third-part library for all of this. jQuery's Are You Sure? plugin works great, see their demo page. It's as simple as this:

<script src="jquery.are-you-sure.js"></script>

<script>
  $(function() {
    $('#myForm').areYouSure(
      {
        message: 'It looks like you have been editing something. '
               + 'If you leave before saving, your changes will be lost.'
      }
    );
  });

</script>




Source: http://stackoverflow.com/questions/7317273/warn-user-before-leaving-web-page-with-unsaved-changes

I got these from this guy: https://invoiced.com/blog/write-invoice-emails-that-get-paid

 

See What Your Page Looks Like On Facebook and Update It

Date: 12/08/2016, Author: Lostwake, Category: Computer & Web

This is where to go if you want to see how your webpage looks on facebook when it is shared. Also it allows you to update the preview image and clear any caches facebook may be holding on to.

 

https://developers.facebook.com/tools/debug/og/object/

Good Writer Service

Date: 12/05/2016, Author: Lostwake, Category: Computer & Web

Good service to find content writers

https://www.iwriter.com/

I found the best solution was to use the base tag. Add the following to the head of the page in the iframe:

<base target="_parent" />

This will load all links on the page in the parent window. If you want your links to load in a new window, use:

<base target="_blank" />

This tag is fully supported in all browsers.

show multiple recaptchas on a single page?

Date: 11/28/2016, Author: Lostwake, Category: JavaScript

There is no need to clone the recaptcha nor try to workaround the problem. You just have to put multiple div elements for the recaptchas and render the recaptchas inside them explicitly.

This is easy with the google recaptcha api:
https://developers.google.com/recaptcha/docs/display#explicit_render

Here is the example html code:

<form>
    <h1>Form 1</h1>
    <div><input type="text" name="field1" placeholder="field1"></div>
    <div><input type="text" name="field2" placeholder="field2"></div>
    <div id="RecaptchaField1"></div>
    <div><input type="submit"></div>
</form>

<form>
    <h1>Form 2</h1>
    <div><input type="text" name="field3" placeholder="field3"></div>
    <div><input type="text" name="field4" placeholder="field4"></div>
    <div id="RecaptchaField2"></div>
    <div><input type="submit"></div>
</form>

In your javascript code, you have to define a callback function for recaptcha:

<script type="text/javascript">
    var CaptchaCallback = function() {
        grecaptcha.render('RecaptchaField1', {'sitekey' : '6Lc_your_site_key'});
        grecaptcha.render('RecaptchaField2', {'sitekey' : '6Lc_your_site_key'});
    };
</script>

After this, your recaptcha script url should look like this:

<script src="https://www.google.com/recaptcha/api.js?onload=CaptchaCallback&render=explicit" async defer></script>


Source: http://stackoverflow.com/questions/1241947/how-do-i-show-multiple-recaptchas-on-a-single-page