Skip to content

Instantly share code, notes, and snippets.

Verifying my Blockstack ID is secured with the address 1VtUpGViwMuFsnbVHudge1nYvpNKGoMNn https://explorer.blockstack.org/address/1VtUpGViwMuFsnbVHudge1nYvpNKGoMNn
@frankieshakes
frankieshakes / Album.swift
Created July 24, 2014 22:03
Moves JSON parsing/logic for "album" to the Album model
init(json: Dictionary<String, AnyObject>){
var name: String? = json[ "trackName" ] as AnyObject? as? String
if !name? {
name = json[ "collectionName" ] as AnyObject? as? String
}
//Sometimes price comes in as formattedPrice, sometimes as collectionPrice.. and sometimes it's a float instead of a string. Hooray!
var price: String? = json["formattedPrice"] as AnyObject? as? String
if !price? {
@frankieshakes
frankieshakes / gist:5670308
Created May 29, 2013 13:36
Read/Write rules to prevent a Firebase entry-point from being mistakenly (or maliciously) overwritten:
{
"rules": {
".read": false,
"{{your-data-endpoint-root}}": { // ie: blog
".write": false, // prevents /blog from being overwritten
"{{child-endpoint}}": { // ie: entries
".write": false, // prevents /blog/entries from being overwritten
"$other": { // allows for writes to /blog/entries/{{key}}
".write": true
// wrap in a closure to get at the global,
// no matter where we are.
(function () { this.env = this.env || "prod" })()
// in production mode, be fast.
// in development/testing mode, add some error checking.
function Class (ctor, parent, proto) {
if (typeof parent === "object") {
proto = parent
parent = null
<script>
function getPicture() {
navigator.camera.getPicture(getPicture_Success, null, { quality: 10 });
};
function getPicture_Success(imageData) {
alert("getpic success");
document.getElementById("test_img").src = "data:image/jpeg;base64," + imageData;
}
</script>