A simple way to mock calls to the Mandrill API from nodejs tests. It uses the amazing mockery
package.
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
#!/bin/python | |
import os | |
from boto.s3.connection import S3Connection | |
import subprocess | |
from datetime import datetime, date | |
import argparse | |
import tempfile | |
import json | |
parser = argparse.ArgumentParser(description="Downloads logs from S3, and parses them with goaccess.") |
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 lang="en"> | |
<head> | |
<script> | |
// from: https://github.com/facebook/react-native/issues/11594#issuecomment-274689549 | |
function awaitPostMessage() { | |
let isReactNativePostMessageReady = !!window.originalPostMessage; | |
const queue = []; | |
let currentPostMessageFn = function store(message) { | |
if (queue.length > 100) queue.shift(); |
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
import React, { Component } from 'react' | |
// import PropTypes from 'prop-types'; | |
import { View } from 'react-native' | |
import { | |
H1, | |
Icon, | |
Button, | |
Text | |
} from 'native-base' | |
import Modal from 'react-native-modal' |
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
C:\Users\Viktor\Projects\potzak\android\app\src\main\java\com\potzak\MainApplication.java:8: error: package com.learnium.RNDeviceInfo does not exist | |
import com.learnium.RNDeviceInfo.RNDeviceInfo; | |
^ | |
C:\Users\Viktor\Projects\potzak\android\app\src\main\java\com\potzak\MainApplication.java:9: error: package com.lugg.ReactNativeConfig does not exist | |
import com.lugg.ReactNativeConfig.ReactNativeConfigPackage; | |
^ | |
C:\Users\Viktor\Projects\potzak\android\app\src\main\java\com\potzak\MainApplication.java:10: error: package com.microsoft.azure.mobile.react.crashes does not exist | |
import com.microsoft.azure.mobile.react.crashes.RNCrashesPackage; | |
^ | |
C:\Users\Viktor\Projects\potzak\android\app\src\main\java\com\potzak\MainApplication.java:11: error: package com.microsoft.azure.mobile.react.analytics does not exist |
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
var mongoose = require('mongoose'), | |
async = require('async'), | |
Schema = mongoose.Schema, | |
ObjectId = Schema.ObjectId; | |
var MyS = new Schema({ | |
feeling: String | |
}); | |
MyS.pre('save', function(done){ | |
async.parallel([ |
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
var mongoose = require('mongoose'), | |
Schema = mongoose.Schema, | |
ObjectId = Schema.ObjectId; | |
var myS = new Schema({ | |
name: {type: String, required: true} | |
}); | |
var My = mongoose.model('My', myS); | |
var my = new My({'name': 'bika'}); |
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
var tobi = require('tobi'), | |
browser = tobi.createBrowser(8000, "localhost"); | |
json_browser = (function(){ | |
var json_header = {headers: | |
{ | |
"Accept": "application/json", | |
"X-Requested-With": "XMLHttpRequest" | |
} | |
}; |
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
var Db = require('mongodb').Db; | |
//... | |
options.noOpen = true; | |
myDb = Db.connect(mongouri, options); | |
// or | |
options.noOpen = false; |