klenwell information services : CocktailNapkin2015

Wiki source for CocktailNapkin2015


Show raw source

Return to SpecialCocktailNapkin

=== Data Structures and Algorithms ===
~- [[http://interactivepython.org/runestone/static/pythonds/index.html | http://interactivepython.org/]]
~- http://visualgo.net/
~- [[http://www.cs.usfca.edu/~galles/visualization/Algorithms.html | http://www.cs.usfca.edu/~galles/]]

=== Rubocop with Minitest ===
%%(ruby)
# lib/tasks/test.rake

require 'rubocop/rake_task'

# Add additional test suite definitions to the default test task here
namespace :test do
desc 'Run RuboCop on all ruby source directories'
RuboCop::RakeTask.new(:rubocop) do |task|
task.patterns = ['lib/**/*.rb', 'app/**/*.rb', 'test/**/*.rb']

# Abort on failures (fix your code first)
task.fail_on_error = false
end
end

Rake::Task[:test].enhance ['test:rubocop']
%%

=== JSHint with Minitest ===
%%(ruby)
# lib/tasks/jshint.rake

desc "jshint"
task :jshint do
puts "# Running jshint:"
puts `jshint app/assets/javascripts/*`
raise "jshint did not run successfully" if ($?.exitstatus != 0)
puts "No errors found.\n\n"
end

Rake::Task[:test].enhance [:jshint]
%%

=== Rails Styling ===
~- SASS
~- Less
~- CDN

=== Wikka Formatter ===
%%(php)
<?php
/**
* https://gist.github.com/klenwell/d8e0555986f6c4639c51
* formatters/wikka_to_html.php
*/
class WikkaToHtmlFormatter {

public __construct($wikka) {
$this->wikka = $wikka;
}

public function to_xhtml($wikka_markup) {
$wikka_markup = $this->normalize_line_breaks($wikka_markup);
$xhtml = $this->wwml_to_xhtml($wikka_markup);
$xhtml = $this->snip_last_br_tag($xhtml);
$xhtml = $this->close_open_tags($xhtml);
$xhtml = $this->enhance_xhtml($xhtml);
$xhtml = $this->inject_actions($xhtml);
return $xhtml;
}

private function normalize_line_breaks($wikka_markup) {}
private function wwml_to_xhtml($wikka_markup) {}
private function snip_last_br_tag($xhtml) {}
private function close_open_tags($xhtml) {}
private function enhance_xhtml($xhtml) {}
private function inject_actions($xhtml) {}
}
%%

%%(php)
<?php
/**
* handlers/api/api.php
* http://localhost:3000/wikka.php?wakka=FormattingRules/api
*/
$test_markup = $this->page['body'];

// Old formatter: formatters/wakka.php
$expected = $this->Format($test_markup, 'wakka', 'page');

// New formatter: formatters/wikka_to_html.php
require_once('formatters/wikka_to_html.php');
$formatter = new WikkaToHtmlFormatter($this);
$xhtml = $formatter->to_xhtml($test_markup);

if ( $xhtml === $expected ) {
die('new formatter passed');
}
else {
print '<h4>Failed</h4>';
printf('<h2>Expected</h2><pre>%s</pre>',
Wakka::hsc_secure($expected,ENT_QUOTES));
print '<hr />';
printf('<h2>New Formatter</h2><pre>%s</pre>',
Wakka::hsc_secure($xhtml,ENT_QUOTES));
die('new formatter failed');
}
%%

=== On Long Hours and Productivity ===
Comment on [[http://www.adaptrm.com/blog/9-ways-to-be-more-productive-backed-by-science/ | article]] that got flagged on HN:

> Studies shown if you lower your daily work hours from 20 to 8 and work 5 days instead of 6, your productivity increases!

#1 reaffirms something I strongly believe (whether on the basis of personal experience, something I've read before, or mere wishful thinking, I don't recall). It is a sensible constraint that came to mind in reading all the Amazon horror stories.

While reading that New York Times article I checked out the link to their 14 sacred principles. The funny thing was that I agreed with most of them. They were all ideas that occurred to me over the course of my career working independently, with small companies, and especially now in corp.

The one thing that was missing, I felt, was a Rule #15: Never work more than 8 hours a day.

Without it, it's no surprise you end up with the sort of dystopian workplace documented in the Times article and all over Reddit and HN here.

But then I suppose, as has been pointed before, long work hours are more about cultural signaling and penny-wise-pound-foolish accounting than really improving productivity.

=== ScoutWorks ===
WikiFish
~- [[https://github.com/jgm/pandoc | Pandoc]]
~- [[https://github.com/ryakad/pandoc-php | Pandoc-Php]]

=== Wikka Refactor ===
~- Merge Strategy
~- Functional Tests
~- Automated Deployment

=== Bundle, Rake, and rbenv ===
See http://benscheirman.com/2013/12/using-rbenv-in-cron-jobs/

=== Rails DOM Test with Nokogiri ===
Because ##assert_select## kinda sucks sometimes:
%%
# Collect rows and shift off header row. I'm using Nokogiri instead of css_select
# because I need to drill down to text node, which css_select makes hard if not
# impossible. Better element identifiers in template could have probably avoided this.
page = Nokogiri::HTML(@response.body)
transaction_rows = page.css("table#transactions tr")
transaction_rows.shift
%%

=== Unpublished Comment ===
https://news.ycombinator.com/item?id=9525582

I was hoping her model would get past the obvious shortcomings she glosses citing Yelp review at the end. I don't think Bernard Mandeville's poem is going to get us there.

The Righteous Society model sounds a lot like what we got on the Internet right now. See China's Human Search Engine for examples of this model in action:
http://www.bbc.com/news/magazine-25913472

I'm all for heroic efforts to spread justice. It's just that the old-fashioned techniques, marching in the streets, maybe even throwing a trash can through a shop window, seem like more measured approaches than a lot of what I seen come from the internet.

=== Interview Portfolio ===
http://www.codequizzes.com/
[[https://drive.google.com/folderview?id=0B6K9xXSLapkzfkhlX0NJTmZCa2hIcDFFa1pVVXFLOENsTGc1RUZmZ29TRGxPQ001NGdsaTQ&usp=sharing | Google Drive]]

=== Wikka Before and After ===
Before: [[https://github.com/klenwell/WikkaWiki/blob/9dfc1/wikka.php | wikka.php]]
After: [[https://github.com/klenwell/WikkaWiki/blob/klenwell-refactor/wikka.php | wikka.php]]

=== Python with Jenkins ===
http://shiningpanda.com/python-multiple-versions-testing-with.html

=== Quick Temp Rails Controller ===
%%
# app/controllers/temps_controller.rb
# Add to routes.rb:
# resources :accounts, only: [:index]
class TempsController < ApplicationController

# GET /
def index
render html: 'hello world', layout: "application"
end

end
%%