Skip to content

Instantly share code, notes, and snippets.

@btoone
btoone / curl.md
Last active April 2, 2024 20:18
A curl tutorial using GitHub's API

Introduction

An introduction to curl using GitHub's API.

The Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin
@btoone
btoone / eval_gist.rb
Last active February 1, 2023 21:53 — forked from petekeen-cf/eval_gist.rb
Eval Gist
# Usage:
#
# Rails
# Step 1: write a gist with a file named __script__.rb
# Step 2: copy and paste the function def below into Rails console
# Step 3: run `eval_gist("the-gist-id-from-the-url")`
# Step 4: GOTO Step 3
#
# Ruby
# Start an IRB session and load this file
@btoone
btoone / __script__.rb
Last active February 1, 2023 21:52
Hello World
puts "[#{Time.now}] Hello from GitHub!"
@btoone
btoone / gist:2289225
Created April 3, 2012 04:07
Regex to match parts of a domain
Regex to match parts of a domain
http://stackoverflow.com/questions/4636497/regular-expression-match-domain-in-uri
^[^\/]+:\/\/[^\/]*?\.?([^\/.]+)\.[^\/.]+(?::\d+)?\/
http://www.rubular.com/r/Uv5ON7eAz4
^ # Match the beginning of the string
[^\/]+:\/\/ # Match the protocol (e.g. http://)
[^\/]*? # Non-greedy match of the sub-domains
\.? # Optional . (for when a sub-domain is used)
@btoone
btoone / deploy.rb
Created August 17, 2011 14:48
Example Capistrano configuration for multi stage deployment
# app/config/deploy.rb
# Most of the changes specific to your environment will be set in
# the `app/config/deploy/[env].rb` files.
# define multiple deployments
set :stages, %w(production staging)
set :default_stage, "staging"
# Basic commands
:Git [args] # does what you'd expect
all of your `~/.gitconfig` aliases are available.
:Git! [args] # same as before, dumping output to a tmp file
Moving inside a repo.
sed -i '/pattern/d' file
sed -i.bak 's/pattern1/pattern2/g' file
@btoone
btoone / .vimrc
Last active April 9, 2019 15:03
Vimrc for use with iVim on iOS
" Set leader to be spacebar
let mapleader=" "
set hlsearch
set incsearch
set laststatus=2
set ruler
set history=100
set autoindent
set backspace=indent,eol,start
@btoone
btoone / ng-demo.html
Created March 28, 2014 21:49
Demo of Angular all in a single file.
<!DOCTYPE html>
<html lang="en">
<head>
<title>AngularJS Routing example</title>
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet">
<style>
body {
padding-top: 10px;
background-color: #F5F5F5;
}