Skip to content

Instantly share code, notes, and snippets.

View cranderveldt's full-sized avatar

Trevor cranderveldt

View GitHub Profile
@cranderveldt
cranderveldt / topic-detection
Created March 2, 2014 23:39
New topic detection
`last_forum_visit` timestamp when you land on a forum/section/topic
`visited_forum_topics` array containing objects related to topics you've marked as read or visited.
: each object in this array contains the topic ID and the date marked as read
### A topic is considered **New** if
The topic ID is missing from the `visited_forum_topics` array AND it is not more than 2 weeks old
or
@cranderveldt
cranderveldt / select-wrap
Last active August 29, 2015 14:01
Holy grail of styling select elements
SASS:
.select-wrap {
background: #3a3c42;
position: relative;
color: #FFF;
height: 34px;
cursor: pointer;
&:hover {
background: #474b5a;
@cranderveldt
cranderveldt / one-selector
Created August 11, 2014 19:30
This is why you don't rely solely on the @extend feature of sass
.row.narrow-gutters .col-xs-1, form .row .col-xs-1, form .home-page .sections .col-xs-1, .home-page form .sections .col-xs-1, form .about-page .sections .col-xs-1, .about-page form .sections .col-xs-1, form .profile-page .sections .col-xs-1, .profile-page form .sections .col-xs-1, form .blog-page .sections .col-xs-1, .blog-page form .sections .col-xs-1, .home-page .narrow-gutters.sections .col-xs-1, .about-page .narrow-gutters.sections .col-xs-1, .profile-page .narrow-gutters.sections .col-xs-1, .blog-page .narrow-gutters.sections .col-xs-1, .row.narrow-gutters .col-xs-2, form .row .col-xs-2, form .home-page .sections .col-xs-2, .home-page form .sections .col-xs-2, form .about-page .sections .col-xs-2, .about-page form .sections .col-xs-2, form .profile-page .sections .col-xs-2, .profile-page form .sections .col-xs-2, form .blog-page .sections .col-xs-2, .blog-page form .sections .col-xs-2, .home-page .narrow-gutters.sections .col-xs-2, .about-page .narrow-gutters.sections .col-xs-2, .profile-page .narrow-gut
.select-wrap {
background: #bdc3cb;
position: relative;
color: #FFF;
height: 34px;
@include round(4px);
cursor: pointer;
&:hover {
background: darken(#bdc3cb, 10%);
}
for (var one in types) {
console.log('new one');
for (var two in types) {
console.log('new two');
for (var three in types) {
for (var four in types) {
for (var five in types) {
for (var six in types) {
if (!anyDupes(one, two, three, four, five, six) && isNewCombo(one, two, three, four, five, six)) {
for (var one_super in types[one].super_effective) {
@cranderveldt
cranderveldt / magfest
Created January 16, 2015 17:58
MAGFest Schedule Conversion
//! moment.js
//! version : 2.9.0
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
//! license : MIT
//! momentjs.com
(function(a){function b(a,b,c){switch(arguments.length){case 2:return null!=a?a:b;case 3:return null!=a?a:null!=b?b:c;default:throw new Error("Implement me")}}function c(a,b){return Bb.call(a,b)}function d(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1}}function e(a){vb.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+a)}function f(a,b){var c=!0;return o(function(){return c&&(e(a),c=!1),b.apply(this,arguments)},b)}function g(a,b){sc[a]||(e(b),sc[a]=!0)}function h(a,b){return function(c){return r(a.call(this,c),b)}}function i(a,b){return function(c){return this.localeData().ordinal(a.call(this,c),b)}}function j(a,b){var c,d,e=12*(b.year()-a.year())+(b.month()-a.month()),f=a.clone().add(e,"months");return 0>b-f?(c=a
@cranderveldt
cranderveldt / main.js
Created February 2, 2015 17:52
Using hover intent
jQuery('.no-scroll-up .nav-top-level li.trigger-hover a, .no-scroll-up .drop-nav').hoverIntent(function(){
$('#main-nav').addClass('hovering');
}, function(){
$('#main-nav').removeClass('hovering');
});
jQuery('.scrolling-up .nav-top-level li.trigger-hover a, .scrolling-up .drop-nav').hover(function(){
$('#main-nav').addClass('hovering');
}, function(){
$('#main-nav').removeClass('hovering');
@cranderveldt
cranderveldt / code.txt
Last active August 29, 2015 14:27
Code
@mixin intrinsic-ratio($selector: '.scalable', $ratio: 56.25%) {
position: relative;
padding-bottom: $ratio;
height: 0px;
#{$selector} {
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
@cranderveldt
cranderveldt / partners-more-if-statement
Created April 27, 2012 17:38
Partners More if statement
{exp:channel:entries channel="partners" disable="member_data|categories|pagination" status="open"}
{if partner_logo == ""}
<li class="clearfix">
<a href="{partner_link}"><h4>{title}</h4></a>
<p>{partners_summary}</p>
</li>
{sv_edit_me}
{/if}
{/exp:channel:entries}
@cranderveldt
cranderveldt / Sample Lightbox
Created June 4, 2012 20:12
Sample Lightbox
<a href="#" data-reveal-id="sample-lightbox">Click for lightbox</a>
<div id="sample-lightbox" class="reveal-modal">
Lightbox content
<a class="close-reveal-modal">&#215;</a>
</div>