Skip to content

Instantly share code, notes, and snippets.

View nolim1t's full-sized 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 08:58
Satoshi to BTC or mBTC conversion worksheet
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 June 6, 2014 00:32
Currently gets a Bad access error. Any ideas
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 June 11, 2014 01:40
Sample Swift CoreData Class
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 July 29, 2014 03:37
encrypt and decrypt at the commend line
# 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
require "base64"; s = File.new("Somefilename", "rb"); contents = s.read; puts Base64.encode64(contents);
@nolim1t
nolim1t / gist:ac60143ae442e1f55f7a
Last active August 29, 2015 14:16
Ruby method names are cool
class Test
def 你好
puts "Hello"
end
def привет
puts "Hello"
end
def 😊
@nolim1t
nolim1t / gist:ede14f044a2d6376350f
Last active August 29, 2015 14:19
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)
<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 July 20, 2015 23:18
Swift Dictionary Playground
var hdict : Dictionary<String,String> = ["Key": "Val"]
for (key: String, value: String) in hdict {
println("\(key) = \(value)")
}
@nolim1t
nolim1t / ParamDictToURLEncodeStringPlayground.swift
Created July 20, 2015 23:20
Save the contents of my swift playground
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 August 6, 2015 02:15
Signing a string with crypto in ruby
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