View gist:eb84d08b542ac5183d19
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var btcConst = 100000000; | |
var mbtcConst = 100000; | |
var v = 100000; // Satoshi Received | |
var mbtc = v / mbtcConst; | |
var btc = v / btcConst; | |
console.log(mbtc.toString()); | |
console.log(btc.toString()); |
View gist:9f30ff97e7cf9920f84d
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class AlertClass: NSObject { | |
func ShowAlertBox(title : NSString, msg : NSString) { | |
var alertMsg = UIAlertView(title: title, message: msg, delegate: nil, cancelButtonTitle: "Dismiss") | |
alertMsg.show() | |
} | |
} |
View gist:403da390fe55a7e3b794
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import CoreData | |
class SampleClass : NSManagedObject { | |
@NSManaged var name : NSString | |
@NSManaged var description : NSString | |
@NSManaged var trueFalseFlag : NSNumber | |
@NSManaged var location : AnyObject | |
} |
View gist:5a1cad9b7289da3dbe4c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Find out what you want to encrypt (maybe even pipe a file into it) | |
echo -n "Some text to encrypt" | openssl enc -e -aes-256-cbc -a -salt | |
# Then choose a password | |
# To decrypt (will need the password you used to ecnrypt) | |
# You can also pipe in a file which should return the original document | |
echo "encrypted string" | openssl enc -d -aes-256-cbc -a -salt | |
View gist:f373a539f9ab5aeecada
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "base64"; s = File.new("Somefilename", "rb"); contents = s.read; puts Base64.encode64(contents); |
View gist:ac60143ae442e1f55f7a
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Test | |
def 你好 | |
puts "Hello" | |
end | |
def привет | |
puts "Hello" | |
end | |
def 😊 |
View gist:ede14f044a2d6376350f
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div style="background-image: url('https://url.goes.here'); height: 225px; width: 300px; position: relative;"></div> | |
<p><sup>above: Linking</sup></p> |
View DictionaryPlayground.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var hdict : Dictionary<String,String> = ["Key": "Val"] | |
for (key: String, value: String) in hdict { | |
println("\(key) = \(value)") | |
} |
View ParamDictToURLEncodeStringPlayground.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func escape(string: String) -> String { | |
let generalDelimiters = ":#[]@" // does not include "?" or "/" due to RFC 3986 - Section 3.4 | |
let subDelimiters = "!$&'()*+,;=" | |
let legalURLCharactersToBeEscaped: CFStringRef = generalDelimiters + subDelimiters | |
return CFURLCreateStringByAddingPercentEscapes(nil, string, nil, legalURLCharactersToBeEscaped, CFStringBuiltInEncodings.UTF8.rawValue) as String | |
} | |
println(escape(phnumber)) |
View sign.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "openssl" | |
require "base64" | |
def sign(key, str) | |
ssl_sign = OpenSSL::HMAC.digest("sha512", key, str) | |
return Base64.encode64(ssl_sign).to_s.gsub("\n","") | |
end |
OlderNewer