Skip to content

Instantly share code, notes, and snippets.

View frippz's full-sized avatar
:octocat:

Fredrik Frodlund frippz

:octocat:
View GitHub Profile
@media screen {
.cell {
outline: 1px solid green;
}
.cell-group {
outline: 1px solid red;
}
@frippz
frippz / feed.xml
Created January 3, 2017 10:35
Sample feed from Hemnet
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
<channel>
<image>
<title>Hemnet</title>
<link>http://www.hemnet.se/</link>
<url>http://www.hemnet.se/images/logga_hemnet.gif</url>
</image>
<link>http://www.hemnet.se/mitt_hemnet/sparade_sokningar/11466596.xml</link>
<title>Hemnet bostadsbevakning - Gårdar i sydvästra Skåne</title>

Keybase proof

I hereby claim:

  • I am frippz on github.
  • I am frippz (https://keybase.io/frippz) on keybase.
  • I have a public key whose fingerprint is 245A C595 B915 4DBB 4EB2 80DC 4BE1 FF81 2E2B E0D0

To claim this, I am signing this object:

@frippz
frippz / github-webhook-deploy.php
Last active July 29, 2016 10:10
Github webhook PHP script
<?php
try {
// Decode JSON data from Github
$payload = json_decode($_REQUEST['payload']);
}
catch(Exception $e) {
exit(0);
}
// Deploy live if push was on master branch
@frippz
frippz / theme.zsh
Created February 23, 2016 13:26
ZSH prompt theme
autoload colors && colors
PROMPT='
$(_user_host)${_current_dir} $(git_prompt_info) $(_ruby_version)
▶ '
PROMPT2='%{$fg[grey]%}◀%{$reset_color%} '
RPROMPT='$(_vi_status)%{$(echotc UP 1)%}$(_git_time_since_commit) $(git_prompt_status) ${_return_status}%{$(echotc DO 1)%}'
@frippz
frippz / convert2svgfont.pe
Created October 10, 2013 10:42
Convert multiple TrueType files to SVG
#!/usr/local/bin/fontforge
i=1
while ( i<$argc )
Open($argv[i])
Generate($argv[i]:r + ".svg")
i = i+1
endloop
@frippz
frippz / bitbucket-webhook-deploy.php
Last active December 18, 2015 00:29
Bitbucket POST service script
<?php
try {
// Decode JSON data from Bitbucket
$payload = json_decode($_REQUEST['payload']);
}
catch(Exception $e) {
exit(0);
}
file_put_contents('payload.log', print_r($payload, TRUE), FILE_APPEND);
@frippz
frippz / post-merge
Created October 26, 2015 15:23 — forked from sindresorhus/post-merge
git hook to run a command after `git pull` if a specified file was changed.In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed.Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
#!/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
@frippz
frippz / ssh.zsh
Last active October 22, 2015 11:18
ssh-agent binding in ZSH
sshagent () {
SSHAGENT=$(ps ax|grep "[s]sh-agent"| grep -cv Z)
if (( $SSHAGENT == 0 ))
then
sshupdate
else
SSHPID="$(ps -eo pid,command | awk '/ ssh-[a]gent/ {print $1}');"
SSHPID_ENV=$(awk '/Agent/ {print $NF}' $HOME/.ssh-env)
if [[ $SSHPID == $SSHPID_ENV ]]
then
@frippz
frippz / osx.sh
Created April 13, 2015 13:46
dotfiles-osx
#!/usr/bin/env bash
# ~/.osx — https://mths.be/osx
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until `.osx` has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &