Skip to content

Instantly share code, notes, and snippets.

View perfectfoolish's full-sized avatar
🎯
Focusing

perfectfoolish

🎯
Focusing
View GitHub Profile
$VERBOSE = nil # We'll explain this at the end of the lesson.
require 'prime' # This is a module. We'll cover these soon!
def first_n_primes(n)
unless n.is_a? Integer
return "n must be an integer."
end
if n <= 0
class Machine
@@users = {}
def initialize(username, password)
@username = username
@password = password
@@users[username] = password
@files = {}
end
class Person
def initialize(name, age)
@name = name
@age = age
end
public # This method can be called from outside the class.
def about_me
puts "I'm #{@name} and I'm #{@age} years old!"
class Account
attr_reader :name, :balance
def initialize(name, balance=100)
@name = name
@balance = balance
end
def display_balance(pin_number)
puts pin_number == pin ? "Balance: $#{@balance}." : pin_error
end
#!/bin/bash
if [ `uname -m` = "x86_64" ]; then
ARCH="linux64"
else
ARCH="linux32"
fi
#AEGIS_UPDATE_SITE="http://update.aegis.aliyun.com"
AEGIS_UPDATE_SITE="http://aegis.oss.aliyuncs.com"
#!/usr/bin/env ruby
## for mac
#/Users/git/.rvm/rubies/ruby-1.9.3-p385/bin/ruby
require_relative '../lib/gitlab_init'
#
# GitLab shell, invoked from ~/.ssh/authorized_keys
#
#!/user/bin/env bash
on_die() {
echo
echo byebye proxy
echo
networksetup -setsocksfirewallproxystate "Ethernet 2" off #close the proxy
# the name can be "wifi" or "Ethernet 1", just see what is listed in "network preference"
}
require 'find'
puts ""
puts "-----------------------File Search-----------------------------------"
puts ""
print "Enter the search path : "
searchpath = gets
searchpath = searchpath.chomp
puts ""
print "Enter the search pattern : "
pattern = gets
require 'rubygems'
require 'rubyzip'
require 'find'
require 'zip/zip'
puts ""
puts "------------------File Search and Zip-----------------------------"
puts ""
print "Enter the search path : "
searchpath = gets
@perfectfoolish
perfectfoolish / secret_token.rb
Created September 27, 2013 02:37
modify file of config/initializers/secret_token.rb for pulic code
# Be sure to restart your server when you modify this file.
# Your secret key is used for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
# You can use `rake secret` to generate a secure secret key.
# Make sure your secret_key_base is kept private