Skip to content

Instantly share code, notes, and snippets.

@anbublacky
anbublacky / gist:a6e66217b2fcdeb52fe580864beecf7f
Last active April 18, 2017 07:43
Uninitialized constant.
# app/api/proj/api/v2/entities/committee_base.rb
module PROJ::API::V2::Entities
class CommitteeBase < Grape::Entity;
expose :id
end
class CommitteeOffice < CommitteeBase;
expose :name
end
end
@anbublacky
anbublacky / gist:f4605d14891bf036c65e
Created July 21, 2015 11:56
youtube_banner_open browser error
LAUNCHY_DEBUG: URI parsing pass 1 : https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=259660604872-kh04mirn4j38hbo3fpfrhi9cuvcc6b03.apps.googleusercontent.com&redirect_uri=http://localhost:9292/&response_type=code&scope=https://www.googleapis.com/auth/youtube -> {:scheme=>"https", :user=>nil, :password=>nil, :host=>"accounts.google.com", :port=>nil, :path=>"/o/oauth2/auth", :query=>"access_type=offline&client_id=259660604872-kh04mirn4j38hbo3fpfrhi9cuvcc6b03.apps.googleusercontent.com&redirect_uri=http://localhost:9292/&response_type=code&scope=https://www.googleapis.com/auth/youtube", :fragment=>nil}
LAUNCHY_DEBUG: Checking if class Launchy::Application::Browser is the one for handles?(https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=259660604872-kh04mirn4j38hbo3fpfrhi9cuvcc6b03.apps.googleusercontent.com&redirect_uri=http://localhost:9292/&response_type=code&scope=https://www.googleapis.com/auth/youtube)}
LAUNCHY_DEBUG: Checking if class Launchy::Detect::HostOsFam
@anbublacky
anbublacky / set youtube channer banner
Created July 1, 2015 03:55
google api v3, set youtube channer banner, using ruby
#!/usr/bin/ruby
require 'rubygems'
gem 'google-api-client', '>0.7'
require 'google/api_client'
require 'google/api_client/client_secrets'
require 'google/api_client/auth/file_storage'
require 'google/api_client/auth/installed_app'
# This OAuth 2.0 access scope allows for read-only access to the authenticated
@anbublacky
anbublacky / youtube channel upload image
Created June 30, 2015 12:03
youtube channel upload image
#!/usr/bin/ruby
require 'rubygems'
gem 'google-api-client', '>0.7'
require 'google/api_client'
require 'google/api_client/client_secrets'
require 'google/api_client/auth/file_storage'
require 'google/api_client/auth/installed_app'
# This OAuth 2.0 access scope allows for read-only access to the authenticated
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery.min.js"></script>
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script src="http://code.jquery.com/jquery.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/2.0.0/handlebars.js"></script>
<script src="http://builds.emberjs.com/ember-latest.js"></script>
<meta charset="utf-8">
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery.min.js"></script>
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script src="http://code.jquery.com/jquery.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/2.0.0/handlebars.js"></script>
<script src="http://builds.emberjs.com/ember-latest.js"></script>
<meta charset="utf-8">
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery.min.js"></script>
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script src="http://code.jquery.com/jquery.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0/handlebars.js"></script>
<script src="http://builds.emberjs.com/ember-latest.js"></script>
<meta charset="utf-8">
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0/handlebars.js"></script>
<script src="http://builds.emberjs.com/ember-latest.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
class ErrorsController < ApplicationController
def not_found
render :status => 404, :formats => [:html]
end
def server_error
render :status => 500, :formats => [:html]
end
end
@anbublacky
anbublacky / gist:7794179
Last active December 30, 2015 07:09
style code
task :import_car_style => [:environment] do
client = Savon.new('https://services.chromedata.com/AutomotiveConfigCompareService/AutomotiveConfigCompareService3?WSDL')
service = "AutomotiveConfigCompareService3"
port = "AutomotiveConfigCompareService3Port"
getstyle = "getStyles"
style = client.operation(service, port, getstyle)
order_availability = ["Fleet", "Retail"]
order_availability.each do |availability|
ModelDefinition.all.each do |f|
style.body = {:StylesRequest=>{:accountInfo=>{:accountNumber=>"xxx", :accountSecret=>"xxx", :locale=>{:country$