About StackOverflow
Published 2017-09-22, 16:35
I tried to post a few questions on StackOverflow in the last days which at times was a very negative experience: I was downvoted, got negative comments and of course got my questions closed as „offtopic“.
I am not the only one with that problem:
- https://hackernoon.com/the-decline-of-stack-overflow-7cb69faa575d
- https://movingfulcrum.com/stackoverflow-modding-itself-out-of-existence/
- https://news.ycombinator.com/item?id=9869886
Why do I write this down now? So I don’t start googling for exactly these posts and experiences the next time I am in this position, but can just go to this post, read some of these rants and accept it.
Then I can go back and see that maybe someone actually did provide a great comment or answer. Sometimes that still happens.
How to commit and version changes in a git fork/branch but not merge them back
Published 2017-09-21, 11:38
Recently I tried to figure out how to have both a production and staging environment of a Jekyll website hosted with Github Pages.
This turned out to be not that simple, as both repositories (Github Pages can only host one branch per repository, so you need two – one organization repository and one personal for example) need to have a CNAME
and _config.yml
file with different content.
So the actual question to answer was how can one commit and version changes to files in a git fork/branch but then not merge them back into the source, while still having a fully merged branch (so actual changes can be merged back via Pull Requests)?
The answer is to use the ours
merging strategy when merging the changes that should be skipped:
- Assume we have our
production
repo andstaging
repo both checked out locally, for now being identical (and having the sameCNAME
and_config.yml
). - Check out
staging
, make the changes to the files and commit and push them. - If we were to do a normal merge to
production
, this change would now get merged over. - But now we run these commands:
git checkout production
git merge --strategy=ours staging
(Source)
--strategy=ours
makes sure that during this merge, theproduction
file remain unchanged. But the commit is still marked as merged.
If we want, we can now also edit the merge commit messageto be a bit more descriptive what we just did: We merged the two branches, but made it keep „our“ (in this case:production
) version of the files. - Then push the changes to production:
git push production production:master
Your next changes to staging
can the be merged with production
normally, without getting the CNAME
and _config.yml
changes.
Rewriting history in Git
Published 2017-09-20, 21:00
Once again I was confused about rewriting history in Git:
Why and how is "rebase" and "rewrite history" in git the same thing? I'm confused. A lot.
— Jan Piotrowski (@Sujan) September 20, 2017
As I am not a git power user – I use a GUI, SourceTree of GitKraken – for the more complicated commands and features, my mind tends to just „crash“ now and then and forget what they are and how they work.
A bit later I had it figured out again:
Answer myself: Rebase "reapplies" commits by creating "copies" of them. These "copies" can be modified. Rebasing on same "base" = rewrite.
— Jan Piotrowski (@Sujan) September 20, 2017
During these 15 minutes I googled around and found some nice explanations I now want to conserve for future reference:
- Git Interactive Rebase, Squash, Amend and Other Ways of Rewriting History
- Reword the last commit message
- Reword other commit messages
- Interactive Rebase
- Reword other commit messages, take 2
- Squash commits together
- Rebase on top of master
- DANGER: You are rewriting history
- Rewriting History with Git Reset
- soft reset
- mixed reset
- hard reset
- Changing history, or How to Git pretty: Lesson three: How to change history
- revert
- –amend
- reset
- rebase
And an additional nice thing to know and use when playing around with those:
- Git Tutorial: How to Never Lose Changes in Git
- Create an additional branch to secure your commits
Move (clone and close) Github issues to a different repository
Published 2017-08-04, 11:45
If you have any projects on Github that span multiple repositories you know the pain when someone creates a valid issue, but uses the wrong repo to do so. Of course you could tell them to „Create another issue in the correct repo and gtfo“ but that a) wouldn’t be very nice and b) is a quite a lot of work and c) probably wouldn’t have the intended effect to grow your Github community.
So you need a way to move issues betweens repos.
Github doesn’t support this out of the box, but of course some other people jumped in and created things that do. Here is an overview of my research on this:
- Github Issue Mover
github-issue-mover.appspot.com / github.com/google/github-issue-mover
Almost a classic, started in 2014, this tools allows you to paste the source issue and target repo to be moved and then does the job. - Kamino
chrome.google.com/webstore/detail/kamino/ffdebockfdjileaojbbccofhgncmioaf / github.com/gatewayapps/kamino
This Chrome extension is „better“ in that it adds the „move issue“ button directly to the Github issue page and also remembers the last 5 used repos. - Zenhub seems to have a „Move Issue“ button if you use their tool.
- github-issues-import is an old but trusty Python script that can do the job for one or many issues.
How to develop iOS 10.3.x apps in Xcode 8.2.x
Published 2017-07-10, 18:44
If you work on an older version of Mac OS, for example because Apple decided your Macbook is to old to upgrade to a recent version, you might be stuck with Xcode 8.2.x to develop and test your iOS apps. Unfortunately this can lead to this nice error message if you made the mistake to upgrade your iPhone to iOS 10.3:
Could not locate device support files
This iPhone 6s is running iOS 10.3.1 (14E304), which may not be supported by this version of Xcode.
This is because the old Xcode doesn’t get these „device support files“ via updates any more. Luckily the internet is here to rescue you.
- Download https://www.dropbox.com/s/i1f7q8w3vgr2ozl/10.3%20%2814E269%29.zip?dl=0 and extract it
- Click on „Finder“ in MAC OS
- Click on „Go to Folder“
- Paste this path:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport- Paste your extracted „10.3 (14E269)“ directory to that place.
- Quit Xcode and restart it (and maybe the whole Mac).
- You can now run your projects successfully on your real device again.
Adapted from source: https://gist.github.com/steipete/d9b44d8e9f341e81414e86d7ff8fb62d#gistcomment-2041802
Overview of the trakt.tv API Concepts and Endpoints
Published 2017-07-03, 17:24
trakt.tv offers a very comprehensive API with an amazing documentation. But thorough as it is – and the technical details like authentication, data formats, parameters etc. are really, really well covered – it can also feel a bit overwhelming when you jump in and want to get a first overview, or are only looking for some specific data or type of data.
As I just did exactly that, I went through the whole documentation and extracted the most relevant information. The order of this article, especially the API endpoints, follows the official API documentation. I only added some more headlines to group the endpoints in a better way:
Concepts
The API only defines some terms in „Terminology“, but there is a lot more to understand what there is and how it is all connected:
- There are Users and objects: Movies, Shows with Seasons and Episodes.
- Users
- Users can watch things:
- Users can checkin to or scrobble movies and episodes. These are then first marked as watching, later as watched after the runtime (complicated, read details in docs).
- Users can additionally add to history for movies, shows, seasons and episodes to mark them as watched instantly.
- Users can create multiple Lists and have one Collection and one Watchlist (of movies, shows, seasons, and episodes).
- Users can write Comments on movies, shows, seasons, episodes, or lists.
- Users can create Replies and Likes on comments and lists.
- Users can create Replies and Likes on comments and lists.
- Users can create Ratings on movies, shows, seasons and episode.
- Users have Settings and a Profile
- Users can follow other users to create Follower Requests and eventually become Followers, Following and Friends
- Users can watch things:
- Objects
- There is additional information for some objects:
- Summary for movies, people, shows, seasons and episodes collect all known information about them
- Aliases of movies and shows
- Releases of movies
- Translations of movies, shows and episodes
- People are cast and crew of shows and movies
- Search can look for movies, shows, episodes, people, and lists by text or ID.
- Related objects are calculated for movies and shows.
- Stats are calculated for movies, shows, seasons, episodes and users.
- There is additional information for some objects:
- Users and Objects
- History and Playback are calculated based on checkins and scrobbles (= movies and episodes watched) and manual „add to history“.
- Last Activities are collected from history and all other user activities (comments, replies, likes, ratings).
- Based on the releases of objects and the history of the user there are Calendars for shows and episodes.
- Recommendations are given to users for movies and shows.
- Collection Progress and Watch Progress is calculated for users for shows and their episodes.
- Users can create Hidden Items to hide things (movies, shows or episodes) in calendars, collection progress, watch progress and recommendations.
Use the checkboxes next to the terms to deactivate them in the list below. You can also set if they only should be deactivated or completely hidden.
Emojis Legend
These Emojis are used in the official documentation to indicate what functionality is offered by or needed for an endpoint.
- 📄 = Pagination
- 📄? = optional
- ✨ = Extended Info
- 🎚 = Filters
- 🔒 = OAuth
- 🔒? = optional
- 🔒! = required
Data Endpoints
These return the nitty-gritty of Trakt: Lots of data about shows and movies and all the things related to them:
- Calendars
- All Shows ✨ 🎚 – Returns all shows airing during the time period specified.
- All New Shows ✨ 🎚 – Returns all new show premieres (season 1, episode 1) airing during the time period specified.
- All Season Premieres ✨ 🎚 – Returns all show premieres (any season, episode 1) airing during the time period specified.
- All Movies ✨ 🎚 – Returns all movies with a release date during the time period specified.
- All DVD ✨ 🎚 – Returns all movies with a DVD release date during the time period specified.
- Checkin
- n/a
- Comments
- Movies
- Movies
- Trending 📄 ✨ 🎚 – Returns all movies being watched right now.
- Played 📄 ✨ 🎚 – Returns the most played (a single user can watch multiple times) movie.
- Watched 📄 ✨ 🎚 – Returns the most watched (unique users) movies.
- Collected 📄 ✨ 🎚 – Returns the most collected (unique users) movies.
- Anticipated 📄 ✨ 🎚 – Returns the most anticipated movies based on the number of lists a movie appears on.
- Box Office ✨ – Returns the top 10 grossing movies in the U.S. box office last weekend.
- Updates 📄 ✨ – Returns all movies updated since the specified UTC date.
- Movie
- Summary ✨ – Returns a single movie’s details.
- Aliases – Returns all title aliases for a movie.
- Releases – Returns all releases for a movie including country, certification, release date, release type, and note.
- Translations – Returns all translations for a movie, including language and translated values for title, tagline and overview.
- Comments 📄 – Returns all top level comments for a movie.
- Lists 📄 – Returns all lists that contain this movie.
- People ✨ – Returns all cast and crew for a movie.
- Stats – Returns lots of movie stats.
- Watching ✨ – Returns all users watching this movie right now.
- Movies
- People
- Recommendations
- n/a
- Scrobble
- n/a
- Search
- Text Query 📄 ✨ 🎚 – Search all text fields that a media object contains (i.e. title, overview, etc).
- ID Lookup 📄 ✨ – Lookup items by their Trakt, IMDB, TMDB, TVDB, or TVRage ID.
- Shows
- Shows
- Trending 📄 ✨ 🎚 – Returns all shows being watched right now.
- Played 📄 ✨ 🎚 – Returns the most played (a single user can watch multiple episodes multiple times) shows.
- Watched 📄 ✨ 🎚 – Returns the most watched (unique users) shows.
- Collected 📄 ✨ 🎚 – Returns the most collected (unique users) shows.
- Anticipated 📄 ✨ 🎚 – Returns the most anticipated shows based on the number of lists a show appears on.
- Updates 📄 ✨ – Returns all shows updated since the specified UTC date.
- Show
- Summary ✨ – Returns a single show’s details.
- Aliases – Returns all title aliases for a show.
- Translations – Returns all translations for a show, including language and translated values for title and overview.
- Comments 📄 – Returns all top level comments for a show.
- Lists 📄 – Returns all lists that contain this show.
- People ✨ – Returns all cast and crew for a show.
- Stats – Returns lots of show stats.
- Watching ✨ – Returns all users watching this show right now.
- Next Episode ✨ – Returns the next scheduled to air episode.
- Last Episode ✨ – Returns the most recently aired episode.
- Shows
- Seasons
- Seasons
- Summary ✨ – Returns all seasons for a show including the number of episodes in each season.
- Season
- Seasons
- Episodes
- Episode
- Summary ✨ – Returns a single episode’s details.
- Translations – Returns all translations for an episode, including language and translated values for title and overview.
- Comments 📄 – Returns all top level comments for an episode.
- Lists 📄 – Returns all lists that contain this episode.
- Stats – Returns lots of episode stats.
- Watching ✨ – Returns all users watching this episode right now.
- Episode
- Sync
- n/a
- Users
- Profile 🔒? ✨ – Get a user’s profile information.
- Collection 🔒? ✨ – Get all collected items in a user’s collection.
- Comments 🔒? 📄 ✨ – Returns comments a user has posted sorted by most recent.
- Lists
- Lists
- Get 🔒? – Returns all custom lists for a user.
- List
- Get 🔒? – Returns a single custom list.
- List Item
- List Items 🔒? 📄? ✨ – Get all items on a custom list.
- List comment 📄 – Returns all top level comments for a list.
- Lists
- Follow
- History 🔒? 📄 ✨ – Returns movies and episodes that a user has watched, sorted by most recent.
- Watchlist 🔒? 📄? ✨ – Returns all items in a user’s watchlist filtered by type.
- Watching 🔒? ✨ – Returns a movie or episode if the user is currently watching something.
- Watched 🔒? ✨ – Returns all movies or shows a user has watched sorted by most plays.
- Stats 🔒? – Returns stats about the movies, shows, and episodes a user has watched, collected, and rated.
User Endoints
If it matters which user is logged in via OAuth, these endpoints are collected here:
- Calendars
- My Shows 🔒! ✨ 🎚 – Returns all shows airing during the time period specified.
- My New Shows 🔒! ✨ 🎚 – Returns all new show premieres (season 1, episode 1) airing during the time period specified.
- My Season Premieres 🔒! ✨ 🎚 – Returns all show premieres (any season, episode 1) airing during the time period specified.
- My Movies 🔒! ✨ 🎚 – Returns all movies with a release date during the time period specified.
- My DVD 🔒! ✨ 🎚 – Returns all movies with a DVD release date during the time period specified.
- Checkin
- Checkin 🔒! – Check into a movie or episode.
- Delete 🔒! – Removes any active checkins, no need to provide a specific item.
- Comments
- Comments
- Post a comment 🔒! – Add a new comment to a movie, show, season, episode, or list.
- Comment
- Update 🔒! – Update a single comment created within the last hour
- Delete 🔒! – Delete a single comment created within the last hour.
- Replies
- Post 🔒! – Add a new reply to an existing comment.
- Like
- Like 🔒! – Votes help determine popular comments.
- Remove 🔒! – Remove a like on a comment.
- Comments
- Movies
- n/a
- People
- n/a
- Recommendations
- Movies 🔒! ✨ – Personalized movie recommendations for a user.
- Hide Movie 🔒! – Hide a movie from getting recommended anymore.
- Shows 🔒! ✨ – Personalized show recommendations for a user.
- Hide Show 🔒! – Hide a show from getting recommended anymore.
- Scrobble
- Search
- n/a
- Shows
- Show
- Collection Progress 🔒! – Returns collection progress for a show including details on all aired seasons and episodes.
- Watched Progress 🔒! – Returns watched progress for a show including details on all aired seasons and episodes.
- Show
- Seasons
- n/a
- Episodes
- n/a
- Sync
- Last Activities 🔒! – Returns a list of dates when the user last interacted with trakt.tv for different object types.
- Get Watched 🔒! ✨ – Returns all movies or shows a user has watched sorted by most plays.
- Playback
- Playback 🔒! – Whenever a scrobble is paused, the playback progress is saved.
- Remove Playback 🔒! – Remove a playback item from a user’s playback progress list.
- Collection
- Get Collection 🔒! ✨ – Get all collected items in a user’s collection.
- Add to Collection 🔒! – Add items to a user’s collection.
- Remove from Collection 🔒! – Remove one or more items from a user’s collection.
- History
- Get History 🔒! 📄 ✨ – Returns movies and episodes that a user has watched, sorted by most recent.
- Add to History 🔒! – Add items to a user’s watch history.
- Remove from History 🔒! – Remove items from a user’s watch history including all watches, scrobbles, and checkins.
- Watchlist
- Get Watchlist 🔒! 📄? ✨ – Returns all items in a user’s watchlist filtered by type.
- Add to Watchlist 🔒! – Add one of more items to a user’s watchlist.
- Remove from Watchlist 🔒! – Remove one or more items from a user’s watchlist.
- Users
- Settings 🔒! – Get the user’s settings so you can align your app’s experience with what they’re used to on the trakt website.
- Follower Requests
- Follower Requests 🔒! ✨ – List a user’s pending follow requests so they can either approve or deny them.
- Approve or Deny Follower Requests
- Approve 🔒! – Approve a follower.
- Deny 🔒! – Deny a follower.
- Hidden Items
- Hidden Items 🔒! 📄 ✨ – Get hidden items for a section.
- Add Hidden Items 🔒! – Hide items for a specific section.
- Remove Hidden Items 🔒! – Unhide items for a specific section.
- Likes 🔒! 📄 – Get items a user likes.
- Profile 🔒? ✨ – Get a user’s profile information.
- Collection 🔒? ✨ – Get all collected items in a user’s collection.
- Comments 🔒? 📄 ✨ – Returns comments a user has posted sorted by most recent.
- Lists
- Lists
- Get 🔒? – Returns all custom lists for a user.
- Create 🔒! – Create a new custom list.
- List
- Get 🔒? – Returns a single custom list.
- Update 🔒! – Update a custom list by sending 1 or more parameters.
- Delete 🔒! – Remove a custom list and all items it contains.
- List Like
- Like 🔒! – Votes help determine popular lists.
- Remove 🔒! – Remove a like on a list.
- List Item
- List Items 🔒? 📄? ✨ – Get all items on a custom list.
- Add List Item 🔒! – Add one or more items to a custom list.
- Remove List Item 🔒! – Remove one or more items from a custom list.
- Lists
- Follow
- Follow
- Follow 🔒! – Follow a user.
- Unfollow 🔒! – Unfollow someone you already follow.
- Followers 🔒? ✨ – Returns all followers including when the relationship began.
- Following 🔒? ✨ – Returns all user’s they follow including when the relationship began.
- Friends 🔒? ✨ – Returns all friends for a user including when the relationship began.
- Follow
- History 🔒? 📄 ✨ – Returns movies and episodes that a user has watched, sorted by most recent.
- Watchlist 🔒? 📄? ✨ – Returns all items in a user’s watchlist filtered by type.
- Watching 🔒? ✨ – Returns a movie or episode if the user is currently watching something.
- Watched 🔒? ✨ – Returns all movies or shows a user has watched sorted by most plays.
- Stats 🔒? – Returns stats about the movies, shows, and episodes a user has watched, collected, and rated.
Master Data Endpoints
These endpoints offer mostly static data that should be retrieved once and then be cached for further use:
- Certifications
- List – Get a list of all certifications, including names, slugs, and descriptions.
- Genres
- List – Get a list of all genres, including names and slugs.
- Networks
- List – Get a list of all TV networks, including the name.
And that’s it! All essential API endpoints of the trakt.tv API, groupd by type and explained a bit more.
Google Spreadsheet: Output current date (statically)
Published 2017-06-30, 13:03
Imagine you have a Google Spreadsheet with a „last active“ column where you e.g. log the date when you last worked on the line item. You don’t want to have to type the date every time you change something as a) typing is cumbersome and b) you don’t even know the current date anyway.
Normally there is a default keyboard shortcut for that in Google Spreadsheets:
Insert time: | Ctrl + Shift + ; |
Unfortunately this doesn’t really work with a German keyboard (in Windows 10 with English OS language). In Chrome you can replace the Semicolon with Ü, but in Firefox this doesn’t work and I found no way to trigger this shortcut 🙁
Two solutions:
- Create a field with formula `=TODAY()`, maybe in the second row of the headline of the table. (Unfortunately this value will be recalculated on every change – so you can’t just use THAT everywhere to get the date – this value will change.) Now you can just Ctrl + C to copy that value and then Ctrl + Shift + V to output its value (and not copy the formula) to the target cell.
- Add a „Date“ validation to your column. Now you can double click the cell to get a nice calendar tooltip thingie where you can just click on the date you want.
To be honest 1) doesn’t really solve b), but you can leave the formula from 1) in the subheader for that anyway and just use 2) use this instead of the value pasting from 1).
(Visual) CMS for Jekyll
Published 2017-06-22, 12:20
Jekyll is „a blog-aware, static site generator in Ruby“. It also is used by Github Pages, which means you can host simple static sites, managed via Git, for free with it. That’s great.
Not that great (for me) is that you have to manage the content in the file system and manually handle Markdown files. That’s why there are multiple visual, hosted CMS for Jekyll.
I looked at some of them:
- Siteleaf is a nice hosted application that offers a structured view of your Jekyll files. Collections get their own navigation entries, the Markdown editor is decent (although
superpretty small with no fullscreen or „show the relevant stuff only“ option), even their visual editor (beta) doesn’t seem to bad.
Unfortunately it is unusable for me as it messes with the front matter (resorts the entries) and _config.yml (also resorts and removes all comments) the moment you add the repository to siteleaf. Boo!Their collection view also doesn’t understand sub-folders and just ignores them.
The free plan is limited to 100 pages.
- Forestry does the same things as Siteleaf, but a lot better. Collections get their navigation, show the subfolders, front matter and config files stay untouched. The markdown and WYSIWYG editors are… okayish. Markdown view has a few strange bugs and although WYSIWYG is a great preview, using it to edit can break stuff quite fast. Switching between the two also can cause loss of data. Again the real editor is much too small, no fullscreen or „writing mode“ view – I don’t understand why this is not the focus.
Their team is very responsive via Intercom and also seems to fix bugs quite frequently. Let’s hope they continue doing so, then this could get pretty nice.
- cloudcannon is a different beast – it actually manages to make your rendered pages editable in their „Visual Editor“. Unfortunately advanced stuff like Automated „Table of Contents“ Generation of kramdown gets overwritten by this. The „Content Editor“ (WYSIWYG without my design) has the same problem and the „Source Editor“ is very sourcy and feels more like an programming IDE.Besides that the Editors are awesome, really great work from the team. You can hide all the UI to make a very focused write environment and everything seems very well thought out.
- Prose has no visual editor, no „structured“ view of the file system – but it just works. You can edit files, preview the Markdown, commit it to Github. The editor view is very clean and simple which makes for a great full screen experience. Before saving you also have a „diff“ view, that – although a bit rudimentary – gives a great overview of the changes you (accidentally?) created.
Although hosted on prose.io, Prose is also open source (since 2012!) and can be hosted on your own server. The instance on prose.io is great though, and you can (ab)use the Github issues as a support channel if needed. Nice people.
(A more complete list is at headlessCMS.org.)
So because of the shortcomings of Siteleaf (unusable because of messing with my data), Forestry (buggy editors) and Cloudcanon (doesn’t support advanced stuff) I am actually using Prose right now.
(Of course there also several options you can self host, but as that kind of defeats the purpose to go to a Github Pages hosted static site – now I have o host the CMS myself – I skipped those. Still, some links: MeetHyde, jekyll-admin)
YouTube RSS Feeds
Published 2017-04-23, 22:47
- https://www.youtube.com/feeds/videos.xml?channel_id=CHANNELID
- https://www.youtube.com/feeds/videos.xml?user=USERNAME
- https://www.youtube.com/feeds/videos.xml?playlist_id=YOUR_YOUTUBE_PLAYLIST_NUMBER
Source: http://stackoverflow.com/a/31535120
Mac OS X: Unabhängige Scroll-Richtung für Maus und Touchpad
Published 2017-04-04, 12:28
Natural Scrolling ist toll auf Mac OS X. Allerdings nur mit dem Touchpad, nicht mit der angeschlossenen USB-Maus. Dummerweise sind die „Scroll Direction“-Einstellungen von Maus und Touchpad aneinander gekoppelt, so dass wenn die eine (de)aktiviert wird, die andere dies auch tut.
Heute aber eine Lösung gefunden: https://pilotmoon.com/scrollreverser/
Installiert, konfiguriert, Problem behoben.