This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* flattenNested - Reduces an array of arbitrarily nested arrays of integers into a flat array of integers. | |
* @param value {Array} - The array to flatten. | |
* @param iterator {Array} - An array used for initializing or for iteration during recursion. | |
* @returns {Array} - The flattened array, yay! | |
*/ | |
function flattenNested(value, iterator = []) { | |
// Add exit case straight away to help prevent stack overflow | |
if (!value) return iterator; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http { | |
proxy_cache_path /tmp/nginx/cache | |
levels=1:2 | |
keys_zone=main:10m | |
max_size=1g inactive=1d; | |
proxy_temp_path /tmp/nginx/tmp; | |
server { | |
listen 80; | |
server_name app.example.com; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/usr/bin/env bash | |
# MIT © Sindre Sorhus - sindresorhus.com | |
# git hook to run a command after `git pull` if a specified file was changed | |
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`. | |
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)" | |
check_run() { | |
echo "$changed_files" | grep --quiet "$1" && eval "$2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
emptyCart: function() { | |
// Sets items object to an empty object | |
items = {}; | |
// Remove the items cookie | |
$cookieStore.remove('items'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Require mongoose dependency | |
var mongoose = require('mongoose'); | |
// Create a swag schema | |
var swagSchema = mongoose.Schema({ | |
id: Number, | |
isFeatured: Boolean, | |
isActive: Boolean, | |
price: Number, | |
specialPrice: Number, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="col-md-3" ng-repeat="item in swag"> | |
<h4 ng-bind="item.title"></h4> | |
<div class="row"> | |
<div class="col-xs-4 col-md-6"> | |
<a href="#" class="thumbnail"> | |
<img ng-src="item.images[0]" alt="item.title"> | |
</a> | |
</div> | |
<p ng-bind="item.description"></p> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html ng-app> | |
<head lang="en"> | |
<meta charset="UTF-8"> | |
<title></title> | |
</head> | |
<body> | |
<div> | |
<label>Name:</label> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(angular) { | |
"use strict"; | |
var app = angular.module('MyStore'); | |
app.factory('CartService', function($cookieStore, ProductService) { | |
// Private items variable | |
var items = {}; |
NewerOlder