Skip to content

Instantly share code, notes, and snippets.

View dmtintner's full-sized avatar

David Tintner dmtintner

View GitHub Profile
@dmtintner
dmtintner / gist:566e93ccccfb871774d0
Last active August 29, 2015 14:19 — forked from r3wt/gist:83629275bd3a153915ef
Rollback HHVM to 3.5.1 because HHVM 3.6 is not working with nginx
1. go to http://dl.hhvm.com/ubuntu/pool/main/h/hhvm/ and right click and copy the link to the version of hhvm you want to rollback to
2. sudo apt-get autoremove hhvm -y
3. wget <link you just copied>
4. sudo dpkg -i <name of file u just downloaded>
5. sudo apt-get install -f
6. sudo service hhvm start
Edit: Don't worry when it errors out on step 4. that is expected. just continue to step 5.
@dmtintner
dmtintner / analytics.js
Last active October 21, 2022 17:49
HackingUI.Analytics
hackingUi = hackingUi || {};
hackingUi.Analytics = {
trackEvent: function(category, action, label) {
var eventObject = {
'eventCategory': category,
'eventAction': action
},
mixpanelName = category;
if (label) {
(function ($) {
$.fn.stickyHeader = function (options) {
var $window = $(window);
var settings = $.extend({}, $.fn.stickyHeader.defaults, options);
return $(this).each(function () {
var $table = $(this),
@dmtintner
dmtintner / sw-api-crm.js
Last active January 4, 2016 20:09
SimilarWeb API - CRM
var SW = {
baseUrl : 'http://api.similarweb.com/site/',
nonCompanyEmails : ['gmail.com', 'yahoo.com', 'hotmail.com', 'aol.com', 'googlemail.com'],
notEnoughDataText : '--',
subdomainText : 'Subdomain',
unknownSiteText : 'n/a',
fetchOptions : {
"muteHttpExceptions" : true, // needed so we can get status code of response
},
@dmtintner
dmtintner / counter
Last active December 24, 2015 18:39
A counter for displaying a formatted number based off of the current date in milliseconds and animating its change
Counter = function(){
var n = Math.round((Date.now() - 1380990000000)/1000),
nFormatted = addCommasToNumber(n),
delay = 10;
$('#number').html(nFormatted);
setInterval(function(){
var finish = Math.round((Date.now() - 1380990000000)/1000),
currentVal = finish-delay;
@dmtintner
dmtintner / headline-carousel.js
Created February 14, 2013 16:02
background image carousel
@dmtintner
dmtintner / sidebar-fixed.js
Created February 14, 2013 16:00
sidebar becomes fixed position after scroll x amount
$(function(){
if (isMobile())
return;
// Back To Top Button and fixed sidebar
var backToTopButton = $('#back-to-top');
var sidebar = $('#sidebar');
var footer = $('#footer');
var headerOuterHeight = $('#header').outerHeight();
@dmtintner
dmtintner / wp_query.php
Created June 24, 2012 18:18
Perfect wp_query usage
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<div class="faculty-post">
<h3><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h3>
</div><!-- closes .faculty-post -->
<div class="clear"></div>
@dmtintner
dmtintner / faculty_meta.php
Created June 19, 2012 15:03
WPAlchemy Multiple Wordpress TinyMCE editors using wp_editor
<p>
<label>Publications</label>
<?php
$mb->the_field('publications');
$val = html_entity_decode($mb->get_the_value());
$id = $mb->get_the_name();
$settings = array(
'textarea_rows' => 6,
'quicktags' => array(