Skip to content

Instantly share code, notes, and snippets.

@eterps
eterps / sequel_playground.rb
Created April 6, 2016 15:17
Sequel playground
#!/usr/bin/env ruby
require 'sequel'
require 'logger'
require 'awesome_print'
DB = Sequel.sqlite
DB.create_table :people do
primary_key :id
String :name
@sketchytech
sketchytech / article.json
Last active March 22, 2016 16:12
Apple News Format: Text Styles (Character Formatting)
{
"version": "1.1",
"identifier": "sketchyTech_Demo",
"title": "My First Article",
"language": "en",
"layout": {},
"components": [{
"role": "title",
"text": "My First Article",
"textStyle": "titleStyle",
@koenbollen
koenbollen / branch.sh
Created January 25, 2016 12:25
branch will let you quickly create a git branch prefixed with your username
# branch will let you quickly create a git branch prefixed with your username
function branch() {
name=${@:?"mssing argument usage: branch BRANCH NAME"}
slug=$(echo "${name}" | tr -s "A-Z_ " "a-z--" | tr -cd "a-z0-9-" )
cmd="git checkout -b ${USER}/${slug}"
echo -n "\033[37;1m${cmd}?\033[0m [\033[0;32menter\033[0m/\033[0;31mctrl+c\033[0m] "
read || return
eval $cmd
}

Using Sublime Text for Go Development

Credits goes to Mark Wolfe.

If you're new to golang then before you start setup your workspace, firstly watch this video Writing, building, installing, and testing Go code.

Usually after installing go, I'm running the following commands to make GOPATH available for my user

mkdir -p ~/Documents/My/gocode/src/github.com/shamil

#!/bin/bash
set -x
HOST=https://www.ticketswap.nl
FISSA="$1" # Example: /53148/de-beste-singer-songwriter-van-nederland
while :
do
date
URI=$(curl -s "$HOST$FISSA" \
-H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36' \
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active May 3, 2024 12:59
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@bensie
bensie / base.rb
Created December 6, 2012 17:53
Sinatra API Helpers
require "sinatra/base"
require "sinatra/namespace"
require "multi_json"
require "api/authentication"
require "api/error_handling"
require "api/pagination"
module Api
class Base < ::Sinatra::Base
@luetkemj
luetkemj / wp-query-ref.php
Last active April 25, 2024 09:37
WP: Query $args
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/
@rstacruz
rstacruz / index.md
Last active November 3, 2023 09:56
Rails models cheatsheet

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

@natritmeyer
natritmeyer / purge.rb
Created November 1, 2011 12:07
HTTP Purge, for use with Varnish
require 'rest-client'
class Net::HTTP::Purge < Net::HTTPRequest
METHOD = 'PURGE'
REQUEST_HAS_BODY = false
RESPONSE_HAS_BODY = true
end
module RestClient
def self.purge(url, headers={}, &block)