Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Destablizing Authoritarian governments to ₿UIDL ₿ack ₿etter

nolim1t - f6287b82CC84bcbd nolim1t

💭
Destablizing Authoritarian governments to ₿UIDL ₿ack ₿etter
View GitHub Profile
@nolim1t
nolim1t / gist:eb84d08b542ac5183d19
Created May 18, 2014
Satoshi to BTC or mBTC conversion worksheet
View gist:eb84d08b542ac5183d19
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());
@nolim1t
nolim1t / gist:9f30ff97e7cf9920f84d
Created Jun 6, 2014
Currently gets a Bad access error. Any ideas
View gist:9f30ff97e7cf9920f84d
import UIKit
class AlertClass: NSObject {
func ShowAlertBox(title : NSString, msg : NSString) {
var alertMsg = UIAlertView(title: title, message: msg, delegate: nil, cancelButtonTitle: "Dismiss")
alertMsg.show()
}
}
@nolim1t
nolim1t / gist:403da390fe55a7e3b794
Created Jun 11, 2014
Sample Swift CoreData Class
View gist:403da390fe55a7e3b794
import CoreData
class SampleClass : NSManagedObject {
@NSManaged var name : NSString
@NSManaged var description : NSString
@NSManaged var trueFalseFlag : NSNumber
@NSManaged var location : AnyObject
}
@nolim1t
nolim1t / gist:5a1cad9b7289da3dbe4c
Created Jul 29, 2014
encrypt and decrypt at the commend line
View gist:5a1cad9b7289da3dbe4c
# 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
require "base64"; s = File.new("Somefilename", "rb"); contents = s.read; puts Base64.encode64(contents);
@nolim1t
nolim1t / gist:ac60143ae442e1f55f7a
Last active Aug 29, 2015
Ruby method names are cool
View gist:ac60143ae442e1f55f7a
class Test
def 你好
puts "Hello"
end
def привет
puts "Hello"
end
def 😊
@nolim1t
nolim1t / gist:ede14f044a2d6376350f
Last active Aug 29, 2015
Doing an image without an inline image (useful for posts sharing to Facebook where you don't want Facebook to grab that image as the "leader" image)
View gist:ede14f044a2d6376350f
<div style="background-image: url('https://url.goes.here'); height: 225px; width: 300px; position: relative;"></div>
<p><sup>above: Linking</sup></p>
@nolim1t
nolim1t / DictionaryPlayground.swift
Created Jul 20, 2015
Swift Dictionary Playground
View DictionaryPlayground.swift
var hdict : Dictionary<String,String> = ["Key": "Val"]
for (key: String, value: String) in hdict {
println("\(key) = \(value)")
}
@nolim1t
nolim1t / ParamDictToURLEncodeStringPlayground.swift
Created Jul 20, 2015
Save the contents of my swift playground
View ParamDictToURLEncodeStringPlayground.swift
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))
@nolim1t
nolim1t / sign.rb
Created Aug 6, 2015
Signing a string with crypto in ruby
View sign.rb
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