Skip to content

Instantly share code, notes, and snippets.

View mattb20's full-sized avatar

Matthew Burgoyne mattb20

  • Leeds, UK
View GitHub Profile
@mattb20
mattb20 / reverse_fun.rb
Last active January 4, 2018 16:27
While loop help
def reverse_fun(n)
limit = n.length.to_i
n = n[0..limit-1].reverse
i = 0
while i < limit-1
n = n[0..i] + n[i+1..limit-1].reverse
i =+ 1
end
@mattb20
mattb20 / array,rb
Created January 8, 2018 14:41
checking array for matching elements
count = 0
for i in 0...arr1.length.to_i
if arr1[i] === arr2[i]
count +=1
else
end
@mattb20
mattb20 / while loop
Created February 1, 2018 09:38
while loop
else
i = 1
cat_years = cat_years - 28
dog_years = dog_years - 29
while cat_years != dog_years
cat_years = cat_years - 4
dog_years = dog_years - 5
i = i + 1
end
end
@mattb20
mattb20 / todolist.rb
Created March 16, 2018 15:59
How to properly generate an instance of Todolist?
class Todo
def initialize(string)
@to_do = string
end
def text
puts @to_do
end
end
gulp.task('bootstrap-sass', function() {
return gulp.src('./public/bower/bootstrap-sass/lib/*.scss')
.pipe(sass())
.pipe(contact('bootstrap.css'))
.pipe(gulp.dest('./public/dist/css'));
});
gulp.task('site-sass', function() {
return gulp.src('./public/app/scss/*.scss')
.pipe(sass())
{
"src_folders" : ["tests"],
"output_folder" : "reports",
"selenium": {
"start_process": true,
"server_path": "./bin/selenium-server-standalone-3.9.1.jar",
"log_path": false,
"host": "127.0.0.1",
"port": 4444
let express = require('express');
let path = require('path');
let mongoose = require('mongoose');
mongoose.set('debug', true);
mongoose.connect('mongodb://localhost:27017/makersbnb_test');
const spaceController = require('./controllers/spaceController.js');
var bodyParser = require('body-parser');
let app = express();
app.set('views', path.join(__dirname, 'views'));
function testDisplayNoteURL() {
var note1 = new Note("some text");
var note2 = new Note("some different text");
var note3 = new Note("more different text");
var note4 = new Note("more different text");
list.store(note1);
list.store(note2);
list.store(note3);
list.store(note4);
var listView = new ListView(list);
class PostsController < ApplicationController
def new
@post = Post.new
end
def create
@post = current_user.posts.build(post_params)
redirect_to posts_url
end
create_table "walls", force: :cascade do |t|
t.bigint "user_id"
t.index ["user_id"], name: "index_walls_on_user_id"
end