Skip to content

Instantly share code, notes, and snippets.

View michaldarda's full-sized avatar

Michał Darda michaldarda

View GitHub Profile
@michaldarda
michaldarda / powrc
Created September 5, 2013 20:53 — forked from madwork/powrc
export SSL_CERT_FILE=/usr/local/share/ca-bundle.crt
source /usr/local/share/chruby/chruby.sh
chruby $(cat .ruby-version)
#!/usr/bin/ruby
# Convert a Markdown README to HTML with Github Flavored Markdown
# Github and Pygments styles are included in the output
#
# Requirements: json gem (`gem install json`)
#
# Input: STDIN or filename
# Output: STDOUT
# Arguments: "-c" to copy to clipboard (or "| pbcopy"), or "> filename.html" to output to a file
# cat README.md | flavor > README.html
public class MLRoundedImageView extends ImageView {
public MLRoundedImageView(Context context) {
super(context);
}
public MLRoundedImageView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@michaldarda
michaldarda / cors
Created July 15, 2014 23:08
Just include in your nginx.conf inside location block to enable CORS, I assume that you have more_set_headers plugin compiled
# nginx does not allow add_headers inside if unless its location
set $cors "true";
# Nginx doesn't support nested If statements. This is where things get slightly nasty.
# Determine the HTTP request method used
if ($request_method = 'OPTIONS') {
set $cors "${cors}options";
}
if ($request_method = 'GET') {
@michaldarda
michaldarda / vim
Last active August 29, 2015 14:11
" First, add this to zsh or bashrc
" export CDPATH=$CDPATH:~/projects/main:~/projects/testing:~/projects/documentation:~/projects/gems:~/projects/support:~/projects/deployment
function! ChangeProject(target)
execute "cd " . a:target
edit .
endfunction
function! DirsCdPath()
let paths = split(globpath(&cdpath, '*'), '\n')

Mopidy on Arch Linux

mopidy

Installation

Install from the AUR.

@michaldarda
michaldarda / pushclient.go
Created March 10, 2015 22:47
Pushserver + Pushclient
package main
import "golang.org/x/net/websocket"
import "log"
import "time"
import "fmt"
type Message struct {
Message string `json:"message"`
CreatedAt string `json:"created_at"`
@michaldarda
michaldarda / private_key.go
Created March 24, 2015 19:35
private_key.go
package main
import (
"crypto/x509"
"encoding/pem"
"io/ioutil"
"log"
)
func main() {
@michaldarda
michaldarda / gist:17d989f1793c8a2ee2f0
Created May 29, 2015 09:46
Give binary permissions to bind socket less than 1024 as non-root user
sudo setcap cap_net_bind_service=ep /opt/nginx/sbin/nginx
namespace :db do
require "sequel"
Sequel.extension :migration
DB = Sequel.connect(ENV['DATABASE_URL'])
desc "Prints current schema version"
task :version do
version = if DB.tables.include?(:schema_info)
DB[:schema_info].first[:version]
end || 0