Skip to content

Instantly share code, notes, and snippets.

View awatson1978's full-sized avatar
🏠
Working from home

Abigail Watson awatson1978

🏠
Working from home
View GitHub Profile
// Disables scroll except for allowed elements that prevent touchmove event propagation
$(document).on('touchmove', function(event){
event.preventDefault();
});
// Elements which are allowed touchmove event (by stopping event propagation to document)
$('body').on('touchmove','.scrollable, nav', function(event) {
event.stopPropagation();
});
// Prevents scrollable elements from ever reaching the end of scroll, and thus prevents scroll overflow on ipad
$('body').on('touchstart','.scrollable', function(event) {
@awatson1978
awatson1978 / gist:a46c9adc72c2762b9a03
Created October 11, 2014 05:26
Crazy Wacky Wandering Font
@-webkit-keyframes spin {
0% { .transform(rotate(0deg)); }
100% { .transform(rotate(359deg)); }
}
@keyframes spin {
0% { .transform(rotate(0deg)); }
100% { .transform(rotate(359deg)); }
}
@awatson1978
awatson1978 / gist:828521fed954c5d2b23b
Last active June 2, 2017 21:43
Extract Ids From Template/Page
// the following will return an array of elements with ids set
$('[id]')
// so one would need something like this....
var elements = $('[id]');
var idsArray = [];
elements.forEach(function(element){
idsArray.push(element.id);
});
@awatson1978
awatson1978 / gist:a0df5fef953b9da01ce1
Last active May 19, 2017 11:57
Publish an Atom Package
command-shift-P > Package > Package Generator: Generate Syntax Theme > mypackage
cd ~/.atom/packages/mypackage
apm login
apm develop mypackage
cd ~/github/mypackage
sudo chown -R username:wheel .
git commit -a -m 'checking everything in'
apm publish --tag v2.5.0 minor
@awatson1978
awatson1978 / gist:9744515
Created March 24, 2014 17:03
db.mycollection.find({ _id: { $gt: objectIdWithTimestamp('1980/05/25') } });
// This function returns an ObjectId embedded with a given datetime
// Accepts both Date object and string input
function objectIdWithTimestamp(timestamp)
{
// Convert string date to Date object (otherwise assume timestamp is a date)
if (typeof(timestamp) == 'string') {
timestamp = new Date(timestamp);
}