start new:
tmux
start new with session name:
tmux new -s myname
require 'google_drive' | |
client = Google::APIClient.new(application_name: 'Google Drive Ruby test', application_version: '0.0.1') | |
key = Google::APIClient::KeyUtils.load_from_pkcs12( | |
'path to your p12 key file (all the path with file name)', | |
'your secret here given at download file it seems to be always the same: notasecret') | |
asserter = Google::APIClient::JWTAsserter.new( | |
'service account - email address - here', | |
['https://www.googleapis.com/auth/drive'], |
1. | |
LOGIN_PAGE=http://localhost/users/sign_in | |
curl --cookie-jar cookie_file $LOGIN_PAGE | grep csrf-token | |
2. | |
<meta content="csrf-token" name="csrf-token" /> | |
#put in lib/tasks/fixtures.rake | |
namespace :db do | |
namespace :fixtures do | |
desc 'Create YAML test fixtures from data in an existing database. | |
Defaults to development database. Set RAILS_ENV to override.' | |
task :dump => :environment do | |
sql = "SELECT * FROM %s" | |
skip_tables = ["schema_migrations"] | |
ActiveRecord::Base.establish_connection(:development) | |
(ActiveRecord::Base.connection.tables - skip_tables).each do |table_name| |
function query() { | |
var | |
// HN is done with very unsemantic classes. | |
job_list = Array.prototype.slice.call(document.querySelectorAll('.c5a,.cae,.c00,.c9c,.cdd,.c73,.c88')), | |
query_list = Array.prototype.slice.call(arguments), | |
shown = 0, total = job_list.length; | |
// Traverses up the dom stack trying to find a match of a specific class | |
function up_to(node, klass) { | |
if (node.classList.contains(klass)) { |
Symbolize = (l = ->(h) { h.inject({}) { |m, (k,v)| m[(String === k ? k.to_sym : k)] = (Hash === v ? l.(v) : v); m }}) | |
# Example: | |
hash = { 'task' => { 'description' => 'Ab@ @example @cd', 'target' => { 'label' => 'cd' } } } | |
Symbolize.(hash) | |
# => { :task => { :description => "Ab@ @example @cd", :target => { :label => "cd" } } } |
doctype html | |
html | |
head | |
link rel="stylesheet" href=asset("application.css") | |
script rel="javascript" type="text/javascript" src=asset("ng_application.js") | |
body | |
== yield |
flat = (l = ->(x) { x.flat_map {|e| Array === e ? l.(e) : e } }) | |
flat.([1, 2, 3, [4, 5, [6], [ ] ] ]) | |
#==> [1,2,3,4,5,6] |