Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View Sivli-Embir's full-sized avatar
😎
Being cool and writing code

Sivli Embir Sivli-Embir

😎
Being cool and writing code
View GitHub Profile
@robnyman
robnyman / blob-filereader-localStorage.js
Last active April 21, 2024 08:32
Get file as a blob, read through FileReader and save in localStorage
// Getting a file through XMLHttpRequest as an arraybuffer and creating a Blob
var rhinoStorage = localStorage.getItem("rhino"),
rhino = document.getElementById("rhino");
if (rhinoStorage) {
// Reuse existing Data URL from localStorage
rhino.setAttribute("src", rhinoStorage);
}
else {
// Create XHR and FileReader objects
var xhr = new XMLHttpRequest(),
(function (Controller, _) {
"use strict";
Controller.BasicController = function (parameters) {
var paramKeys = _.keys(parameters);
this.canDispatch = function (match) {
return _.every(paramKeys, function (c) {
return parameters[c] === match.getParam(c);
});
@matb33
matb33 / aws-sdk.js
Created April 12, 2013 19:09
AWS SDK Smart Package -- Exposes the SDK as AWS.SDK and provides a helper function to sign URLs
AWS = (function () {
var SDK = Npm.require("aws-sdk");
var crypto = Npm.require("crypto");
var url = Npm.require("url");
function getAuthenticatedURL(fullUrl, accessKeyID, secretAccessKey, expires) {
/*
Signature = URL-Encode( Base64( HMAC-SHA1( YourSecretAccessKeyID, UTF-8-Encoding-Of( StringToSign ) ) ) );
@wboykinm
wboykinm / index.html
Created November 10, 2013 04:09
Leaflet + D3 + Vector Tiles (via Nelson Minar)
<!DOCTYPE html>
<meta charset="utf-8">
<title>D3 GeoJSON in Leaflet</title>
<link href='http://api.tiles.mapbox.com/mapbox.js/v1.4.0/mapbox.css' rel='stylesheet' />
<!--[if lte IE 8]>
<link href='http://api.tiles.mapbox.com/mapbox.js/v1.4.0/mapbox.ie.css' rel='stylesheet'>
<![endif]--><style>
html, body, #map { height: 100%;width:100%; background:#020B26;position:absolute;}
body { padding: 0; margin: 0; }
path { stroke-linejoin; round; stroke-linecap: round; fill: none}
creationTime = new Date()
profile =
name: ''
stripeId: ''
created: creationTime.getTime()
address: ''
city: ''
state: ''
country: ''
limit: 2
@justincy
justincy / README.md
Last active April 5, 2024 22:19
Configure Storybook to work with Next.js, TypeScript, and CSS Modules

In addition to the Storybook for React setup, you'll also need to install these packages:

npm i -D @babel/core babel-loader css-loader style-loader