Skip to content

Instantly share code, notes, and snippets.

View cupnoodle's full-sized avatar

soulchild cupnoodle

View GitHub Profile
@cupnoodle
cupnoodle / restaurants.csv
Created August 9, 2019 13:39
Restaurants data CSV
id name slogan
1 KFC Finger lickin good
2 Mcdonalds I’m lovin it
3 Domino’s Pizza 30 minutes guaranteed
4 Taco bell taco time
@cupnoodle
cupnoodle / food.csv
Created August 9, 2019 13:38
Sample Food CSV
name price restaurant_id
Zinger Burger 7 1
Colonel Bucket 19 1
McChicken Burger 5 2
Cheeseburger 4 2
Chicken Pepperoni Pizza 8 3
Spicy Tuna Pizza 9 3
Grilled Burrito 6 4
Nachos Bowl 3 4
@cupnoodle
cupnoodle / URLSessionOperationPlayground.swift
Created May 1, 2019 12:51
Call URLSession downloadTask sequentially
//: [Previous](@previous)
import Foundation
//: [Next](@next)
class URLSessionOperation : Operation {
var task : URLSessionDownloadTask?
@cupnoodle
cupnoodle / ruby2.5-chrome-js.Dockerfile
Last active November 7, 2019 09:08
Ruby 2.5.0 + Chrome webdriver + nodejs / yarn
FROM ruby:2.5.0
ENV CHROMIUM_DRIVER_VERSION 75.0.3770.90
ENV CHROME_VERSION 75.0.3770.90-1
RUN apt-get update && apt-get install -y --no-install-recommends wget xvfb xauth unzip \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list \
&& apt-get update -y \
&& wget http://dl.google.com/linux/deb/pool/main/g/google-chrome-unstable/google-chrome-unstable_${CHROME_VERSION}_amd64.deb \
@cupnoodle
cupnoodle / ruby2.5-chrome.Dockerfile
Created March 27, 2019 17:53
ruby chrome dockerfile
FROM ruby:2.5.0
RUN apt-get update && apt-get install -y --no-install-recommends wget xvfb xauth unzip \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list \
&& apt-get update -y \
&& apt-get install -y google-chrome-stable \
&& wget -q --continue -P /usr/local/bin "https://chromedriver.storage.googleapis.com/73.0.3683.68/chromedriver_linux64.zip" \
&& unzip /usr/local/bin/chromedriver* -d /usr/local/bin \
&& rm /usr/local/bin/chromedriver*.zip \
@cupnoodle
cupnoodle / Dockerfile
Created August 4, 2018 16:19
Ruby base image 2.5 + chrome Dockerfile
FROM ruby:2.5.0
RUN apt-get update && apt-get install -y --no-install-recommends wget xvfb unzip \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list \
&& apt-get update -y \
&& apt-get install -y google-chrome-stable \
&& wget -q --continue -P /usr/local/bin "http://chromedriver.storage.googleapis.com/2.40/chromedriver_linux64.zip" \
&& unzip /usr/local/bin/chromedriver* -d /usr/local/bin \
&& rm /usr/local/bin/chromedriver*.zip \
@cupnoodle
cupnoodle / delayedExpectation.swift
Created June 20, 2018 11:18
Swift unit test with delay to wait the UI to present
let alertExpectation = XCTestExpectation(description: "testAlertShouldAppear")
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0, execute: {
XCTAssertTrue(loginVC.presentedViewController is UIAlertController)
alertExpectation.fulfill()
})
wait(for: [alertExpectation], timeout: 1.5)
@cupnoodle
cupnoodle / loginText.txt
Created June 16, 2018 06:11
Add text on login screen of mac
sudo defaults write /Library/Preferences/com.apple.loginwindow LoginwindowText "This computer is attached to iCloud account and valueless if loss. Please return by calling [phone] , reward included."
@cupnoodle
cupnoodle / rake_spec.rb
Created May 12, 2018 15:55
Run rake task in rspec test
require 'rake'
# make sure to set correct relative path
load File.expand_path("../../../../lib/tasks/once.rake", __FILE__)
describe 'some name' do
before(:all) do
# because rake task accepts different environment
Rake::Task.define_task(:environment)
@cupnoodle
cupnoodle / create_invoice.rb
Created April 17, 2018 07:26
Quickbooks error
require 'quickbooks-ruby'
require 'oauth2'
require 'dotenv'
Quickbooks.sandbox_mode = true
OAUTH_CONSUMER_KEY = ENV['OAUTH_CLIENT_ID']
OAUTH_CONSUMER_SECRET = ENV['OAUTH_CLIENT_SECRET']