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); |
/* A very simple and nice function to swap DOM elements */ | |
// Solution #1 | |
function swap($elementA, $elementB) { | |
var temp = $('<div>').insertAfter($elementA); | |
$elementA.insertAfter($elementB); | |
$elementB.insertBefore(temp); | |
temp.remove(); | |
} |
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: |
<?php | |
/* | |
// save this file to: ExcelService.class.php | |
Create new folder 'libs' under your project dir, and download PHPExcel-1.8 library .zip from here.. | |
use this clone url: [email protected]:PHPOffice/PHPExcel.git | |
OR https://github.com/PHPOffice/PHPExcel. | |
*/ | |
define('TMP_FILES', "../temp/"); // temp folder where it stores the files into. |
This is the easiest way you can: | |
var thisDate = ISODate("2016-01-07T00:00:00Z"); | |
Model.find({ | |
startDate: { | |
'$lte': thisDate | |
}, | |
endDate: { | |
'$gte': thisDate |