Skip to content

Instantly share code, notes, and snippets.

```
paste your code here
```
@jbmartinez
jbmartinez / async.js
Created July 26, 2015 20:39
Processing an array when data comes from several asynchronous requests in angular.js
var url = "http://api.mysite.com/json"
// arr is an array containing values for a parameter
$q.all(arr.map(function(element) {
// return promises
return $http.get(url, {param: element});
})).then(function(data) {
// do something with data
// data is an array of responses
console.log(data);
var transformedData = data.map(function(item) {
@jbmartinez
jbmartinez / styles.css
Created July 26, 2015 20:13
A basic template for styles I use alongside with Pure.css
/*
When setting the primary font stack, apply it to the Pure grid units along
with `html`, `button`, `input`, `select`, and `textarea`. Pure Grids use
specific font stacks to ensure the greatest OS/browser compatibility.
*/
html, button, input, select, textarea,
.pure-g [class *= "pure-u"] {
/* Set your content font stack here: */
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
@jbmartinez
jbmartinez / quotes.json
Last active November 19, 2015 00:28
A bunch of quotes in JSON format (taken from https://litemind.com/best-famous-quotes/)
[
{"text": "You can do anything, but not everything.",
"author": "David Allen"},
{"text": "Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.",
"author": "Antoine de Saint-Exupéry"},
{"text": "The richest man is not he who has the most, but he who needs the least.",
"author": "Unknown Author"},