Skip to content

Instantly share code, notes, and snippets.

View ahall-medullan's full-sized avatar

Andrew Hall ahall-medullan

  • Medullan
  • Kingston, Jamaica
View GitHub Profile
@ujwalp1994
ujwalp1994 / BrowserStack.robot
Created July 4, 2017 14:34
Sample Test to run Robot tests on BrowserStack
*** Settings ***
Library Selenium2Library
Library Collections
Library Collections
Library String
Library BuiltIn
*** Variables ***
${SITE_URL} = https://sprint-005-origin.levi-site.com/CA/en_CA/
${SELENIUM_TIME_OUT} = 120
@candostdagdeviren
candostdagdeviren / Dangerfile
Last active February 1, 2023 10:40
Sample Dangerfile for iOS Project
# PR is a work in progress and shouldn't be merged yet
warn "PR is classed as Work in Progress" if github.pr_title.include? "[WIP]"
# Warn when there is a big PR
warn "Big PR, consider splitting into smaller" if git.lines_of_code > 500
# Ensure a clean commits history
if git.commits.any? { |c| c.message =~ /^Merge branch '#{github.branch_for_base}'/ }
fail "Please rebase to get rid of the merge commits in this PR"
end
@huguesbr
huguesbr / processAnnotatedString.rb
Last active July 20, 2017 17:32
Automatically replace annotated String (see format below) in Swift with corresponding tr(...) calls for https://github.com/AliSoftware/SwiftGen. Copy both into the project and call 'sh replaceAnnotatedLocalizeString.sh'
#!/usr/bin/env ruby
# take annotated string and transforms it to the tr(...) format as well as creating the localizable.strings entry
# arguments
localizable=ARGV[0]
filename=ARGV[1]
def makeFirstLetterUpper(string)
string[0].upcase + string[1..-1]
end
@lisawray
lisawray / ColumnItemDecoration.java
Last active May 29, 2023 21:11
Equal column spacing in a RecyclerView with GridLayoutManager
package com.example.columnspacing
import android.graphics.Paint;
import android.graphics.Rect;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
@lisawray
lisawray / MainActivity.java
Last active March 26, 2023 11:57
Vector drawables from XML with the Android support library 23.3.0
package com.xwray.vectorbinding;
import android.databinding.BindingAdapter;
import android.databinding.DataBindingUtil;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.graphics.drawable.VectorDrawableCompat;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;
@onmyway133
onmyway133 / SimpleResolver.swift
Last active July 9, 2019 22:49
SimpleResolver.swift
protocol Suit {
var name: String { get }
}
struct AntManSuit: Suit {
let name: String
}
struct YellowJacketSuit: Suit {
let name: String
@gaearon
gaearon / slim-redux.js
Last active March 11, 2026 12:07
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
}
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {
anonymous
anonymous / index.html
Created April 23, 2015 13:32
JS Bin // source http://jsbin.com/fahowefuhu
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<span id="x"></span>
<script id="jsbin-javascript">
// sometimes you just want to know when a variable changed
@e1024kb
e1024kb / gist:41bf38fdb1a2cb19a781
Created September 27, 2014 13:29
Country - state list in JSON
{
"countries": [
{
"country": "Afghanistan",
"states": ["Badakhshan", "Badghis", "Baghlan", "Balkh", "Bamian", "Daykondi", "Farah", "Faryab", "Ghazni", "Ghowr", "Helmand", "Herat", "Jowzjan", "Kabul", "Kandahar", "Kapisa", "Khost", "Konar", "Kondoz", "Laghman", "Lowgar", "Nangarhar", "Nimruz", "Nurestan", "Oruzgan", "Paktia", "Paktika", "Panjshir", "Parvan", "Samangan", "Sar-e Pol", "Takhar", "Vardak", "Zabol"]
},
{
"country": "Albania",
"states": ["Berat", "Dibres", "Durres", "Elbasan", "Fier", "Gjirokastre", "Korce", "Kukes", "Lezhe", "Shkoder", "Tirane", "Vlore"]
},
@mhawksey
mhawksey / main.js
Last active March 9, 2020 02:09
Using Google Apps Script to proxy YouTube Analytics Channel report data http://mashe.hawksey.info/?p=16234
// instead of var results = YouTubeAnalytics.Reports.query(ids, start-date, end-date, metrics, optionalArgs);
var params = {"method" : "post",
"payload" : {'ids' : query.ids,
"startDate" : startDate,
"endDate": endDate,
"metrics": query.metrics,
"options": JSON.stringify(options)
}
};
var yt_data = UrlFetchApp.fetch("https://script.google.com/macros/s/YOUR_APP_ID/exec", params);