Skip to content

Instantly share code, notes, and snippets.

View joshdcomp's full-sized avatar

Josh Compton joshdcomp

View GitHub Profile
@joshdcomp
joshdcomp / accellerating-decromancer.js
Last active November 23, 2015 21:20
making increments smaller
var decremancer = function(iterations, unit, time) {
for (var i = 0; i < iterations; i++) {
//set increments to `unit`
}
//where you'd determine the rate things get smaller
var newTime = time - 100;
//stop when the time gets too small
if (newTime < 0) return;
//DECROMANCE
@joshdcomp
joshdcomp / clearparam.js
Created July 9, 2015 18:11
Reading and removing a get param from a URL
/**
* Clear a specific get param from a url and replace it in window history
*/
function clearParam(param) {
// Get the querystring as a hash
var params = window.queryParams();
// Remove the param
delete params[param];
// Quickest way to remove the whole querystring, which is fine because we're rebuidling it anyway
var href = window.location.href.split("?")[0];
@joshdcomp
joshdcomp / functions.php
Created May 5, 2015 14:43
Building the post thumbnail markup based on the original size
<?php
/**
* Given a post ID, return the permalink for the original size post thumbnail
*
* @param int $ID post id
* @return string deep link for a post thumbnail
*/
function _thumb_link($ID) {
$toReturn = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
return $toReturn[0];
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
@joshdcomp
joshdcomp / Gruntfile.js
Last active August 29, 2015 14:20
Super generic grunt file/setup for less
// This was set up using the help of this tut:
//http://merrickchristensen.com/articles/gruntjs-workflow.html
module.exports = function(grunt) {
// grunt.loadNpmTasks('grunt-contrib-jshint'); // load lint
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
@joshdcomp
joshdcomp / .bash_profile
Created April 27, 2015 14:45
Git completion and vim syntax sugar
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
@joshdcomp
joshdcomp / content.scss
Last active August 29, 2015 14:19
how I'd make a
@keyframes content-peep{
//bounce frames
}
.content{
margin-top: 100vh;
&-is_peeping{
animation: content-peep 200ms 1 500ms;
}
@joshdcomp
joshdcomp / fonts.scss
Created March 27, 2015 19:27
Complex data structures
$_helvetica: (
'font-family': #{"Helvetica", sans-serif},
'font-weight': (
'default': 300,
'light': 100,
'normal': 300,
'semi-bold': 500,
'bold': 700
),
'line-height': 1.3,
//trollolololololol
@function gray($shade){
@debug "You spelled *grey* wrong";
@return rgb($shade, $shade, $shade);
}
@function grey($shade){
@debug "You spelled *gray* wrong";
@return rgb($shade, $shade, $shade);
}
@joshdcomp
joshdcomp / bling.js
Created February 5, 2015 20:21
code questions
function Bling(ice){
this.ice = ice;
this.thing();
$('.do_thing').on('click', function(){
console.log(this.ice);
});
}