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
compressed_filestream = Zip::OutputStream.write_buffer(::StringIO.new(''), Zip::TraditionalEncrypter.new('password')) do |zos| | |
#First file | |
zos.put_next_entry "test1.csv" | |
csv = CSV.generate do |csv| | |
User.all.each do |user| | |
csv << [user.id, user.name] | |
end | |
csv << values | |
end | |
zos.print csv |
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
======= Prolbem ================================================================================================================= | |
I have installed : ruby-2.0.0,postgres-9.2 , now in rails app when I execute: | |
rake db:create , command I get: | |
PG::InvalidParameterValue: ERROR: new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII) | |
HINT: Use the same encoding as in the template database, or use template0 as template. | |
: CREATE DATABASE "my_db_name" ENCODING = 'unicode'....... | |
bin/rake:16:in `load' |
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
#!/usr/bin/env python3 | |
# Python screenshot tool (fullscreen/area selection) | |
# Special thanks to @tomk11, @frakman1, @aspotton and @lucguislain for the improvements | |
import sys | |
from PyQt5 import QtCore, QtGui | |
from PyQt5.QtGui import QPixmap, QScreen | |
from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QSizePolicy | |
from PyQt5.QtWidgets import QGroupBox, QSpinBox, QCheckBox, QGridLayout | |
from PyQt5.QtWidgets import QPushButton, QHBoxLayout, QVBoxLayout |
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
# config/initializers/omnicontacts.rb | |
Rails.application.middleware.use OmniContacts::Builder do | |
importer :live, 'client_id', 'client_secret', {redirect_path: "/invitations/live/contact_callback"} | |
end | |
class OmniContacts::Importer::Live < OmniContacts::Importer::Hotmail | |
def initialize *args | |
super *args |
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
#!/usr/bin/env ruby | |
require 'csv' | |
require 'json' | |
if ARGV.size != 2 | |
puts 'Usage: csv_to_json input_file.csv output_file.json' | |
puts 'This script uses the first line of the csv file as the keys for the JSON properties of the objects' | |
exit(1) | |
end |