Skip to content

Instantly share code, notes, and snippets.

@d-srd
d-srd / OxfordComma.swift
Last active January 4, 2018 22:37
A naive (?) solution to this problem: "Given an Array of Strings, return a String listing them with correct Oxford commas"
let test = [
[""],
["Hello"],
["Hello", "World"],
["cat", "apple", "mac", "dog", "mouse", "seahorse"]
]
let oxford: ([String]) -> String = { strings in
switch strings.count {
case 1: return strings[0]
@d-srd
d-srd / SolarizedLight.css
Created January 15, 2018 23:03
A Solarized Light theme for the Just Read Chrome extension.
@font-face{font-family:"Source Sans Pro Semibold";src:url(chrome-extension://dgmanlpmmkibanfdgjocnabmcaclkmod/fonts/SourceSansPro-Semibold.ttf)}
@font-face{font-family:"Source Sans Pro Bold";src:url(chrome-extension://dgmanlpmmkibanfdgjocnabmcaclkmod/fonts/SourceSansPro-Bold.ttf)}
@font-face{font-family:"Source Sans Pro Light";src:url(chrome-extension://dgmanlpmmkibanfdgjocnabmcaclkmod/fonts/SourceSansPro-Light.ttf)}
@font-face{font-family:"Open Sans";src:url(https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i,800,800i)}
@font-face{font-family:"Inconsolata";src:url(https://fonts.googleapis.com/css?family=Inconsolata)}
@media screen {
*{box-sizing:border-box}
}
body{background-color:#fdf6e3;color:#657b83;font-family:"Open Sans",sans-serif;font-size:16px;line-height:1.75em}
h1,h2{font-family:"Source Sans Pro Bold",sans-serif}
 ,,,,
,;) .';;;;',
;;,,_,-.-.,;;'_,|I\;;;/),,_
`';;/:|:);{ ;;;|| \;/ /;;;\__
L;/-';/ \;;\',/;\/;;;.') \
.:`''` - \;;'.__/;;;/ . _'-._
.'/  \ \;;;;;;/.'_7:. '). \_
.''/  | '._ );}{;//.' '-: '.,L
.'. /  \ ( |;;;/_/ \._./;\ _,
. /  |\ ( /;;/_/ ';;;\,;;_,
import requests
from bs4 import BeautifulSoup
base_url = 'http://www.sczg.unizg.hr/prehrana/restorani/savska/'
req = requests.get(base_url, headers={'User-Agent': 'Mozilla Firefox'})
content = req.content
page = BeautifulSoup(content, 'html.parser')
jelovnik = page.find_all('div', attrs={'class': 'content'})[1]
print(jelovnik)
# sample fastlane lanes
lane :provision do
match(
git_url: "git@bitbucket.org:agitrepo.git",
type: "development",
username: "username",
force_for_new_devices: true,
clone_branch_directly: true,
app_identifier: "com.company.identity",
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin</string>
</dict>
<key>KeepAlive</key>
#!/usr/bin/env sh
if [[ -z "${TEMP_KEYCHAIN_PATH}" ]]; then
echo '$TEMP_KEYCHAIN_PATH environment variable not set. Using default keychain path'
TEMP_KEYCHAIN_PATH=$HOME/cert-keychain.keychain
echo $TEMP_KEYCHAIN_PATH
fi
echo
pipeline {
agent {
label "osx"
}
stages {
stage("Bitbucket checkout") {
steps {
slackSend channel: 'Building the app’
checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: "CleanBeforeCheckout"]], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'creds', url: 'git@bitbucket.org/agitrepo.git']]])
}
class StatusItemController {
let statusItem: NSStatusItem
var title: String {
get {
return statusItem.button?.title ?? ""
}
set {
statusItem.button?.title = newValue
}
class AppDelegate: NSObject, NSApplicationDelegate {
let statusItemController = StatusItemController(title: "Click Me")
func applicationDidFinishLaunching(_ aNotification: Notification) {
// Insert code here to initialize your application
}
func applicationWillTerminate(_ aNotification: Notification) {
//let Insert code here to tear down your application
}