Skip to content

Instantly share code, notes, and snippets.

Checkbox Switch

A simple, gummy little switch thingy. Now accelerated for touch devices! All JS can be removed though and it will still work.

A Pen by Christian Naths on CodePen.

License.

@cevatkerim
cevatkerim / aws-sns-example.js
Created October 6, 2015 17:18 — forked from tmarshall/aws-sns-example.js
aws-sdk sns example, in Node.js
var AWS = require('aws-sdk');
AWS.config.update({
accessKeyId: '{AWS_KEY}',
secretAccessKey: '{AWS_SECRET}',
region: '{SNS_REGION}'
});
var sns = new AWS.SNS();
@cevatkerim
cevatkerim / crypto_test.js
Created November 13, 2015 23:55 — forked from skhatri/crypto_test.js
Encrypt Decrypt in Node using crypto
var SecurityUtil = (function(key) {
var crypto = require('crypto');
var secret=new Buffer(key);
var encrypt = function(text) {
var cipher = crypto.createCipher('aes-256-cbc', secret);
cipher.update(text, 'utf8', 'hex');
var cipherText = cipher.final('hex');
return cipherText;
};
@cevatkerim
cevatkerim / validate_credit_card.js
Last active March 18, 2016 16:06 — forked from DiegoSalazar/validate_credit_card.js
Luhn algorithm in Javascript. Check valid credit card numbers
// takes the form field value and returns true on valid number
function valid_credit_card(value) {
// accept only digits, dashes or spaces
if (/[^0-9-\s]+/.test(value)) return false;
// The Luhn Algorithm. It's so pretty.
var nCheck = 0, nDigit = 0, bEven = false;
value = value.replace(/\D/g, "");
for (var n = value.length - 1; n >= 0; n--) {
@cevatkerim
cevatkerim / README.md
Created March 23, 2016 22:12 — forked from mjallday/README.md
SQS Latency Measuring

SQS Latency testing

Run this from an ec2 instance in the us-west-1 region.

It will create two queues and feed messages into the first queue with a timestamp, this message will then be read and the difference between the message timestamp and the current time computed and pushed into a response queue. Reading these times will give you the latency between publishing to a queue and receiving the message.

@cevatkerim
cevatkerim / post-merge
Created June 26, 2016 17:13 — forked from hcurotta/post-merge
Post Merge git hook to trigger codeship deployment when using BitBucket
#!/bin/bash
branch_name=$(git symbolic-ref --short HEAD)
if [ "$branch_name" == 'dev' ] || [ "$branch_name" == 'staging' ]
then
git commit --allow-empty -m 'empty commit to trigger deployment'
fi
@cevatkerim
cevatkerim / troubleshooting.md
Created October 7, 2016 13:52 — forked from cmawhorter/troubleshooting.md
Solution to AWS Lambda node.js UnrecognizedClientException "The security token included in the request is invalid."

Troubleshooting AWS unauthorized errors in lambda requests

This is mainly for node.js but might apply to other environments. Unsure.

If you are running a AWS Lambda function that calls another AWS service and getting an error about invalid tokens or other access denied errors, do this:

Check IAM

The role assigned to your lambda function will need permission to perform the actions. Check IAM and make sure the role has all the permissions.

@cevatkerim
cevatkerim / cf-keep-alive-template.json
Created November 3, 2016 19:29 — forked from zrzka/cf-keep-alive-template.json
AWS Keep Alive lambda function
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Keep alive functions",
"Resources": {
"LambdaPolicy": {
"Type": "AWS::IAM::ManagedPolicy",
"Properties": {
"PolicyDocument": {

JQL Syntax for the Impatient

There are a few JQL syntax bits to get you started:

  • AND --- allows you to add qualifiers to a list
  • != Thing --- target one thing
  • is in (List, Of, Things) --- target a bunch of things (Done, Closed, Resolved) typically
  • not in (List, of, Things) --- do not include a bunch of things
  • -1w --- relative time. You can also use -1d for day
  • "2015/3/15" --- specific dates
@cevatkerim
cevatkerim / README.md
Created March 14, 2017 10:32 — forked from ngryman/README.md
intellij javascript live templates

intellij javascript live templates

Just a dump of handy live templates I use with IntelliJ. They should also work with WebStorm.

How to

  • Go to settings.
  • Search for live templates.
  • Under the javascript section you should be able to manage your templates.