Skip to content

Instantly share code, notes, and snippets.

View garystorey's full-sized avatar
:octocat:

Gary Storey garystorey

:octocat:
View GitHub Profile
@garystorey
garystorey / colors.js
Created May 16, 2013 19:35
Some colors
{
"color01" : "#384C73", // Dark Blue
"color02" : "#20465B", // Dark BlueGrey
"color03" : "#3B8376", // Dark Cyan/BlueGreen
"color04" : "#B00B1E", // Dark Red
"color05" : "#627FFB", // Mid Blue
"color06" : "#B3E2BA", // Light Green
"color07" : "#294D33", // Dark Forest Green
"color08" : "#CEB58A", // Tan
"color09" : "#C1D8A8", // Soft Green
@garystorey
garystorey / sp2013.js
Created May 16, 2013 21:41
Returns a SP 2013 query object by a query group name.
/**
* Returns a SP 2013 query object by a query group name.
*
* @method getQueryObjects
* @param {String} queryGroup Query group name.
* @return {Object} Returns a list of query objects.
*/
spx.query.getQueryObject = function (queryGroup) {
var hash = spx.getUrl().split('#')[1] || location.hash,
uri, resultQuery;
@garystorey
garystorey / nodelist2array.js
Created May 21, 2013 21:41
Converts a nodelist returned by QSA to an array.
var nodelist =document.querySelectorAll("div")
/* THIS - easier to type*/
var nodesArray = [].slice.call( nodelist );
/* OR */
var nodesArray = Array.prototype.slice.call( nodelist )
/* OR THE FASTEST (for Chrome anyway) */
var l = nl.length, arr = new Array( l );
@garystorey
garystorey / placeholder.css
Created May 24, 2013 19:27
Style placehoider text
::-webkit-input-placeholder { /* WebKit browsers */
color: #a5a5a5;
font-style: italic;
}
:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
color: #a5a5a5;
font-style: italic;
}
::-moz-placeholder { /* Mozilla Firefox 19+ */
color: #a5a5a5;
@garystorey
garystorey / column.css
Created May 28, 2013 19:49
newspaper style columns in CSS3
#content {
-moz-column-count: 4;
-webkit-column-count: 4;
}
@garystorey
garystorey / curry.js
Created May 28, 2013 20:45
curry function (is this still necessary?)
// this is doing binding and partial function application,
// so I thought bind was a more appropriate name
// The goal is that when you execute the returned wrapped version of fn, its this will be scope
function curry(fn, scope) {
// arguments is an implicit variable in every function that contains a full list
// of what was passed in. It is important to note that javascript doesn't enforce arity.
// since arguments is not a true array, we need to make it one.
// a handy trick for this is to use the slice function from array,
// since it will take arguments, and return a real array.
// we are storing it in a variable, because we will need to use it again.
@garystorey
garystorey / sass_functions.scss
Last active December 18, 2015 00:48
"Photoshop" drop shadow
/* Converts how Photoshop users think about Drop Shadow to CSS */
/* http://timhettler.github.io/cssconf-2013/#!/23 */
@function photoshop-shadow( $angle: 120, $distance: 0, $spread: 0, $size: 0, $color: #000, $inner: false ) {
$x-offset: round( cos( $angle ) * $distance );
$y-offset: round( sin( $angle ) * $distance );
$css-spread: $size * ( $spread/100 );
$blur: $size - $css-spread;
$inset: if( $inner != false, 'inset', '' );
@import 'compass/support';
/*
* Takes a single value or a list of values and replaces px units with rem
* Zero values will remain 0
* Non-px values will not be modified
*
* Example (with $base-font-size : 16px)
*
* $input : 0px 16px 2% 8px;
@garystorey
garystorey / scrolltotop.js
Last active December 18, 2015 15:49
Smooth scroll to top
// HTML:
// <h1 id="anchor">Lorem Ipsum</h1>
// <p><a href="#anchor" class="topLink">Back to Top</a></p>
$(document).ready(function() {
$("a.topLink").click(function() {
$("html, body").animate({
scrollTop: $($(this).attr("href")).offset().top + "px"
@garystorey
garystorey / loadonscroll.js
Last active December 18, 2015 15:49
Load content on scroll
var loading = false;
$(window).scroll(function(){
if((($(window).scrollTop()+$(window).height())+250)>=$(document).height()){
if(loading == false){
loading = true;
$('#loadingbar').css("display","block");
$.get("load.php?start="+$('#loaded_max').val(), function(loaded){
$('body').append(loaded);
$('#loaded_max').val(parseInt($('#loaded_max').val())+50);
$('#loadingbar').css("display","none");