Skip to content

Instantly share code, notes, and snippets.

View sholfen's full-sized avatar

Peter Liang sholfen

View GitHub Profile
@sholfen
sholfen / MissingInteger.cs
Created November 9, 2015 09:34
for Codility MissingInteger
using System;
namespace MissingInteger
{
class MainClass
{
public static void Main (string[] args)
{
int[] A = { 1, 3, 5, 4, 1, 2 };
int[] B = { 1 };
@sholfen
sholfen / PermCheck.cs
Created November 9, 2015 07:03
for Codility PermCheck
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PermCheck
{
class Program
{
@sholfen
sholfen / FrogRiverOne.cs
Created November 9, 2015 05:48
for Codility FrogRiverOne
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FrogRiverOne
{
class Program
{
@sholfen
sholfen / PermMissingElem.cs
Created November 9, 2015 03:59
for Codility PermMissingElem
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PermMissingElem
{
class Program
{
@sholfen
sholfen / FrogJmp.cs
Created November 9, 2015 00:37
for Codility: FrogJmp
using System;
// you can also use other imports, for example:
// using System.Collections.Generic;
// you can write to stdout for debugging purposes, e.g.
// Console.WriteLine("this is a debug message");
class Solution {
public int solution(int X, int Y, int D) {
// write your code in C# 6.0 with .NET 4.5 (Mono)
@sholfen
sholfen / TapeEquilibrium.cs
Last active November 8, 2015 14:38
for Codility
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TapeEquilibrium
{
class Program
{
@sholfen
sholfen / email_domain_counting.py
Created November 8, 2015 12:51
To count email domain
email_string = '[email protected];[email protected];[email protected]'
emails = email_string.split(';')
print emails
email_domains = {}
for email in emails:
domain = email.split('@')[1].strip()
if domain in email_domains:
email_domains[domain] += 1
else:
@sholfen
sholfen / appium_demo.py
Created August 3, 2015 15:06
Appium Demo with Python
import time
from appium import webdriver
from selenium.common.exceptions import WebDriverException
import os
#import os.path
import traceback
dic_localtion = {}
dic_localtion['touch0'] = (715, 1173)
dic_localtion['touch1'] = (314, 800)
@sholfen
sholfen / gist:12c1bb3d69f31363999f
Last active August 29, 2015 14:25
Web Automation for WalkieTicket
require 'rubygems'
require 'selenium-webdriver'
require_relative 'WebModule'
require_relative 'web_class.rb'
def buyTicket driver
#test url1: 'http://www.walkieticket.com/product.aspx?P1=0000003817'
#frip side: 'http://www.walkieticket.com/product.aspx?P1=0615231106'
#frip side2: http://www.walkieticket.com/order.aspx?P1=0615231106&P2=&P3=&P4=&P5=0&P9=0,0,0,0,0
@sholfen
sholfen / gist:513ed73ab68af578191e
Created July 12, 2015 10:15
Attribute Class Tip: AttributeUsage
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AttributeTestConsoleApplication
{
class Program
{