Skip to content

Instantly share code, notes, and snippets.

View marjinal1st's full-sized avatar
🥃
Master of Ballmer Peak

Ahmet Sezgin DURAN marjinal1st

🥃
Master of Ballmer Peak
View GitHub Profile
======== LOG OF FAILED TESTS ========
Your solution achieved a testing score of 180 out of 190.
Below you can see a short feedback for every test that failed, indicating the reason
for the test failure and how many points you lost for each individual test.
[Test Description] pascal: base cases
[Observed Error] java.lang.ArithmeticException: / by zero
[exception was thrown] detailed error message in debug output section below
[Lost Points] 10
=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')

Here's how to install PostgreSQL and have it run automatically at startup, on an Ubuntu 10.04 virtual machine using Vagrant. This took me a while to figure out:

Add the default lucid32 base box to your vagrant, if you haven't already:

host> vagrant box add lucid32 http://files.vagrantup.com/lucid32.box 

Now make a new lucid32 virtual machine and install postgresql on it:

Add .editorconfig file
create .editorconfig
Add .ruby-version file
create .ruby-version
Add disable_xml_params.rb file to initilizers
create config/initializers/disable_xml_params.rb
Add paperclip.rb file to initilizers
create config/initializers/paperclip.rb
Setting up database
force config/database.yml

Abstract

You could have postgre installed on localhost with password (or without user or password seted after instalation) but if we are developing we really don't need password, so configuring postgre server without password for all your rails project is usefull.

Install Postgre packages

  • postgresql
  • postgresql-client
  • libpq-dev
require 'luhn'
require 'json'
require 'uri'
require 'net/http'
notes = ["Note: spaces and dashes aren't allowed. If you are going to write\n",
"4444 4444 4444 4448 or 4444-4444-4444-4448, write:\n",
"4444444444444448.\n",
"Note 2:If your Diners Club card begins with 5 and is 16 digits,\n",
'it will be treated as a Mastercard.'
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="amuse"
# Example aliases
import pygame
from time import sleep
pygame.init()
pygame.mixer.init()
test = pygame.mixer.Sound("test.wav")
while True:
@marjinal1st
marjinal1st / peakdet.m
Last active August 29, 2015 14:07 — forked from endolith/peakdet.m
function [maxtab, mintab]=peakdet(v, delta, x)
%PEAKDET Detect peaks in a vector
% [MAXTAB, MINTAB] = PEAKDET(V, DELTA) finds the local
% maxima and minima ("peaks") in the vector V.
% MAXTAB and MINTAB consists of two columns. Column 1
% contains indices in V, and column 2 the found values.
%
% With [MAXTAB, MINTAB] = PEAKDET(V, DELTA, X) the indices
% in MAXTAB and MINTAB are replaced with the corresponding
% X-values.
@marjinal1st
marjinal1st / gist:db948f4f247fd0a29b65
Created November 19, 2014 20:29
updated builder script
#!/bin/bash
## Exit trap
trap 'ret=$?; test $ret -ne 0 && printf "failed\n\n" >&2; exit $ret' EXIT
set -e
## Fancy echo
fancy_echo() {
printf "\n%b\n" "$1"