Skip to content

Instantly share code, notes, and snippets.

View asunar's full-sized avatar
🏠
Working from home

Alper asunar

🏠
Working from home
View GitHub Profile
@asunar
asunar / movies_controller.rb
Created March 29, 2012 13:48
movies_controller.rb
class MoviesController < ApplicationController
def show
id = params[:id] # retrieve movie ID from URI route
@movie = Movie.find(id) # look up movie by unique ID
# will render app/views/movies/show.<extension> by default
end
def index
redirect =false
@asunar
asunar / CallServiceStackWithServiceReferenceClient
Created August 15, 2012 16:42
Calling service stack service without any parameters using service reference client
using System.ServiceModel;
using proxy = AcmeSOAClient.AcmeServices;
namespace AcmeSOAClient
{
class Program
{
static void Main(string[] args)
{
@asunar
asunar / gist:5213624
Created March 21, 2013 14:49
SFTP incorrect path issue
//snip
//Overloaded constructor
public PutFileToWmeMessage(string filePath, string folder)
{
FilePath = filePath;
Folder = folder;
}
//snip
@asunar
asunar / GetCombinations
Last active December 16, 2015 14:09
Given an array of letters, find all combinations that contain all the letters in the array
public static List<string> GetSubCombinations(List<string> letters)
{
if(letters.Count() == 1) return letters;
var combinations = new List<string>();
for(int i=0; i< letters.Count; i++)
{
var letterToInterleave = letters[i];
var remainder = letters.Where(x => x != letterToInterleave).ToList();
How to respect yourself and your application with End to End Testing
Learn to write fast and reliable automated browser tests
You may have heard of the testing pyramid. The conventional wisdom suggests 70% unit tests, 20% integration tests and 10% end-to-end tests.
End-to-end tests are slow, unreliable and brittle. With unit tests, each part may work individually, but how can we know if they fit together?
Let's explore real-world implementations of end-to-end testing and build a test suite that is fast AND reliable.
We will go over some examples using nightwatchjs and use
# ----------
# User Instructions:
#
# Define a function, search() that returns a list
# in the form of [optimal path length, row, col]. For
# the grid shown below, your function should output
# [11, 4, 5].
#
# If there is no valid path from the start point
# to the goal, your function should return the string
@asunar
asunar / search.py
Last active November 1, 2017 13:53
First Search Program
# ----------
# User Instructions:
#
# Define a function, search() that returns a list
# in the form of [optimal path length, row, col]. For
# the grid shown below, your function should output
# [11, 4, 5].
#
# If there is no valid path from the start point
# to the goal, your function should return the string
@asunar
asunar / index.html
Last active November 16, 2018 17:27
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
</head>
<body>
<p>Web Components Demo
<div>
<button is="hey-there-button" name="World">Howdy</button>
</div>
@asunar
asunar / sample.yaml
Last active January 16, 2021 15:26
CORS Configuration for a simple image processor
# Simple SAM template with CORS configuration for an image processor lambda
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
test
Sample SAM Template for test
Globals:
Function:
<html>
<body>
<button type="submit" onclick="submit();">Submit</button>
</body>
<script>
function submit(){
fetch("<api_url>", {