Skip to content

Instantly share code, notes, and snippets.

🔍
Looking for it

Justin Allen justinallen

🔍
Looking for it
Block or report user

Report or block justinallen

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
@justinallen
justinallen / wget-example.txt
Created Sep 17, 2016
wget download website
View wget-example.txt
$ wget \
--recursive \
--no-clobber \
--page-requisites \
--html-extension \
--convert-links \
--domains example.us \
--no-parent \
example.us
@justinallen
justinallen / social.html
Last active Jan 21, 2016
simple social buttons for an mvc template
View social.html
<div class="share-bar">
<h5>Share on:</h5>
<a href="https://twitter.com/intent/tweet?text={{title}}&url={{absoluteUrl}}&via={{twitterUser}}&related={{twitterUser}}" rel="nofollow" target="_blank" title="Share on Twitter">
<img src="/images/social-icons/twitter.png" alt="twitter icon">
</a>
<a href="https://facebook.com/sharer.php?u={{absoluteUrl}}" rel="nofollow" target="_blank" title="Share on Facebook">
<img src="/images/social-icons/facebook.png" alt="facebook icon">
</a>
<a href="https://plus.google.com/share?url={{absoluteUrl}}" rel="nofollow" target="_blank" title="Share on Google+">
<img src="/images/social-icons/googleplus.png" alt="google plus icon">
View grab-a-hash.js
var hash = window.location.hash;
if (hash == "#hashish" || pathArray[0] == "#hashish") {
// do stuff
}
@justinallen
justinallen / validate-email.js
Created Oct 7, 2015
quick basic email validation in javascript
View validate-email.js
// returns false unless valid
function validateEmail(email)
{
var re = /\S+@\S+\.\S+/;
return re.test(email);
}
View labels-to-placeholders.js
// takes a parent el (like a li) and goes to work on its children
// assumes the parent has one label and one input
function labelsToPlaceholders(parent) {
$(parent).each( function(index){
$(this).children('label').css('display', 'none');
labelText = $(this).children('label').text();
labelText = labelText.slice(0,-1);
// console.log(labelText);
$(this).children('input').attr('placeholder', labelText);
@justinallen
justinallen / back-to-top.js
Last active Sep 30, 2015
back to top button
View back-to-top.js
$("#back_to_top").click(function(e){
e.preventDefault();
$('html, body').animate({scrollTop:0}, 'slow');
});
@justinallen
justinallen / jekyll-reading-time.js
Created Apr 18, 2015
Jekyll Reading Time Estimator - JavaScript
View jekyll-reading-time.js
// reading time
$('#reading-time').html(function(){
var wordcount = $('#wordcount').text();
timetoread = Math.round(wordcount / 200);
readmessage = timetoread + " min read";
return readmessage;
});
@justinallen
justinallen / jekyll-reading-time-template.html
Last active Aug 29, 2015
Jekyll Reading Time Estimator - Template Snippet
View jekyll-reading-time-template.html
<!-- drop this into your post.html or other page template -->
<div id="reading-time"></div>
<span id="wordcount" style="display:none">{{ content | number_of_words }}</span>
@justinallen
justinallen / jekyll-basic-pagination-for-posts.html
Last active Aug 29, 2015
jekyll - basic pagination for posts
View jekyll-basic-pagination-for-posts.html
<div class="pagination">
{% if page.previous %}
<a class="pagination-item older" href="{{page.previous.url}}">Older</a>
{% else %}
<span class="pagination-item older">Older</span>
{% endif %}
{% if page.next %}
<a class="pagination-item newer" href="{{page.next.url}}">Newer</a>
{% else %}
<span class="pagination-item newer">Newer</span>
View just-bootstrap-media-queries.css
/* Bootstrap's Media Queries */
/* Large desktop */
@media (min-width: 1200px) { ... }
/* Portrait tablet to landscape and desktop */
@media (min-width: 768px) and (max-width: 979px) { ... }
/* Landscape phone to portrait tablet */
@media (max-width: 767px) { ... }
You can’t perform that action at this time.