This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func scrollViewWillEndDragging(scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) { | |
println("scrollViewWillEndDragging") | |
println("targetContentOffset: \(targetContentOffset.memory.y)") | |
var targetContentOffsetCorrected: CGPoint = targetContentOffset.memory | |
targetContentOffsetCorrected.y += contentInsetY | |
println("targetContentOffsetCorrected: \(targetContentOffsetCorrected.y)") | |
let targetCellIndexPath = self.tableView.indexPathForRowAtPoint(targetContentOffsetCorrected) | |
println("targetCellIndexPath row: \(targetCellIndexPath?.row)") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// A Swift implementation of the Dining Philosophers Problem: | |
// https://en.wikipedia.org/wiki/Dining_philosophers_problem | |
// | |
// | |
// P0 | |
// f3 f0 | |
// P3 P1 | |
// f2 f1 | |
// P2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This interactive iOS Safari bookmarklet lets you search for jobs on the HN Who is Hiring thread from an iOS device. | |
Go to the HN Who is Hiring thread, make a bookmark, change the title to "HN Job Searcher" and replace the address with the following (paste in): | |
javascript:void(function(){ var a=prompt('Enter keywords:').split(' ');var c=document.getElementsByClassName('athing');var r=[];for(var i=0;i<c.length;i++){ var m=0; for(var j=0;j<a.length;j++) { if (c[i].innerText.toLowerCase().indexOf(a[j].toLowerCase()) > -1) { m++; } } if (m==a.length) { r.push(c[i])} };var z=function(x, y) { x.onclick=function(){y.scrollIntoView();}}; for(var i=0;i<r.length;i++) {r[i].style.backgroundColor='orange';z(r[i], r[i+1])};r[0].scrollIntoView();}()) | |
Then open the bookmark as you normally would while on the thread. In the popup that appears type your job criteria, e.g. "javascript remote", and the results are shown. Tap on a result to go to the next one. Reload the page and open the bookmark again to search again. |