Skip to content

Instantly share code, notes, and snippets.

View exinferis's full-sized avatar

Exinferis exinferis

View GitHub Profile
@exinferis
exinferis / dataUriToBlob.coffee
Created December 5, 2012 15:35
Convert Data URI to JS blob
dataURItoBlob: (dataURI) =>
binary = atob(dataURI.split(",")[1])
array = []
i = 0
while i < binary.length
array.push binary.charCodeAt(i)
i++
return new Blob( [new Uint8Array(array)],
@exinferis
exinferis / gist:4216799
Created December 5, 2012 15:53
Convert Data URI to JS blob - Javascript
dataURItoBlob = function(dataURI) {
var array, binary, i;
binary = atob(dataURI.split(",")[1]);
array = [];
i = 0;
while (i < binary.length) {
array.push(binary.charCodeAt(i));
i++;
}
return new Blob([new Uint8Array(array)], {
@exinferis
exinferis / gist:4216882
Created December 5, 2012 16:01
Creating an S3 signature and policy
createCredentials: ( mimetype, file, cb ) =>
# calling the create policy method and using its reposnse
@createS3Policy( mimetype, file, ( err, policy ) =>
if not err
# now building the S3 credential object
s3CredObj =
PolicyBase64: policy
Signature: crypto.createHmac( "sha1", @Secret ).update( policy ).digest( "base64" )
Key: @Key
@exinferis
exinferis / gist:4217117
Created December 5, 2012 16:24
request S3 Credentials and build formdata
@_requestCredentials( @format, _fName, ( res ) =>
# building html5 / formdata object for use with xhr transport
formData = new FormData
formData.append( "key", "#{res.FileDescriptor}.#{@ext}" )
formData.append( "acl", "public-read" )
formData.append( "Content-Disposition", "" )
formData.append( "Content-Type", res.ContentType )
formData.append( "success_action_status", res.ActionStatus )
formData.append( "AWSAccessKeyId", res.Key )
formData.append( "Policy", res.PolicyBase64 )
### Keybase proof
I hereby claim:
* I am exinferis on github.
* I am exinferis (https://keybase.io/exinferis) on keybase.
* I have a public key whose fingerprint is 946A 9DCE 349A 3AD3 EF5A 0379 157E 1767 210E 9ACC
To claim this, I am signing this object:
@exinferis
exinferis / ElasticSearch.sh
Created December 11, 2015 09:12 — forked from gourneau/ElasticSearch.sh
Elastic Search 1.4.2 with Oracle Java 8
### Install Oracle Java 8, this means you agree to their binary license!!
cd ~
sudo add-apt-repository -y ppa:webupd8team/java
sudo apt-get update
echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections
echo debconf shared/accepted-oracle-license-v1-1 seen true | sudo debconf-set-selections
sudo aptitude -y install oracle-java8-installer
### Download and Install ElasticSearch

Keybase proof

I hereby claim:

  • I am exinferis on github.
  • I am exinferis (https://keybase.io/exinferis) on keybase.
  • I have a public key whose fingerprint is 4F60 B70A 7FE4 B80E DC40 B5A0 4E7D 51FB 4852 AF1A

To claim this, I am signing this object:

fetch({url: "/whatever/123", method: "DELETE"})
.then((response) => {
console.log("Got response for DELETE Request", response);
})
.catch((err) => {
console.error("DELETE REQUEST failed: ", err);
})