View ContainerExample.js
import { connect } from 'react-redux';
const mapStateToProps = ({ refreshThing }) => {
return {
refreshInterval: 60000,
refreshEnabled: true,
};
};
const mapDispatchToProps = dispatch => {
View script.py
def main(argv):
print('Hi')
the_name = input('Your name, please?\n> ')
print('Hi {} <3'.format(name))
View handler.py
# This file is your Lambda function
import base64
import json
import boto3
def save_to_bucket(event, context):
AWS_BUCKET_NAME = 'my-bucket-name'
s3 = boto3.resource('s3')
View handler.py
# This file is your Lambda function
import json
import boto3
def save_to_bucket(event, context):
AWS_BUCKET_NAME = 'my-bucket-name'
s3 = boto3.resource('s3')
bucket = s3.Bucket(AWS_BUCKET_NAME)
path = 'my-path-name.txt'
View handler.py
# This file is your Lambda function
import json
def mirror_query_strings(event, context):
body = {
"queryStrings": event['queryStringParameters']
}
return {
"statusCode": 200,
View index.js
// This allows you to use <a href="#id-of-tab"> as well as handle direct links and back button (popstate)
(function(){
var url = document.location.toString();
if (url.match('#')) {
$('.nav-tabs a[href="#' + url.split('#')[1] + '"]').tab('show');
}
// Change hash for page-reload
$('.nav-tabs a').on('shown.bs.tab', function (e) {
window.location.hash = e.target.hash;
View serve-static.js
// index.html up at localhost:8080/status
//
// requirements: mime (npm install mime --save)
const path = require('path');
const fs = require('fs');
var mime = require('mime');
const serveFile = filePath => (req, res) => {
const fullPath = path.join(__dirname, filePath);
View django_custom_auth_decorators.py
def method_user_passes_test(
test_method, login_url=None, redirect_field_name=REDIRECT_FIELD_NAME):
"""
This is a modified version of user_passes_test
(django.contrib.auth.decorators) that can be used on class methods.
"""
def decorator(view_method):
@wraps(view_method, assigned=available_attrs(view_method))
def _wrapped_view(self, request, *args, **kwargs):
View installationsTest.js
import {expect} from 'chai';
import reducer from '../../reducers/installations';
describe('reducers/installations', () => {
let state;
beforeEach(() => {
state = {
installations: [],
View aws-s3-upload.sh
#!/usr/bin/env bash
# This script will sync your current folder to bucket, and remove any files that do not match in target bucket
# Remember to set variables
# VARIABLES START
REGION=eu-central-1
DEV_BUCKET="-MY-DEV-BUCKET-"
PROD_BUCKET="-MY-PROD-BUCKET-"