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
| module Bar | |
| module ClassMethods | |
| # `new` is a class method on the `Class` object | |
| # It then uses `send` to access `initialize` which would otherwise be a private instance method | |
| # So it can be overridden by extending the your class with a new `new` class method | |
| def new(*args, &block) | |
| super | |
| p "new constructor defined" | |
| end | |
| end |
| # === EDITOR === | |
| Pry.editor = 'vi' | |
| require 'awesome_print' | |
| # == Pry-Nav - Using pry as a debugger == | |
| Pry.commands.alias_command 'c', 'continue' rescue nil | |
| Pry.commands.alias_command 's', 'step' rescue nil | |
| Pry.commands.alias_command 'n', 'next' rescue nil | |
| # === CUSTOM PROMPT === |
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 sessionDebugger
| //Authorization popup window code | |
| function ShowAuthWindow(options) | |
| { | |
| console.log('ee'); | |
| options.windowName = options.windowName || 'ConnectWithOAuth'; // should not include space for IE | |
| options.windowOptions = options.windowOptions || 'location=0,status=0,width=800,height=400'; | |
| options.callback = options.callback || function(){ window.location.reload(); }; | |
| var that = this; | |
| console.log(options.path); | |
| that._oauthWindow = window.open(options.path, options.windowName, options.windowOptions); |
| use std::str; | |
| fn main() { | |
| // -- FROM: vec of chars -- | |
| let src1: Vec<char> = vec!['j','{','"','i','m','m','y','"','}']; | |
| // to String | |
| let string1: String = src1.iter().collect::<String>(); | |
| // to str | |
| let str1: &str = &src1.iter().collect::<String>(); | |
| // to vec of byte |
| #Model | |
| @user.should have(1).error_on(:username) # Checks whether there is an error in username | |
| @user.errors[:username].should include("can't be blank") # check for the error message | |
| #Rendering | |
| response.should render_template(:index) | |
| #Redirecting | |
| response.should redirect_to(movies_path) |
| // https://www.youtube.com/watch?v=wU6udHRIkcc | |
| /* | |
| Disjoint Set Union (“DSU”) is the Data Structure: disjoint-set data structure | |
| is a data structure that keeps track of a set of elements partitioned into a | |
| number of disjoint (non-overlapping) subsets. | |
| Union Find is the Algorithm: A union-find algorithm is an algorithm that can | |
| be used to detect cycles in an undirected graph & performs two useful operations | |
| on such a data structure: |
The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.
The correct way of creating a private frok by duplicating the repo is documented here.
For this assignment the commands are:
git clone --bare [email protected]:usi-systems/easytrace.git
| #!/usr/bin/env python3 | |
| import os | |
| import sys | |
| from base64 import b64encode | |
| from uuid import uuid4 | |
| try: | |
| from cryptography import x509 | |
| from cryptography.hazmat.backends import default_backend |