Skip to content

Instantly share code, notes, and snippets.

View hanneskaeufler's full-sized avatar
🏠
I may be slow to respond.

Hannes Käufler hanneskaeufler

🏠
I may be slow to respond.
View GitHub Profile
@hanneskaeufler
hanneskaeufler / backstop_setup_usage.sh
Last active April 8, 2018 10:20
Using BackstopJS
# Install backstopjs locally
yarn add backstopjs
# Setup folders, configuration etc.
./node_modules/.bin/backstopjs init
# Edit backstop.json to configure the viewports you want to test on.
# I use the following:
# "viewports": [
# {
padding = 10
pos = (self.__from_right(badge_width), start_y + padding, self.__from_right(padding), start_y + self.__row_height() - padding)
self.draw.rectangle(pos, outline = self.BLACK)
- self.draw.text((self.__from_right(badge_width + 35), start_y + 17), self.PASSED, font = self.badge_font, fill = self.BLACK)
+ self.draw.text((self.__from_right(badge_width - 35), start_y + 17), self.PASSED, font = self.badge_font, fill = self.BLACK)
def __render_project_name(self, row):
index = row[0]
def __render_row(self, row):
self.__render_project_name(row)
+ self.__render_project_status(row)
+
+ def __render_project_status(self, row):
+ start_y = (row[0] + 1) * self.__row_height()
+ badge_width = 150
+ padding = 10
+ pos = (self.__from_right(badge_width), start_y + padding, self.__from_right(padding), start_y + self.__row_height() - padding)
+ self.draw.rectangle(pos, outline = self.BLACK)
private def single_post(post : Post)
article do
header class: "post-title" do
h2 do
text post.title
link "#", to: Blog::Posts::Show.with(post.slug)
end
post_meta(post)
end
content(post)
<?php
public function test_it_sets_the_full_name() {
$subject = new User();
$subject->setFirstname("Peter");
$this->assertEquals("Peter", $subject->getFirstname());
}
<?php
public function test_it_sets_the_full_name() {
$subject = new User();
$name = "Peter";
$subject->setFirstname($name);
$this->assertEquals($name, $subject->getFirstname());
}
@hanneskaeufler
hanneskaeufler / switch_to_safari.scpt
Created June 1, 2016 19:25
AppleScript to move all the open tabs in Google Chrome to Safari
tell application "Google Chrome"
set allUrls to {}
repeat with theWindow in every window
set urlsInWindow to {}
repeat with theTab in every tab of theWindow
set currentUrl to the theTab's URL
set urlsInWindow to urlsInWindow & {currentUrl}
end repeat
set allUrls to allUrls & {urlsInWindow}
end repeat