Skip to content

Instantly share code, notes, and snippets.

View wahyusumartha's full-sized avatar
🎯
Focusing

Wahyu Sumartha wahyusumartha

🎯
Focusing
View GitHub Profile
@wahyusumartha
wahyusumartha / The Technical Interview Cheat Sheet.md
Created August 8, 2016 12:59 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/

Testing front-end for a Sinatra app with RSpec and Capybara

I've used Cucumber quite a bit on my last job. It's an excellent tool, and I believe readable tests are the way to the future. But I could never get around to write effective scenarios, or maintain the boatload of text that the suite becomes once you get to a point where you have decent coverage. On top of that, it didn't seem to take much for the suite to become really slow as tests were added.

A while ago I've seen a gist by Lachie Cox where he shows how to use RSpec and Capybara to do front-end tests. That sounded perfect for me. I love RSpec, I can write my own matchers when I need them with little code, and it reads damn nicely.

So for my Rails Rumble 2010 project, as usual, I rolled a Sinatra app and figured I should give the idea a shot. Below are my findings.

Gemfile

@wahyusumartha
wahyusumartha / sphinxxmlfeed.php
Created July 20, 2011 03:48
Sphinx XML Feed Generator Class
<?php
class SphinxXMLFeed extends XMLWriter
{
private $fields = array();
private $attributes = array();
public function __construct($options = array())
{
$defaults = array(
@wahyusumartha
wahyusumartha / dropbox-uploader.rb
Created July 13, 2011 06:19
ruby dropbox uploader
require 'rubygems'
require 'dropbox'
CONSUMER_KEY = "YOUR-CONSUMER-KEY"
CONSUMER_SECRET = "YOUR-SECRET-KEY"
DROPBOX_SESSION_FILE = "/Users/wahyusumartha/Documents/mongodb-db/script/dropbox_session.txt"
# Using when we do not have session
# session = Dropbox::Session.new("#{CONSUMER_KEY}", "#{CONSUMER_SECRET}")
# session.mode = :dropbox
# puts "Visit #{session.authorize_url} to log in to Dropbox. Hit enter when you have done this."
@wahyusumartha
wahyusumartha / MongoDB Backup Script
Created July 13, 2011 06:16
MongoDB Backup Script
#!/bin/bash
#!/usr/bin/env ruby
#########################################
# Define source and destinations
MONGO_DBS=""
BACKUP_TMP=~/tmp
BACKUP_DEST=~/backups
MONGODUMP_BIN=/Users/wahyusumartha/Documents/mongodb-db/bin/mongodump
TAR_BIN=/usr/bin/tar