Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am blackbird014 on github.
  • I am blackbird014 (https://keybase.io/blackbird014) on keybase.
  • I have a public key ASAwuOGkUwx8h2Y0qC4vvyDE7zICYpq6CAK1-4k-NhYDLwo

To claim this, I am signing this object:

final SSLContext sslContext = sslConfig.createSSLContext();
//final SSLContext sslContext = getSSLContext("C:/vwdtest.jks", "password");
//Configure client
ClientConfig clientConfig = new ClientConfig();
Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create()
.register("http", PlainConnectionSocketFactory.getSocketFactory())
.register("https", new SSLConnectionSocketFactory(sslContext))
.build();
PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(socketFactoryRegistry);
PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager();
class Pouring(capacity: Vector[Int]) {
// States
type State = Vector[Int]
val initialState = capacity map (x => 0)
// Moves
trait Move {
// A method that defines state changes
def change(state: State): State
@blackbird014
blackbird014 / MyReverse.hs
Created July 9, 2013 19:54
Haskell function to reverse a list. in line 3 we see that a list goes in a list in 4-7 is defined the function. line 6 empty in empty line 7 reads like follows: applied to a list made up by an element followed by all the remainning it gives the same funtion applied to all the remaining plus the element itself.
module MyReverse where
myReverse :: [a] -> [a]
myReverse l = rev l []
where
rev [] a = a
rev (x:xs) a = rev xs (x:a)
@blackbird014
blackbird014 / youtube.rb
Created June 30, 2013 19:22
Allows to embed a youtube video in octopress blog just by copying it in the plugin directory and, in your post write {% youtube <videoId> %}
module Jekyll
class Youtube < Liquid::Tag
def initialize(name, id, tokens)
super
@id = id
end
def render(context)
%(<div class="embed-video-container"><iframe src="http://www.youtube.com/embed/#{@id}"></iframe></div>)