start new:
tmux
start new with session name:
tmux new -s myname
| # Beginning Rubyists: simply run >> ruby hex-convertions.rb to see examples | |
| # or use irb to build the code on the fly | |
| # you can convert HEX to DEC using the method .to_i(base), | |
| # which converts a string to a decimal number from the specified base number | |
| puts "00".to_i(16) | |
| puts "FF".to_i(16) |
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| # | |
| # Copyright (c) 2012, lepture.com | |
| # | |
| # Redistribution and use in source and binary forms, with or without | |
| # modification, are permitted provided that the following conditions | |
| # are met: | |
| # | |
| # * Redistributions of source code must retain the above copyright |
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| # | |
| # Copyright (c) 2012, lepture.com | |
| # | |
| # Redistribution and use in source and binary forms, with or without | |
| # modification, are permitted provided that the following conditions | |
| # are met: | |
| # | |
| # * Redistributions of source code must retain the above copyright |
| class Contact < ActiveRecord::Base | |
| state_machine :state, :initial => :imported do | |
| state :imported | |
| state :contacted | |
| state :verified | |
| state :prospect | |
| state :deleted | |
| end |
| module Authenticable | |
| def self.included(model) | |
| model.class_eval do | |
| extend ClassMethods | |
| include InstanceMethods | |
| field :username | |
| field :email | |
| field :crypted_password | |
| field :password_salt |
| =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') |
| Warden::Manager.serialize_into_session{|user| user.id } | |
| Warden::Manager.serialize_from_session{|id| User.get(id) } | |
| Warden::Manager.before_failure do |env,opts| | |
| # Sinatra is very sensitive to the request method | |
| # since authentication could fail on any type of method, we need | |
| # to set it for the failure app so it is routed to the correct block | |
| env['REQUEST_METHOD'] = "POST" | |
| end | |
| #!/bin/sh | |
| # Use socat to proxy git through an HTTP CONNECT firewall. | |
| # Useful if you are trying to clone git:// from inside a company. | |
| # Requires that the proxy allows CONNECT to port 9418. | |
| # | |
| # Save this file as gitproxy somewhere in your path (e.g., ~/bin) and then run | |
| # chmod +x gitproxy | |
| # git config --global core.gitproxy gitproxy | |
| # | |
| # More details at http://tinyurl.com/8xvpny |