This gist's comment stream is a collection of webdev apps for OS X. Feel free to add links to apps you like, just make sure you add some context to what it does — either from the creator's website or your own thoughts.
— Erik
alias glp="git log --color -p | less -R" | |
alias glg="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit | less -R" | |
alias hlog='git log --date-order --all --graph --format="%C(green)%h %Creset%C(yellow)%an%Creset %C(blue bold)%ar%Creset %C(red bold)%d%Creset %s"' | |
alias cdg="cd \$(git rev-parse --show-toplevel)" |
'use strict'; | |
/* | |
# Javascript Prototyping Best Practices | |
* To create a class, create a constructor function with a `Name` and assign | |
it to a variable of the same `Name`. | |
* In this constructor only define properties using `this.prop` notation |
In the following post I would like to introduce one way how you can setup your testing workflow for JavaScript development. The central components in the testing environment are Grunt, Mocha and Chai that I will cover from the introduction and installation of each component to the cooperation of all components for the execution of tests.
If you are already an experienced Grunt user and just look for the Gruntfile.js and the Mocha / Chai setup just skip the central components section and skip to the installing components part.
You can find the sample project with all code at GitHub on: https://github.com/maicki/sample-js-testing-grunt-mocha-chai
function retry(isDone, next) { | |
var current_trial = 0, max_retry = 50, interval = 10, is_timeout = false; | |
var id = window.setInterval( | |
function() { | |
if (isDone()) { | |
window.clearInterval(id); | |
next(is_timeout); | |
} | |
if (current_trial++ > max_retry) { | |
window.clearInterval(id); |
Let's have a look at this html in the dom: | |
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12"> | |
<a href="https://facebook.com/" target="_blank"> | |
<div class="app-logo" style="width: 716px; height: 60px; background: none;"></div> | |
</a> | |
</div> | |
jquery code: |
This is the easiest way you can: | |
var thisDate = ISODate("2016-01-07T00:00:00Z"); | |
Model.find({ | |
startDate: { | |
'$lte': thisDate | |
}, | |
endDate: { | |
'$gte': thisDate |
#MongoDB - Basic Commands
##Saving Data
db //Tells you the current database
show collections //Shows the collections available in the current db
db.foo.save({_id:1, x:10}) //Save the document into the foo collection
db.bar.save({_id:1, x:10}) //Save the document into the bar collection
Example code for exporting data in a table to a csv file. |