Skip to content

Instantly share code, notes, and snippets.

## Prepare ###################################################################
# Remove RVM
rvm implode
# Ensure your homebrew is working properly and up to date
brew doctor
brew update
## Install ###################################################################
require 'rspec/core/formatters/progress_formatter'
# Custom RSpec formatter that speaks aloud using the say command, if available.
# Not to be taken too seriously, but fun for annoying your coworkers.
# Usage: bundle exec rspec -r ./say_formatter.rb -f SayFormatter spec
class SayFormatter < RSpec::Core::Formatters::ProgressFormatter
VOICES = %w[Agnes Albert Alex Bad\ News Bahh Bells Boing Bruce Bubbles Cellos
Deranged Fred Good\ News Hysterical Junior Kathy Pipe\ Organ
Princess Ralph Trinoids Vicki Victoria Whisper Zarvox]
@istro
istro / gist:5973617
Last active December 19, 2015 14:59
The challenge: Given an array of integers, find the largest possible sum of consecutive elements of that array. Example: For array [3, -4, 8, -2, -1, 20] the output should be 25, because 8+(-2)+(-1)+20 Live version can be found on codepen - http://codepen.io/istro/pen/qEesB
// To break down the problem for myself better, I like to write some tests.
var test = function(){
// Array contains only negative integers -> result is the single largest element
if(findSum([-14, -5, -22]) != -5 && findSum([-3, -23, -1]) != -1){
alert('First test case fails.');
return false;
}
// Array contains only positive integers -> result is the sum of all elements
if(findSum([1, 2, 3]) != 6 && findSum([5, 6]) != 11){
@istro
istro / gist:6891815
Last active December 25, 2015 00:59
RSA authorization setup instructions

Generate a key pair:

ssh-keygen -t rsa

Press enter when it prompts for file location Enter a passphrase (simple one will do - it's only ever important if your private key (the one on your machine) gets compromised)

This will create a .ssh/ folder with two files - id_rsa and id_rsa.pub in your home directory.

Copy your public key to the server,

@istro
istro / Guardfile
Last active December 25, 2015 15:39
Guardfile.
notification :growl_notify
group :website do
guard 'remote-sync',
source: '1bog/website',
destination: 'public_html/buildtop',
user: 'ivans',
remote_address: '1bogtest.org',
exclude: "/website/init_personal.php",
exclude_from: '',
expected json format:
GET /locations/
{ locations: [
{
'id': 1,
'name': 'foo',
'postal': '123',
////// EXAMPLE
module.exports = function (server) {
// Create an API namespace, so that the root does not
// have to be repeated for each end point.
server.namespace('/api', function () {
// Return fixture data for '/api/posts/:id'
server.get('/posts/:id', function (req, res) {
var post = {
/// rooms.json
[{
"request": {
"url": "/rooms/:id"
},
"response": {
"data": {
"room": {
"id": 1,
@istro
istro / Gemfile
Last active August 29, 2015 14:00
Code for rails post
# Gemfile
source 'https://rubygems.org'
ruby "2.0.0"
gem 'rails', '~> 4.0.0'
...
group :development do
gem 'better_errors'
@istro
istro / Gruntfile.js
Last active August 29, 2015 14:00
Code for Ember post
// /Gruntfile.js
// task that is intended to be run by us
grunt.registerTask('server', "Run your server in development mode, auto-rebuilding when files change.", function(proxyMethod) {
...
grunt.task.run(['clean:debug',
'build:debug',
expressServerTask,
'watch'
]);