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
@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);
}
@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: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: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)); }
}
// 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:3bb14f06bb6ae874ee8e
Last active June 2, 2017 22:11
Javascript Patterns
https://carldanley.com/javascript-design-patterns/
https://carldanley.com/js-factory-pattern/
https://www.airpair.com/node.js/posts/top-10-mistakes-node-developers-make
https://projects.tessel.io/projects/enviroreport-web-dashboard-for-climate-module
https://github.com/chaivrep/EnviroReport
http://blog.mongodb.org/post/65517193370/schema-design-for-time-series-data-in-mongodb
@awatson1978
awatson1978 / gist:58181df67a66863f1cf0
Created April 3, 2015 16:56
Publishing a Command Line Tool in a Package
First you'll need an NPM package.
http://www.bennadel.com/blog/2329-building-executable-scripts-for-the-mac-osx-command-line-with-node-js.htm
Then you'll need to publish it.
https://gist.github.com/coolaj86/1318304
Then you'll need to add it to an atomsphere package.
https://github.com/awatson1978/meteor-cookbook/blob/master/cookbook/packages.md
````sh