Skip to content

Instantly share code, notes, and snippets.

View theomarkkuspaul's full-sized avatar
🏎️
window seat!

Theo Paul theomarkkuspaul

🏎️
window seat!
View GitHub Profile
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@slhck
slhck / video-extract.rb
Created May 2, 2012 07:06
Video Extraction for Ruby/FFmpeg
#!/usr/bin/env ruby
# Batch encodes videos from a list of editing points
# Author: Werner Robitza <werner.robitza@univie.ac.at>
FFMPEG = "ffmpeg" # => path to the FFmpeg executable
COPY = false # => if set to true, just does a bitstream copy
# => if set to false, encoding options below are used
OVERWRITE = "-n" # => set to "-n" if you just want to keep files that exist
@Integralist
Integralist / 1. sinatra-basic-with-comments.rb
Last active November 9, 2019 20:10
Create basic site using Ruby and Sinatra (and external templates)
#!/usr/bin/env ruby
=begin
install Sinatra: gem install sinatra
install Shotgun: gem install shotgun (this auto-reloads sinatra on every http request - which means every time you make a change in your code you don't have to stop then start sinatra)
To just run your code using Sinatra: ruby name-of-file.rb
To run your code using Shotgun (which is just Sinatra but with ability to auto-reload when changes are made to files): shotgun name-of-file.rb
The following examples are run using Shotgun and the URL is: http://127.0.0.1:9393/
@gittmaan
gittmaan / rbenv-install-system-wide.sh
Created July 23, 2012 22:54 — forked from v1nc3ntlaw/rbenv-install-system-wide.sh
rbenv install ruby 1.9.3-p194 on Ubuntu
# Update, upgrade and install development tools:
apt-get update
apt-get -y upgrade
apt-get -y install build-essential git-core curl libssl-dev \
libreadline6 libreadline6-dev \
zlib1g zlib1g-dev \
libmysqlclient-dev \
libcurl4-openssl-dev \
libxslt-dev libxml2-dev
@tedmiston
tedmiston / nodejs-tcp-example.js
Last active May 20, 2024 11:27
Node.js TCP client and server example
/*
In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp
server, but for some reason omit a client connecting to it. I added an
example at the bottom.
Save the following server in example.js:
*/
var net = require('net');
@lfender6445
lfender6445 / gist:9919357
Last active July 25, 2024 02:05
Pry Cheat Sheet

Pry Cheat Sheet

Command Line

  • pry -r ./config/app_init_file.rb - load your app into a pry session (look at the file loaded by config.ru)
  • pry -r ./config/environment.rb - load your rails into a pry session

Debugger

@rob-murray
rob-murray / siege_examples.sh
Last active April 1, 2024 03:48
Siege examples
# Basic example
siege -t60s -c20 -d10 'http://robertomurray.co.uk/'
# Basic auth;
auth=$(echo -n 'username:password' | openssl base64)
siege -t60s -c20 -d10 --header="Authorization:Basic $auth" 'https://staging.a-hostname.co.uk/'
@cmkoller
cmkoller / sinatra-flash.md
Last active July 25, 2021 07:34
Setting up Sinatra Flash

Setting Up Sinatra Flash

Sinatra Flash is an awesome gem that allows you to pop up little messages alerting your users of important things, via some simple code in your server.rb file. This is very useful for things like displaying error messages if the user has filled out a form wrong, or displaying "success" messages if the user did something successfully like sign in, sign out, or submit a form.

This also gives you a great chance to implement Foundation's beautiful alerts. Here's how to set it up!

  1. Install the gem by typing gem install sinatra-flash in your terminal.
  2. Require the gem in the top of your server.rb file: require 'sinatra/flash'
@NTag
NTag / remoteAtom.md
Last active December 19, 2023 12:09
How to install and use remote-atom

Installation

  1. Install Atom on your computer (https://atom.io)

  2. Launch Atom, go in Preferences, then chose Install, search for "remote-atom", and install it

  3. On the distant machine:

    cd ~
    wget https://raw.githubusercontent.com/aurora/rmate/master/rmate
    chmod +x rmate
@msmfsd
msmfsd / es7-async-await.js
Last active February 4, 2024 17:38
Javascript fetch JSON with ES7 Async Await
// Async/Await requirements: Latest Chrome/FF browser or Babel: https://babeljs.io/docs/plugins/transform-async-to-generator/
// Fetch requirements: Latest Chrome/FF browser or Github fetch polyfill: https://github.com/github/fetch
// async function
async function fetchAsync () {
// await response of fetch call
let response = await fetch('https://api.github.com');
// only proceed once promise is resolved
let data = await response.json();
// only proceed once second promise is resolved