Giter Site home page Giter Site logo

hr-til's Introduction

HR-TIL

til

TIL is an open-source project by the team at Hashrocket that catalogues the sharing & accumulation of knowledge as it happens day-to-day. Posts have a 200-word limit, and posting is open to any Rocketeer as well as select friends of the team. We hope you enjoy learning along with us.

This site was open-sourced as a window into our development process, as well as to allow people to experiment with the site on their own and contribute to the project.

Today I Learned was ported to Elixir/Phoenix in 2017 (source code), and the Rails application is no longer in production or actively maintained by Hashrocket. Thanks to all of our contributors!

Install

If you are creating your own version of the site, fork the repository.

Then, follow these setup steps:

$ git clone https://github.com/hashrocket/hr-til
$ cd hr-til
$ gem install bundler
$ bundle install
$ cp config/application.yml{.example,}
$ rake db:create db:migrate db:seed
$ rails s

In development, db:seed will load sample data for channels, developers, and posts. Omit this command to opt-out of this step, or create your own sample data in db/seeds/development.rb.

Authentication is managed by Omniauth and Google. See the omniauth-google-oauth2 README and Google Oauth 2 docs for setup instructions. To allow users from a domain, multiple domains, or a specific email to log in, set those configurations in your environmental variables:

# config/application.yml

permitted_domains: 'hashrocket.com|hshrckt.com'
permitted_emails: '[email protected]'

Ensure you have set the google client id and google client secret via Oauth instructions.

Once set, visit '/admin' and log in with a permitted email address or domain.

Testing

Run all tests with:

$ rake

Or, run all the test in parallel with flatware:

$ flatware fan rake db:test:prepare
$ flatware rspec && flatware cucumber

Dependencies

  • The gem selenium-webdriver depends on the Firefox browser.
  • The gems flatware-rspec and flatware-cucumber require ZeroMQ. Learn more here.

Environmental Variables

basic_auth_credentials both toggles and defines basic authentication:

# config/application.yml

basic_auth_credentials: username:password

slack_post_endpoint allows the app to post to Slack:

# config/application.yml

slack_post_endpoint: /services/some/hashes

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Bug reports and pull requests are welcome on GitHub at https://github.com/hashrocket/hr-til. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

Usage

We love seeing forks of Today I Learned in production! Please consult our usage guide for guidelines on appropriate styling and attribution.

License

TIL is released under the MIT License.


About

Hashrocket logo

TIL is supported by the team at Hashrocket, a multidisciplinary design and development consultancy. If you'd like to work with us or join our team, don't hesitate to get in touch.

hr-til's People

Contributors

camerond avatar chriserin avatar greis avatar hashrocketeer avatar jbranchaud avatar jwworth avatar latentflip avatar michaeldimmitt avatar murjax avatar ryenotbread avatar tmock12 avatar vnegrisolo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hr-til's Issues

Broken seed data

db:seed task is broken:

bundle exec rake db:seed
ActiveRecord::UnknownAttributeError: unknown attribute 'max_likes' for Post

Developer Twitter Handle Should Allow Nil

The developer's profile page is expanding, adding a use case of pushing the 'Submit' button with no Twitter handle set.

The form should be able to be submitted without setting a Twitter handle, and not raise an error, because we allow Twitter handles to be null in the database.

HTML <code> tag and overflow

screenshot from 2016-02-23 01 14 05

The horizontal scroll bar for a code block (when the content overflows) does not work. Setting overflow: scroll seems to fix this although the scroll bar would now always show.

It seems to only affect Chrome. I am using Version 48.0.2564.116 (64-bit) on Mac OS X.

Make Twitter feed more obvious

I love the TIL blog, so was extra pleased to find that it has a Twitter account. I'd suggest putting it right up front on the page where you can't miss it, in addition to under the question mark icon.

Phoenix Port

Hey all, I wanted to drop a quick message here to say that we are porting this application to Phoenix!

There's been excitement about Elixir brewing at Hashrocket for some time, and a few of us want to take on the challenge of building an internal tool in Phoenix. We'll be approaching it as a server-side rendered, test-driven CRUD application, just like the Rails original.

This repository will continue to be maintained through any Phoenix production deployment, and beyond.

Here's the Phoenix repository, for those who are interested in following along and contributing:

https://github.com/hashrocket/tilex

Marketing footer should not show on drafts

Expected

When I create a draft in a channel with a marketing 'need help' footer, and then go to that drafts show page, I should not see the marketing footer beneath the draft. It should be external-facing only.

Observed

The marketing footer shows up on drafts, when it exists.

Post slugs should be unique

Expected

No post should have the same slug as another post.

Observed

There is nothing preventing this from happening in Rails or Postgres.

Deindex 'Raw Source' Pages

Each TIL post has a corresponding raw source
page. Fortunately, these duplicate raw source pages don’t appear to be
indexed by search engines; however, we should still noindex the raw source
pages (using X­Robots­Tag: noindex HTTP headers).

Slack Name Posts with Empty String

Expected behavior

If I go to my profile page, don't set a slack profile name, and then save my profile, my username should be included in the Slack notification the next time I create a post.

jakeworth created a new post - Conveying Intent with RSpec subject #testing

Observed Behavior

If I go to my profile page, don't set a slack profile name, and then save my profile, my Slack name is saved as a blank string. The next time I create a post, that blank string takes precedence over my username, and Slack posts with:

created a new post - Conveying Intent with RSpec subject #testing

Display syntax type on code snippets

We should display the syntax type used on code snippets so the user can identify it faster.

So if a contributor type:

```javascript
var x = true;
x ? 'yes' : 'no'
//=> "yes"
x = false;
x ? 'yes' : 'no'
//=> "no"
```

We could add javascript as a hint to following:

screen shot 2016-06-02 at 7 12 08 am

By the way this is the generated html for that block:

screen shot 2016-06-02 at 7 11 11 am

## reference

On Ember documentation:

screen shot 2016-06-02 at 7 12 27 am

RecordNotFound error in authors/username

When requesting authors/username, I receive a RecordNotFound error starting that the requested Developer could not be found. This seems to only occur when the Developer username contains a ., (e.g. "john.smith"). Should these types of usernames simply not be allowed to exist or should they be accommodated in some way?

Titles with Emojis Make Bad Slugs 😐

Steps to reproduce

Expected behavior

When I add an emoji to the end of a post title such as 'Cool trick 😀', the autogenerated slug should be 'cool-trick'.

Actual behavior

The slug is 'cool-trick-' -- extra dash at the end. Doesn't break the link, but isn't perfect.

System configuration

Mac OSX, Chrome

Statistics Page Dates are Off

Expected Behavior

When there are two posts from yesterday and none from today, and I look at the chart on the 'Statistics' page, I should see a bar of height '2' for yesterday, and no bar for today.

Observed Behavior

Sometimes I see a bar of height '1' for yesterday, and '1' for today.

Slack post titles mangled

Expected

A post with this title:
Save the "less" buffer

Should post to Slack on creation as:
Save the "less" buffer

Observed

Posts to Slack as:
Save the "less" buffer

No way to delete posts or drafts

First of all, I would like to say thanks for this! I've always had a passing interest in web development, but I never really had a chance to really dig into the nuts and bolts. When I discovered your stuff on a post in Hacker News, I really wanted to explore it.

One thing I've noticed, though, is that there doesn't seem to be any way to delete posts or drafts. Don't see it in the features list either. Is this something just not yet implemented? Just wondering if this is something that I could really dig into solving (baby steps 👍), or if its by design.

bundle fails

Hello,

Yesterday, I tried setting up the blog, and bundling fails out of the box:

❯ bundle
Fetching gem metadata from https://rubygems.org/........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Using rake 10.5.0
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.8.3
Using thread_safe 0.3.5
Using builder 3.2.2
Using erubis 2.7.0
Your Gemfile.lock is corrupt. The following gem is missing from the DEPENDENCIES section: 'mini_portile'

I am using bundler version 1.11.2.

Personally, I got past the issue by removing Gemfile.lock, and running bundle, but it's obviously not the right fix for this issue.

I started with a clean slate for gems, since I did not have ruby 2.3.0 installed (which the project currently asks for).

I figure you guys would have a better idea of how to update the lock file rather than me!

Let me know if you need any more information.
Cheers!

Plans for customizing TIL?

Hello,

I'm trying to launch TIL for my company's engineering team, and we have some questions regarding customizations.

Currently, TIL is a Rails app. This means that we have to clone the repo and make changes to the code to customize styles and templates.

What are you guys' plan to support customization?
For example, do you plan to turn TIL into an engine, so that I can load it as a gem and provide my own stylesheets?

Cheers!

Hashtags with Dashes Display Improperly on Twitter

Expected Behavior

When I create a post about #command-line and a tweet is autogenerated, it should include a hashtag that works with Twitter, such as #commandline.

Observed Behavior

When I create a post about #command-line and a tweet is autogenerated, it includes the channel name #command-line as the hashtag. Twitter doesn't support dashed (-) hashtags, so only #command is a clickable, searchable hashtag.

Issue template

This project would benefit from a Git issues template. It would make contribution easier and more consistent. Something like:

Expected

I expected it to not be broken.

Observed

Guess what? It's broken.

Getting error during rake db:setup

Can't seem to create 'Developer #1'...

*** Loading development seed data Creating developer #1 rake aborted! ActiveRecord::RecordInvalid: Validation failed: Email is invalid /home/ubuntu/.rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/validations.rb:79:inraise_record_invalid'`

The contents of config/seeds/development.rb:

5.times do |i| puts "Creating developer ##{i + 1}" username = Phil.name.downcase.delete(' ') Developer.create!(username: username, email: "#{username}@hashrocket.com") end

Anything I can do to get this moving?

Error in oauth, jwt 'decode' issue

Also just tried changing over my authorized domains to my own, generated an API key at the Google dev console, and got this error:

JWT::InvalidIatError
Invalid iat

end
if options[:verify_iat] && payload.include?('iat')
  fail JWT::InvalidIatError.new('Invalid iat') unless payload['iat'].is_a?(Integer) && payload['iat'].to_i <= Time.now.to_i
end
if options[:verify_aud] && options['aud']
  if payload['aud'].is_a?(Array)

jwt (1.5.1) lib/jwt.rb:170:in decode'
omniauth-google-oauth2 (0.3.1) lib/omniauth/strategies/google_oauth2.rb:61:in block in <class:GoogleOauth2>'

Looks like you can disable jwt, by going in config/initializers/omniauth.rb and adding:
skip_jwt: true

This allowed me to login.

Create a Dockerfile for deploying it

(This is not a bug so I skipped the template)

I was giving a look to your work, seeing it is a very interesting and short way to pubish a post as a group or company. I was just thinking that it would be very nice to have a Dockerfile (Or something in Kubernetes) to easily deploy an instance of hr-til, even for improving your deploy pipeline.

As I see in the README.md instructions it has very short install steps, it might not be a very complex docker container. 😄

Thanks in advance!

Paginate Author Show Page

Steps to reproduce

Expected behavior

When I go to the Author's page, I expect to see a handful of posts, and pagination.

Actual behavior

When I go to the author's page, I see all the posts. For some of our authors this is hundreds of records to load.

We have already implemented pagination with Kaminari in posts#index -- I'd like this solution to follow that pattern.

App posts to Slack more than once on tens of likes

Expected behavior:

When a post hits 10 likes, it posts an announcement to Slack. If the person who 'liked' it 'unlikes' it, then 'likes' it again, there should not be a second (or third, etc.) post to Slack for that milestone.

Observed behavior:

When a post hits 10 likes, it posts an announcement to Slack. If the person who 'liked' it 'unlikes' it, then 'likes' it again, we get a second (or third, etc.) identical post to Slack for that milestone.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.