Skip to content

Instantly share code, notes, and snippets.

@chrisallick
chrisallick / uploadS3iOS.m
Created January 3, 2014 00:43
This will upload an image to s3 from ios using the amazon library
//#import <AWSS3/AWSS3.h>
//#import <AWSRuntime/AWSRuntime.h>
//import those in your .h file and
//add the awss3 and awsruntime framework from the client
//download from Amazon
AmazonS3Client *s3Client = [[AmazonS3Client alloc] initWithAccessKey:@"Key_Goes_here" withSecretKey:@"Secret_Goes_Here"];
NSString *imageName = [NSString stringWithFormat:@"%@.png", @"cpa"];
@chrisallick
chrisallick / Base64 JS Demo
Last active June 29, 2021 18:47
Base64 in JavaScript turn a json object to a base64 string. boom!
<!DOCTYPE html>
<html>
<head>
<title>Base64 Demo</title>
<meta charset="utf-8">
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js' type='text/javascript'></script>
<script src='https://javascriptbase64.googlecode.com/files/base64.js' type='text/javascript'></script>
const fetch = require('node-fetch');
var twilio = require('twilio');
var accountSid = '_snip_'; // enter
var authToken = '_snip_'; // enter
var your_zip_code = "90094"; // change
var twilio = require('twilio');
var client = new twilio(accountSid, authToken);
@chrisallick
chrisallick / gist:3648116
Created September 5, 2012 23:57
Force preload of video in HTML5
function addSourceToVideo(element, src, type) {
var source = document.createElement('source');
source.src = src;
source.type = type;
element.appendChild(source);
}
var video;
#
# run from root
#
# writes to a folder "videos" folder needs to be created.
# requires ffmpeg installed
#
# $>ruby gifToMP4.rb
#
#
# references:
@chrisallick
chrisallick / index.html
Created November 5, 2019 21:31
contentful_s3_image_ui_extension_index.html
<!DOCTYPE html>
<html>
<head>
<!-- Contentful dependencies -->
<link rel="stylesheet" href="https://contentful.github.io/ui-extensions-sdk/cf-extension.css">
<script src="https://unpkg.com/contentful-ui-extensions-sdk@3"></script>
<!-- AWS JS SDK -->
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.120.0.min.js"></script>
@chrisallick
chrisallick / auto-nvm-use.sh
Created April 2, 2019 20:48
auto-switch node version when you cd into project directory
#
# Run 'nvm use' automatically every time there's
# a .nvmrc file in the directory. Also, revert to default
# version when entering a directory without .nvmrc
#
enter_directory() {
if [[ $PWD == $PREV_PWD ]]; then
return
fi
require 'aws-sdk-lambda' # https://github.com/awsdocs/aws-doc-sdk-examples/blob/master/ruby/example_code/lambda/aws-ruby-sdk-lambda-example-run-function.rb
require 'json'
require 'sendgrid-ruby'
include SendGrid # https://github.com/sendgrid/sendgrid-ruby
Encoding.default_external = 'UTF-8'
class EmailSender
require 'aws-sdk-lambda' # https://github.com/awsdocs/aws-doc-sdk-examples/blob/master/ruby/example_code/lambda/aws-ruby-sdk-lambda-example-run-function.rb
require 'json'
require 'sendgrid-ruby'
include SendGrid # https://github.com/sendgrid/sendgrid-ruby
Encoding.default_external = 'UTF-8'
class EmailSender
require 'base64'
require 'openssl'
require 'sinatra'
require 'sinatra/partial'
require 'sinatra/reloader' if development?
require 'resque'
require './email_sender'