This file contains hidden or 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
#!/bin/bash | |
MONGO_DATABASE="" | |
APP="" | |
TIMESTAMP=`date +%F-%H%M` | |
MONGODUMP_PATH="/usr/bin/mongodump" | |
BACKUPS_DIR="/home/me/backups/$APP" | |
BACKUP_NAME="$APP-$TIMESTAMP" |
This file contains hidden or 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
def anti_vowel(text): | |
vowels = ['a','e','i','o','u'] | |
result = [] | |
for i in range(len(text)): | |
if text[i].lower() not in vowels: | |
result.append(text[i]) | |
return ''.join(result) |
This file contains hidden or 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
def reverse(text): | |
reversed = [] | |
for i in range(len(text)): | |
reversed.append(text[-(i+1)]) | |
return ''.join(reversed) |
This file contains hidden or 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
// sample -> [ 1, 2, 1, 'a', [ 'd', 5, 6 ], 'A', 2, 'b', 1, 'd' ]; | |
// result -> { 1: 3, 2: 2, a: 1...} | |
function flattenArray (arr, result) { | |
result = result || []; | |
for (var i = 0; i < arr.length; i++) { | |
if (Array.isArray(arr[i])) { | |
flattenArray(arr[i], result); | |
} else { |
This file contains hidden or 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
var keystone = require('keystone'); | |
var express = require('express'); | |
var body = require('body-parser'); | |
var helmet = require('helmet'); | |
var app = express(); | |
app.use(body.urlencoded({ extended: false })); | |
app.use(body.json()); | |
app.use(helmet()); |
This file contains hidden or 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
Airedale Terrier, Terrier | |
Affenpinscher, Toy | |
Afghan Hound, Hound | |
Airedale Terrier, Terrier | |
Akita Inu, Working | |
Alaskan Malamute, Working | |
American English Coonhound, Hound | |
American Eskimo Dog (Miniature), Non-Sporting | |
American Eskimo Dog (Standard), Non-Sporting | |
American Eskimo Dog (Toy), Toy |
This file contains hidden or 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
server { | |
listen 443; | |
server_name mydomain.com www.mydomain.com; | |
access_log /var/logs/access.log main_timed; | |
# See https://mozilla.github.io/server-side-tls/ssl-config-generator/ for appropriate SSL settings | |
ssl on; | |
ssl_certificate /opt/ssl/site/mydomain.com.crt; | |
ssl_certificate_key /opt/ssl/site/mydomain.com.key; | |
add_header Strict-Transport-Security max-age=15768000; |
This file contains hidden or 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
var should = require('should'); | |
var Invitations = require('./Invitations'); | |
describe('Customers to invite to office', function () { | |
var invite; | |
beforeEach(function () { | |
invite = new Invitations(53.3381985, -6.2592576); | |
}); | |
This file contains hidden or 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
var should = require('should'); | |
var flattenArray = require('./flattenArray.js'); | |
describe('Flatten Nested Arrays', function () { | |
it('should flatten a nested array', function () { | |
var testArr = [[1,2,[3]],4]; | |
flattenArray(testArr).should.be.an.Array; | |
flattenArray(testArr).should.equal([1,2,3,4]); | |
}); |
This file contains hidden or 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
import sys | |
from wordpress_xmlrpc import Client, WordPressPost | |
from wordpress_xmlrpc.methods.posts import GetPosts, GetPost | |
wp = Client('https://yoursiteaddress.com/xmlrpc.php', 'username', 'password') # update the site address, username and password | |
# retrives the list of all posts in the blog. Optional: you can supply filters and fields to sort by. | |
print(wp.call(GetPosts({'post_status': 'publish'}))) | |
# retrives a single post in the blog. Required: postId. Optional: fields | |
# pass in postId when running this script, e.g python wp.py 1234 |