View auth.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import google.auth | |
import googleapiclient.discovery | |
API_NAME = "displayvideo" | |
API_SCOPES = ["https://www.googleapis.com/auth/display-video"] | |
API_VERSION = "v1" | |
credentials, project = google.auth.default(scopes=API_SCOPES) | |
print(f"Google Cloud Project ID: {project}.") |
View bookmarket.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:if(window.WebKitPlaybackTargetAvailabilityEvent){var videos=document.getElementsByTagName("video");if(videos.length>0)for(var airplayable=videos[0],i=0;i<videos.length;i++)if(!(airplayable=videos[i]).paused){airplayable.webkitShowPlaybackTargetPicker();break}} |
View docker-compose.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3" | |
services: | |
homebridge: | |
container_name: homebridge | |
image: oznu/homebridge:raspberry-pi | |
restart: unless-stopped | |
network_mode: host | |
volumes: | |
- /etc/localtime:/etc/localtime:ro | |
- /media/config/homebridge:/homebridge |
View bookmarket.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:var videos=document.getElementsByTagName("video");if(videos.length>0)for(var pipable=videos[0],i=0;i<videos.length;i++)if(!(pipable=videos[i]).paused&&pipable.webkitSupportsPresentationMode&&"function"==typeof pipable.webkitSetPresentationMode){pipable.webkitSetPresentationMode("picture-in-picture"===pipable.webkitPresentationMode?"inline":"picture-in-picture");break} |
View ember-cli-update.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ember-cli-update { | |
if [ -z "$1" ]; then | |
echo "$(tput setaf 1)No Ember CLI version has been specified. Example: ember-cli-update 0.1.7$(tput sgr 0)" | |
return 1 | |
fi | |
echo "$(tput setaf 2)Uninstalling global Ember CLI...$(tput sgr 0)" | |
npm uninstall -g ember-cli | |
echo "$(tput setaf 2)Cleaning NPM and Bower cache...$(tput sgr 0)" |
View uploader_input.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UploaderInput < Formtastic::Inputs::FileInput | |
MAX_WIDTH_PIXELS = 300 | |
MAX_HEIGHT_PIXELS = 200 | |
def to_html | |
input_wrapping do | |
html_array = [] | |
html_array << label_html | |
html_array << cache_html if method_changed? | |
html_array << file_html |
View active_admin.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('.array-of-hashes-tables').on('click', '.array-of-hashes-table .remove', function(event) { | |
event.preventDefault(); | |
$(this).closest('.array-of-hashes-table').remove(); | |
}); | |
$('.array_of_hashes .add').on('click', function(event) { | |
event.preventDefault(); | |
var $this = $(this); | |
var $tables = $this.siblings('.array-of-hashes-tables'); | |
var $cloneable = $tables.find('.cloneable').first(); |
View select2.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Useage: select2("value to select", from: "label text") | |
module Capybara | |
module Select2 | |
def select2(value, options={}) | |
select_name = options[:from] | |
select2_container = first("label", text: select_name).find(:xpath, "..").find(".select2-container") | |
select2_container.find(".select2-choice").click | |
find(:xpath, "//body").find(".select2-drop li", text: value).click | |
end |
View heroku-pg-backup.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -o latest.dump `heroku pgbackups:url` | |
rake db:drop db:create db:migrate | |
pg_restore --verbose --clean --no-acl --no-owner -h localhost -U root -d DATABASE_development latest.dump | |
rm latest.dump |
View controller_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "spec_helper" | |
describe ExampleController do | |
context "GET #index" do | |
let(:resources) { FactoryGirl.create_list(:resource) } | |
before do | |
get :index | |
end |
NewerOlder