Skip to content

Instantly share code, notes, and snippets.

@Jawnnypoo
Jawnnypoo / styles.xml
Created April 7, 2016 16:13
AppCompatDialog theme
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:windowBackground">@color/white</item>
<item name="android:textColorPrimary">@color/black</item>
<item name="alertDialogTheme">@style/AppAlertDialogStyle</item>
</style>
@nuboli
nuboli / lambda-s3-integration-resources-access-iam-policy.json
Last active November 10, 2017 21:31
AWS IAM - Grant Access to Resources required for a Lambda-S3 Integration Raw
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ListExistingFunctions",
"Effect": "Allow",
"Action": [
"lambda:ListFunctions",
"lambda:ListVersionsByFunction",
"lambda:ListAliases",
{
"Records": [
{
"EventSource": "aws:sns",
"EventVersion": "1.0",
"EventSubscriptionArn": "arn:aws:sns:xxx",
"Sns": {
"Type": "Notification",
"MessageId": "xxxxxx-xxx-xxxxxx-xxxxx",
"TopicArn": "arn:aws:sns::::slackNotifications",
@seanmorrisonit
seanmorrisonit / snsToSlack.js
Last active November 15, 2017 18:06 — forked from terranware/snsToSlack.js
AWS Lambda function to Slack Channel hookup
var https = require('https');
var util = require('util');
function tryParseJSON (jsonString){
try {
var o = JSON.parse(jsonString);
// Handle non-exception-throwing cases:
// Neither JSON.parse(false) or JSON.parse(1234) throw errors, hence the type-checking,
@reneoelke
reneoelke / AWS_Lambda_SnsToSlack.js
Last active November 15, 2017 18:08
An Amazon Web Services SNS trigger that sends CloudWatch alarm notifications to Slack.
var url = require("url");
var https = require("https");
var hookUrl = "HOOK_URL";
var slackChannel = "SLACK_CHANNEL";
var postMessage = function(message, callback) {
var body = JSON.stringify(message);
var options = url.parse(hookUrl);
options.method = "POST";
@wryun
wryun / example-aws-mock.js
Last active November 16, 2017 10:26
Mocking js aws-sdk using sinon (rough notes)
beforeEach(function () {
this.aws = {};
stubAwsRequest(stubs);
});
afterEach(function () {
AWS.Request.prototype.runTo.restore();
});
AWS.Request.prototype.originalRunTo = AWS.Request.prototype.runTo;
@rbnpi
rbnpi / ReadMe.md
Last active December 23, 2018 05:05
Recorder Player for Sonic Pi Read the accompanying article at https://rbnrpi.wordpress.com/project-list/sonic-pi-3-player-recorder-using-touchosc/ for details of setup. Also there is a video at https://youtu.be/2yoJ2ygs0xM

Sonic Pi Record / Player

The three other files enable a TouchOSC interface to be used with Sonic Pi 3 and above to allow notes to be played on Sonic Pi, and also recorded in real time for subsequent replay. Recordings can also be stored in files on your computer. NB spRecordPlayer.rb changed to release 1.0.1 line 144 updated "piano,"pluck" changed to :piano,:pluck

The two Sonic Pi programs should be loaded into separate buffers, where they are both run. At any time you can re-run either file. If you ever press the stop button you must re-run both.

@timmartin
timmartin / gist:556b8552735312c0093b4594053c6335
Created January 27, 2018 16:52
Terraform rules for CloudWatch events triggering CodeBuild
provider "aws" {
region = "us-east-1"
}
resource "aws_codecommit_repository" "test" {
repository_name = "BuildTestRepository"
}
resource "aws_codebuild_project" "build_test" {
name = "BuildTest"
@closrks
closrks / mongoose-middleware.js
Created January 7, 2016 01:23
mongoose middleware examples
// complex validation
UserSchema.pre('save', function(next) {
UserModel.find({ username: this.username }, function(err, user) {
if (!user) {
return next();
}
return next(new Error('username already exist!'));
});
});
@mpurbo
mpurbo / android-aar-maven-local.sh
Last active June 14, 2019 06:05
Installing Facebook SDK as aar to local maven repository
export ANDROID_HOME=/Applications/Android\ Studio.app/sdk/
cd facebook-android-sdk-3.14
gradle facebook:build
mv facebook/build/libs/facebook.aar facebook/build/libs/facebook-3.14.aar
mvn install:install-file -Dfile=facebook/build/libs/facebook-3.14.aar -DgroupId=com.facebook -DartifactId=android-sdk -Dversion=3.14 -Dpackaging=aar