Blog posts • Oct 09, 2014 07:34 GMT
After the plane landed, we took the train from Schiphol airport station, riding it like a wild bull, and got off at this once so important harbor city, the center for all sea based trading coming in and out of Europe. We started our journey with a pitstop at the closest Vlaamse frites place we could find.
Blog posts • Sep 24, 2014 09:11 GMT
Last day, I had to serve some html pages via HTTPS. But didn't really know any simple solution to do this.
Here is one. A simple wrapper of the python SimpleHTTPServer with support for SSL.
Before running the server, you'll need to create your certificate :
<code>openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes</code>
Now that you have your certificate, create a file srv.py :
Add this file to your path, or simply call it from wherever you want like that :
This will serve the file in your current directory on https://localhost:4443
If you need a non httpS version to simply serve som static file, you can use the standard python simpleHTTPServer like this :
python -m SimpleHTTPServer
Last day, I had to serve some html pages via HTTPS. But didn't really know any simple solution to do this. Here is one. A simple wrapper of the python SimpleHTTPServer with support for SSL.
Blog posts • Sep 10, 2014 08:28 GMT
The new Network feature on Mynewsdesk will introduce a lot of new ways you can manage a contact. For instance, adding social media profiles and links to each contact.
To keep the user input as easy as possible, we wanted people to basically just paste urls and then it would be parsed into social media profile objects it possible (we use some of them to fetch content from their API). Pasting links works well for social media profiles that aren't username heavy, like Facebook, but not for Twitter or Instagram, which is very username heavy, so the logical way to add a new profile for them would be to add a provider and username only.
We built this logic about a month prior to today, but needed it for two apps in our infrastructure, so we've been converting it and extending it to a gem, which we've published to rubygems today.
Here's how it works.
parser = SocialMediaParser.parse "https://www.facebook.com/teamcoco" => #<SocialMediaParser::SocialMedia::Facebook:0x007fe014ef0f78 @url="https://www.facebook.com/teamcoco"> parser.username => "teamcoco" parser.provider => "facebook" parser.url => "https://www.facebook.com/teamcoco"
If you instead want to construct a profile using provider and username options, you can use this
parser = SocialMediaParser.parse provider: "twitter", username: "fallontonight" => #<SocialMediaParser::SocialMedia::Twitter:0x007fe40ab08330 @provider="twitter", @username="fallontonight"> parser.url => "https://www.twitter.com/fallontonight"
When there's not enough input provided for SocialMediaParser to extract a valid profile, it will just return a Link object
parser = SocialMediaParser.parse url: "http://www.mynewsdesk.com" => #<SocialMediaParser::Link:0x007fe40ab9b770 @url="http://www.mynewsdesk.com"> parser.url => "http://www.mynewsdesk.com" parser.username => nil
That's it, really. We hope to find this useful to someone!
Parse social media attributes from url or construct url from attributes