• 公司环境相当的 nice!!!

  • 还招人么?

  • 好啊,我准备准备简历

  • 确实,看来其不错!!!

  • 已下单,坐等收货。

  • #10 楼 @easonlovewan 我后来,也接受了,这个 id 好处在于,简单好记,朗朗上口。

  • #7 楼 @0x005a

    1. 可执行文件的目录,如果是 exe,不是还要创建一个新的目录吗,我觉得,我上面的那个比较的简单。
    2. allowed_push_host 的我改一下。
    3. 版本依赖,我也加一下

    谢谢。此外,我写这个,也就是简单的介绍的一下。你说的官方的 guides,我加一下。

  • #6 楼 @dsh0416 厉害厉害

  • #3 楼 @gyorou 所谓,取个贱名好养活

  • #1 楼 @gyorou 真是的关注点特别啊。是的,真实姓名啊。

  • #4 楼 @kayakjiang 外国人付费意识比较强的说。

  • 我也遇到这个问题,没有你研究这么深。只是发现,6.9.x 之间的 ImageMagick 相差一个小版本。一个可以生成 图片,一个不可以。然后,就在那个不可以的 server 上,安装 remi 库,强制将 imagemagick 升级到 7.x。问题就解决了。至今不知为何。

  • 😅

  • 已买

  • #5 楼 @ericguo 我今天在 rails 4 中试了一下,force_encoding("ASCII-8BIT") 好想不是必须的。

  • #15 楼 @yakjuly

    ActiveSupport 的 json 解析挺慢的:

    Here's what parsing a 2.43MB JSON file off the filesystem 20 times looks like: Memory Usage Average

    Yajl::Parser#parse: 32MB JSON.parse: 54MB ActiveSupport::JSON.decode: 63MB

    Peak

    Yajl::Parser#parse: 32MB JSON.parse: 57MB ActiveSupport::JSON.decode: 67MB

    Parse Time

    Yajl::Parser#parse: 4.54s JSON.parse: 5.47s ActiveSupport::JSON.decode: 64.42s

    Encode Time

    Yajl::Encoder#encode: 3.59s JSON#to_json: 6.2s ActiveSupport::JSON.encode: 45.58s

  • #10 楼 @nevermore328 确实是个办法,谢谢了。

  • #8 楼 @u1440247613 解析报错啊,不然也不会 这么纠结:

    JSON.parse a123
    JSON::ParserError: 757: unexpected token at '{"attributes"=>[{"spec"=>0, "visible"=>true, "customizedName"=>false, "customizedPic"=>false, "keyAttribute"=>false, "sku"=>false, "id"=>100007782, "values"=>[{"id"=>124, "names"=>{"zh"=>"塑料", "en"=>"Plastic"}, "attributes"=>[{"spec"=>0, "visible"=>true, "customizedName"=>false, "customizedPic"=>false, "keyAttribute"=>false, "sku"=>false, "id"=>100007784, "values"=>[{"id"=>439, "names"=>{"zh"=>"PVC", "en"=>"PVC"}, "attributes"=>[]}, {"id"=>445, "names"=>{"zh"=>"PET", "en"=>"PET"}, "attributes"=>[]}, {"id"=>352537, "names"=>{"zh"=>"HDPE", "en"=>"HDPE"}, "attributes"=>[]}, {"id"=>501, "names"=>{"zh"=>"PC", "en"=>"PC"}, "attributes"=>[]}, {"id"=>438, "names"=>{"zh"=>"PP", "en"=>"PP"}, "attributes"=>[]}, {"id"=>437, "names"=>{"zh"=>"PE", "en"=>"PE"}, "attributes"=>[]}, {"id"=>4, "names"=>{"zh"=>"其它", "en"=>"Other"}, "attributes"=>[]}], "names"=>{"zh"=>"塑料类别", "en"=>"Plastic Type"}, "inputType"=>"STRING", "required"=>false, "attributeShowTypeValue"=>"list_box"}]}, {"id"=>346, "names"=>{"zh"=>"玻璃", "en"=>"Glass"}, "attributes"=>[]}, {"id"=>747, "names"=>{"zh"=>"陶瓷", "en"=>"Ceramic"}, "attributes"=>[]}, {"id"=>365507, "names"=>{"zh"=>"粘土", "en"=>"Clay"}, "attributes"=>[]}, {"id"=>2455, "names"=>{"zh"=>"铝合金", "en"=>"Aluminium Alloy"}, "attributes"=>[]}, {"id"=>206, "names"=>{"zh"=>"不锈钢", "en"=>"Stainless Steel"}, "attributes"=>[]}, {"id"=>350382, "names"=>{"zh"=>"树脂", "en"=>"Acrylic"}, "attributes"=>[]}, {"id"=>398, "names"=>{"zh"=>"金属", "en"=>"Metal"}, "attributes"=>[]}, {"id"=>4, "names"=>{"zh"=>"其它", "en"=>"Other"}, "attributes"=>[]}], "names"=>{"zh"=>"促销品材质", "en"=>"Material"}, "inputType"=>"STRING", "required"=>true, "attributeShowTypeValue"=>"list_box"}, {"spec"=>0, "visible"=>true, "customizedName"=>false, "customizedPic"=>false, "keyAttribute"=>false, "sku"=>false, "id"=>100007728, "values"=>[{"id"=>100018793, "names"=>{"zh"=>"右手握住时可见", "en"=>"Right Hand Readable"}, "attributes"=>[]}, {"id"=>100018794, "names"=>{"zh"=>"左手握住时可见", "en"=>"Left Hand Readable"}, "attributes"=>[]}, {"id"=>100018795, "names"=>{"zh"=>"双手握住均可见", "en"=>"Both Hand Readable"}, "attributes"=>[]}, {"id"=>100018796, "names"=>{"zh"=>"杯底", "en"=>"Bottom Surface"}, "attributes"=>[]}, {"id"=>4, "names"=>{"zh"=>"其它", "en"=>"Other"}, "attributes"=>[]}], "names"=>{"zh"=>"印制区域", "en"=>"Imprint Place"}, "inputType"=>"STRING", "required"=>true, "attributeShowTypeValue"=>"check_box"}, {"spec"=>0, "visible"=>true, "customizedName"=>false, "customizedPic"=>false, "keyAttribute"=>false, "sku"=>false, "id"=>100007781, "values"=>[{"id"=>100018897, "names"=>{"zh"=>"常规产品", "en"=>"Normal Product"}, "attributes"=>[]}, {"id"=>100018898, "names"=>{"zh"=>"新奇特产品", "en"=>"Novetly Product"}, "attributes"=>[{"spec"=>0, "visible"=>true, "customizedName"=>false, "customizedPic"=>false, "keyAttribute"=>false, "sku"=>false, "id"=>100007783, "values"=>[{"id"=>397, "names"=>{"zh"=>"LED", "en"=>"LED"}, "attributes"=>[]}, {"id"=>1648, "names"=>{"zh"=>"变色", "en"=>"Color Changing"}, "attributes"=>[]}, {"id"=>100018788, "names"=>{"zh"=>"夜光", "en"=>"Glow in the Dark"}, "attributes"=>[]}, {"id"=>100018894, "names"=>{"zh"=>"可写粉笔字", "en"=>"Chalk Writen"}, "attributes"=>[]}, {"id"=>100018805, "names"=>{"zh"=>"发声", "en"=>"Music"}, "attributes"=>[]}, {"id"=>100018806, "names"=>{"zh"=>"带USB接口的", "en"=>"USB-Enabled"}, "attributes"=>[]}, {"id"=>4, "names"=>{"zh"=>"其它", "en"=>"Other"}, "attributes"=>[]}], "names"=>{"zh"=>"新奇特样式", "en"=>"Novelty"}, "inputType"=>"STRING", "required"=>false, "attributeShowTypeValue"=>"check_box"}, {"spec"=>0, "visible"=>true, "customizedName"=>false, "customizedPic"=>false, "keyAttribute"=>false, "sku"=>false, "id"=>100007758, "values"=>[{"id"=>100018852, "names"=>{"zh"=>"新设计", "en"=>"New Design"}, "attributes"=>[]}, {"id"=>100018853, "names"=>{"zh"=>"新功能", "en"=>"New Function"}, "attributes"=>[]}, {"id"=>100018854, "names"=>{"zh"=>"新材质", "en"=>"New Material"}, "attributes"=>[]}, {"id"=>100018855, "names"=>{"zh"=>"新造型", "en"=>"New Style"}, "attributes"=>[]}, {"id"=>100018856, "names"=>{"zh"=>"新工艺", "en"=>"New Technology"}, "attributes"=>[]}, {"id"=>100018857, "names"=>{"zh"=>"新专利", "en"=>"New Patent"}, "attributes"=>[]}], "names"=>{"zh"=>"新奇特产品类型", "en"=>"Special Features"}, "inputType"=>"STRING", "required"=>false, "attributeShowTypeValue"=>"check_box"}]}], "names"=>{"zh"=>"促销品类别", "en"=>"Kind"}, "inputType"=>"STRING", "required"=>false, "attributeShowTypeValue"=>"list_box"}, {"spec"=>0, "visible"=>true, "customizedName"=>false, "customizedPic"=>false, "keyAttribute"=>false, "sku"=>false, "id"=>100007785, "values"=>[{"id"=>100018808, "names"=>{"zh"=>"双层杯壁", "en"=>"Double Wall"}, "attributes"=>[]}, {"id"=>100018809, "names"=>{"zh"=>"单层杯壁", "en"=>"Single Wall"}, "attributes"=>[]}, {"id"=>100018810, "names"=>{"zh"=>"带杯柄", "en"=>"With Handle"}, "attributes"=>[]}, {"id"=>100018811, "names"=>{"zh"=>"无杯柄", "en"=>"Without Handle"}, "attributes"=>[]}, {"id"=>4, "names"=>{"zh"=>"其它", "en"=>"Other"}, "attributes"=>[]}], "names"=>{"zh"=>"产品样式", "en"=>"Style"}, "inputType"=>"STRING", "required"=>false, "attributeShowTypeValue"=>"check_box"}, {"spec"=>0, "visible"=>true, "customizedName"=>false, "customizedPic"=>false, "keyAttribute"=>false, "sku"=>false, "id"=>100007739, "names"=>{"zh"=>"产品颜色", "en"=>"Product Color"}, "inputType"=>"STRING", "required"=>false, "attributeShowTypeValue"=>"input"}, {"spec"=>0, "visible"=>true, "customizedName"=>false, "customizedPic"=>false, "keyAttribute"=>false, "sku"=>false, "id"=>100007787, "names"=>{"zh"=>"产品容量", "en"=>"Volume"}, "inputType"=>"STRING", "required"=>false, "attributeShowTypeValue"=>"input"}, {"spec"=>0, "visible"=>true, "customizedName"=>false, "customizedPic"=>false, "keyAttribute"=>false, "sku"=>false, "id"=>100007763, "names"=>{"zh"=>"杯口直径", "en"=>"Diameter"}, "inputType"=>"STRING", "required"=>false, "attributeShowTypeValue"=>"input"}], "success"=>true}'
    from /Users/xiajian/.rvm/gems/ruby-2.1.5@aliexpress/gems/json-1.8.3/lib/json/common.rb:155:in `parse'
    
  • #7 楼 @yakjuly 存 Redis 中的,默认调用的to_s转化的。

  • 想到一个方法:Marshal.dump 对象,然后存放到 redis 中,然后,读取时是用 Marshal.load 将对象恢复出来。

  • #1 楼 @zhengpd 你的意思是,to_json 之后再存,然后,使用 JSON.parse 解析。我试试。

  • #1 楼 @zhengpd to_json 之后,又转义了一层。

    => "\"{\\\"aeopPostCategoryList\\\"=>[{\\\"id\\\"=>3, \\\"level\\\"=>0, \\\"names\\\"=>{\\\"zh\\\"=>\\\"服装/服饰配件\\\", \\\"pt\\\"=>\\\"Vestuário e acessórios\\\", \\\"fr\\\"=>\\\"Vêtements & accessoires\\\", \\\"en\\\"=>\\\"Apparel & Accessories\\\", \\\"ru\\\"=>\\\"Одежда и аксессуары\\\", \\\"es\\\"=>\\\"Ropa y accesorios\\\", \\\"in\\\"=>\\\"Pakaian & aksesoris\\\"}, \\\"isleaf\\\"=>false}, {\\\"id\\\"=>34, \\\"level\\\"=>0, \\\"names\\\"=>{\\\"zh\\\"=>\\\"汽车、摩托车\\\", \\\"pt\\\"=>\\\"Automóveis e motos\\\", \\\"fr\\\"=>\\\"Automobiles et motos\\\", \\\"en\\\"=>\\\"Automobiles & Motorcycles\\\", \\\"ru\\\"=>\\\"Автомобили и мотоциклы\\\", \\\"es\\\"=>\\\"Automóviles y motocicletas\\\", \\\"in\\\"=>\\\"Mobil & sepeda motor\\\"}, \\\"isleaf\\\"=>false}, {\\\"id\\\"=>66, \\\"level\\\"=>0, \\\"names\\\"=>{\\\"zh\\\"=>\\\"美容健康\\\", \\\"pt\\\"=>\\\"Beleza e saúde\\\", \\\"fr\\\"=>\\\"Beauté & santé\\\", \\\"en\\\"=>\\\"Beauty & Health\\\", \\\"ru\\\"=>\\\"Красоты и здоровья\\\", \\\"es\\\"=>\\\"Belleza y salud\\\", \\\"in\\\"=>\\\"Kecantikan & kesehatan\\\"}, \\\"isleaf\\\"=>false}, {\\\"id\\\"=>200004360, \\\"level\\\"=>0, \\\"names\\\"=>{\\\"zh\\\"=>\\\"俄罗斯当地图书销售\\\", \\\"pt\\\"=>\\\"Livros locais para russo\\\", \\\"fr\\\"=>\\\"Livres pour locale russe\\\", \\\"en\\\"=>\\\"Books for Local Russian\\\", \\\"ru\\\"=>\\\"Книги для местных русский\\\", \\\"es\\\"=>\\\"Libros para Local ruso\\\", \\\"in\\\"=>\\\"Buku untuk lokal Russian\\\"}, \\\"isleaf\\\"=>false}, {\\\"id\\\"=>7, \\\"level\\\"=>0, \\\"names\\\"=>{\\\"zh\\\"=>\\\"电脑和办公\\\", \\\"pt\\\"=>\\\"Computador e escritório\\\", \\\"fr\\\"=>\\\"Ordinateur et bureau\\\", \\\"en\\\"=>\\\"Computer & Office\\\", \\\"ru\\\"=>\\\"Компьютер и офиса\\\", \\\"es\\\"=>\\\"Ordenador y oficina\\\", \\\"in\\\"=>\\\"Komputer & kantor\\\"}, \\\"isleaf\\\"=>false}, {\\\"id\\\"=>13, \\\"level\\\"=>0, \\\"names\\\"=>{\\\"zh\\\"=>\\\"建筑\\\", \\\"pt\\\"=>\\\"Construção & Real Estate\\\", \\\"fr\\\"=>\\\"Immobilier & Construction\\\", \\\"en\\\"=>\\\"Construction & Real Estate\\\", \\\"ru\\\"=>\\\"Строительство и недвижимость\\\", \\\"es\\\"=>\\\"Construcción y bienes raíces\\\", \\\"in\\\"=>\\\"Konstruksi & Real Estate\\\"}, \\\"isleaf\\\"=>false}, {\\\"id\\\"=>44, \\\"level\\\"=>0, \\\"names\\\"=>{\\\"zh\\\"=>\\\"消费电子\\\", \\\"pt\\\"=>\\\"Eletrônicos de consumo\\\", \\\"fr\\\"=>\\\"Consumer Electronics\\\", \\\"en\\\"=>\\\"Consumer Electronics\\\", \\\"ru\\\"=>\\\"Бытовая электроника\\\", \\\"es\\\"=>\\\"Electrónica de consumo\\\", \\\"in\\\"=>\\\"Elektronik konsumen\\\"}, \\\"isleaf\\\"=>false}, {\\\"id\\\"=>100008578, \\\"level\\\"=>0, \\\"names\\\"=>{\\\"zh\\\"=>\\\"定制化产品\\\", \\\"pt\\\"=>\\\"Produtos personalizados\\\", \\\"fr\\\"=>\\\"Produits personnalisés\\\", \\\"en\\\"=>\\\"Customized Products\\\", \\\"ru\\\"=>\\\"Настроенные продукты\\\", \\\"es\\\"=>\\\"Productos personalizados\\\", \\\"in\\\"=>\\\"Produk disesuaikan\\\"}, \\\"isleaf\\\"=>false}, {\\\"id\\\"=>5, \\\"level\\\"=>0, \\\"names\\\"=>{\\\"zh\\\"=>\\\"电气设备和产品\\\", \\\"pt\\\"=>\\\"Equipamentos eléctricos e suprimentos\\\", \\\"fr\\\"=>\\\"Electrical Equipment & Supplies\\\", \\\"en\\\"=>\\\"Electrical Equipment & Supplies\\\", \\\"ru\\\"=>\\\"Электротехника и дополнения\\\", \\\"es\\\"=>\\\"Equipo eléctrico y suministros\\\", \\\"in\\\"=>\\\"Peralatan listrik & perlengkapan\\\"}, \\\"isleaf\\\"=>false}, {\\\"id\\\"=>502, \\\"level\\\"=>0, \\\"names\\\"=>{\\\"zh\\\"=>\\\"电子元器件\\\", \\\"pt\\\"=>\\\"Componentes e sistemas electrónicas\\\", \\\"fr\\\"=>\\\"Composants électroniques et les\\\", \\\"en\\\"=>\\\"Electronic Components & Supplies\\\", \\\"ru\\\"=>\\\"Электронных компонентов и расходных материалов\\\", \\\"es\\\"=>\\\"Componentes y sistemas electrónicos\\\", \\\"in\\\"=>\\\"Komponen elektronik & perlengkapan\\\"}, \\\"isleaf\\\"=>false}, {\\\"id\\\"=>2, \\\"level\\\"=>0, \\\"names\\\"=>{\\\"zh\\\"=>\\\"食品\\\", \\\"pt\\\"=>\\\"Alimentos\\\", \\\"fr\\\"=>\\\"Alimentaire\\\", \\\"en\\\"=>\\\"Food\\\", \\\"ru\\\"=>\\\"Питание\\\", \\\"es\\\"=>\\\"Alimentos\\\", \\\"in\\\"=>\\\"Makanan\\\"}, \\\"isleaf\\\"=>false}, {\\\"id\\\"=>1503, \\\"level\\\"=>0, \\\"names\\\"=>{\\\"zh\\\"=>\\\"家具和室内装饰品\\\", \\\"pt\\\"=>\\\"Móveis\\\", \\\"fr\\\"=>\\\"Meubles\\\", \\\"en\\\"=>\\\"Furniture\\\", \\\"ru\\\"=>\\\"Мебель\\\", \\\"es\\\"=>\\\"Muebles\\\", \\\"in\\\"=>\\\"Furniture\\\"}, \\\"isleaf\\\"=>false}, {\\\"id\\\"=>200003655, \\\"level\\\"=>0, \\\"names\\\"=>{\\\"zh\\\"=>\\\"假发及周边\\\", \\\"pt\\\"=>\\\"Cabelo e acessórios\\\", \\\"fr\\\"=>\\\"Cheveux et accessoires\\\", \\\"en\\\"=>\\\"Hair & Accessories\\\", \\\"ru\\\"=>\\\"Волосы и аксессуары\\\", \\\"es\\\"=>\\\"Pelo y accesorios\\\", \\\"in\\\"=>\\\"Rambut & aksesoris\\\"}, \\\"isleaf\\\"=>false}, {\\\"id\\\"=>42, \\\"level\\\"=>0, \\\"names\\\"=>{\\\"zh\\\"=>\\\"五金\\\", \\\"pt\\\"=>\\\"Hardware\\\", \\\"fr\\\"=>\\\"Matériel\\\", \\\"en\\\"=>\\\"Hardware\\\", \\\"ru\\\"=>\\\"Оборудование\\\", \\\"es\\\"=>\\\"Hardware\\\", \\\"in\\\"=>\\\"Hardware\\\"}, \\\"isleaf\\\"=>false}, {\\\"id\\\"=>15, \\\"level\\\"=>0, \\\"names\\\"=>{\\\"zh\\\"=>\\\"家居用品\\\", \\\"pt\\\"=>\\\"Casa e jardim\\\", \\\"fr\\\"=>\\\"Maison & jardin\\\", \\\"en\\\"=>\\\"Home & Garden\\\", \\\"ru\\\"=>\\\"Дома и сада\\\", \\\"es\\\"=>\\\"Hogar y jardín\\\", \\\"in\\\"=>\\\"Home & Garden\\\"}, \\\"isleaf\\\"=>false}, {\\\"id\\\"=>6, \\\"level\\\"=>0, \\\"names\\\"=>{\\\"zh\\\"=>\\\"家用电器\\\", \\\"pt\\\"=>\\\"Eletrodomésticos\\\", \\\"fr\\\"=>\\\"Appareils ménagers\\\", \\\"en\\\"=>\\\"Home Appliances\\\", \\\"ru\\\"=>\\\"Бытовая техника\\\", \\\"es\\\"=>\\\"Electrodomésticos\\\", \\\"in\\\"=>\\\"Peralatan rumah\\\"}, \\\"isleaf\\\"=>false}, {\\\"id\\\"=>200001996, \\\"level\\\"=>0, \\\"names\\\"=>{\\\"zh\\\"=>\\\"工业/原材料/商业用品\\\", \\\"pt\\\"=>\\\"Indústria e negócios\\\", \\\"fr\\\"=>\\\"Industrie et d'affaires\\\", \\\"en\\\"=>\\\"Industry & Business\\\", \\\"ru\\\"=>\\\"Промышленности и бизнес\\\", \\\"es\\\"=>\\\"Industria y negocio\\\", \\\"in\\\"=>\\\"Industri & bisnis\\\"}, \\\"isleaf\\\"=>false}, {\\\"id\\\"=>36, \\\"level\\\"=>0, \\\"names\\\"=>{\\\"zh\\\"=>\\\"珠宝手表\\\", \\\"pt\\\"=>\\\"Jóias & relógios\\\", \\\"fr\\\"=>\\\"Bijoux et montre\\\", \\\"en\\\"=>\\\"Jewelry & Watch\\\", \\\"ru\\\"=>\\\"Ювелирные изделия и часы\\\", \\\"es\\\"=>\\\"Joyería y reloj\\\", \\\"in\\\"=>\\\"Perhiasan & menonton\\\"}, \\\"isleaf\\\"=>false}, {\\\"id\\\"=>39, \\\"level\\\"=>0, \\\"names\\\"=>{\\\"zh\\\"=>\\\"照明灯饰\\\", \\\"pt\\\"=>\\\"Luzes\\\", \\\"fr\\\"=>\\\"Lumières et éclairage\\\", \\\"en\\\"=>\\\"Lights & Lighting\\\", \\\"ru\\\"=>\\\"Огни и освещение\\\", \\\"es\\\"=>\\\"Luces e iluminación\\\", \\\"in\\\"=>\\\"Lampu & pencahayaan\\\"}, \\\"isleaf\\\"=>false}, {\\\"id\\\"=>1524, \\\"level\\\"=>0, \\\"names\\\"=>{\\\"zh\\\"=>\\\"箱包\\\", \\\"pt\\\"=>\\\"Bagagem & Bags\\\", \\\"fr\\\"=>\\\"Bagages et sacs\\\", \\\"en\\\"=>\\\"Luggage & Bags\\\", \\\"ru\\\"=>\\\"Багажа и сумки\\\", \\\"es\\\"=>\\\"Equipaje y bolsas\\\", \\\"in\\\"=>\\\"Bagasi & tas\\\"}, \\\"isleaf\\\"=>false}, {\\\"id\\\"=>1501, \\\"level\\\"=>0, \\\"names\\\"=>{\\\"zh\\\"=>\\\"孕婴童\\\", \\\"pt\\\"=>\\\"Mãe & Kids\\\", \\\"fr\\\"=>\\\"Mère et enfants\\\", \\\"en\\\"=>\\\"Mother & Kids\\\", \\\"ru\\\"=>\\\"Мать и дети\\\", \\\"es\\\"=>\\\"La madre y de los niños\\\", \\\"in\\\"=>\\\"Ibu & anak-anak\\\"}, \\\"isleaf\\\"=>false}, {\\\"id\\\"=>21, \\\"level\\\"=>0, \\\"names\\\"=>{\\\"zh\\\"=>\\\"办公文教用品\\\", \\\"pt\\\"=>\\\"Escritório e material escolar\\\", \\\"fr\\\"=>\\\"Bureau et fournitures scolaires\\\", \\\"en\\\"=>\\\"Office & School Supplies\\\", \\\"ru\\\"=>\\\"Офисные и школьные принадлежности\\\", \\\"es\\\"=>\\\"Office & School Supplies\\\", \\\"in\\\"=>\\\"Office & School Supplies\\\"}, \\\"isleaf\\\"=>false}, {\\\"id\\\"=>509, \\\"level\\\"=>0, \\\"names\\\"=>{\\\"zh\\\"=>\\\"电话和通讯\\\", \\\"pt\\\"=>\\\"Telefones e telecomunicações\\\", \\\"fr\\\"=>\\\"Téléphones et télécommunications\\\", \\\"en\\\"=>\\\"Phones & Telecommunications\\\", \\\"ru\\\"=>\\\"Телефоны и телекоммуникации\\\", \\\"es\\\"=>\\\"Teléfonos y telecomunicaciones\\\", \\\"in\\\"=>\\\"Ponsel & telekomunikasi\\\"}, \\\"isleaf\\\"=>false}, {\\\"id\\\"=>30, \\\"level\\\"=>0, \\\"names\\\"=>{\\\"zh\\\"=>\\\"安全防护\\\", \\\"pt\\\"=>\\\"Segurança e proteção\\\", \\\"fr\\\"=>\\\"Sécurité et Protection\\\", \\\"en\\\"=>\\\"Security & Protection\\\", \\\"ru\\\"=>\\\"Безопасности и защиты\\\", \\\"es\\\"=>\\\"Seguridad y protección\\\", \\\"in\\\"=>\\\"Keamanan & perlindungan\\\"}, \\\"isleaf\\\"=>false}, {\\\"id\\\"=>322, \\\"level\\\"=>0, \\\"names\\\"=>{\\\"zh\\\"=>\\\"鞋子\\\", \\\"pt\\\"=>\\\"Sapatos\\\", \\\"fr\\\"=>\\\"Chaussures\\\", \\\"en\\\"=>\\\"Shoes\\\", \\\"ru\\\"=>\\\"Обувь\\\", \\\"es\\\"=>\\\"Zapatos\\\", \\\"in\\\"=>\\\"Sepatu\\\"}, \\\"isleaf\\\"=>false}, {\\\"id\\\"=>200001075, \\\"level\\\"=>0, \\\"names\\\"=>{\\\"zh\\\"=>\\\"其他特殊类\\\", \\\"pt\\\"=>\\\"Categoria especial\\\", \\\"fr\\\"=>\\\"Catégorie spéciale\\\", \\\"en\\\"=>\\\"Special Category\\\", \\\"ru\\\"=>\\\"Специальная категория\\\", \\\"es\\\"=>\\\"Especial categoría\\\", \\\"in\\\"=>\\\"Kategori khusus\\\"}, \\\"isleaf\\\"=>false}, {\\\"id\\\"=>18, \\\"level\\\"=>0, \\\"names\\\"=>{\\\"zh\\\"=>\\\"运动及娱乐\\\", \\\"pt\\\"=>\\\"Esporte e lazer\\\", \\\"fr\\\"=>\\\"Sports & Entertainment\\\", \\\"en\\\"=>\\\"Sports & Entertainment\\\", \\\"ru\\\"=>\\\"Спорт и развлечения\\\", \\\"es\\\"=>\\\"Deportes y entretenimiento\\\", \\\"in\\\"=>\\\"Olahraga & hiburan\\\"}, \\\"isleaf\\\"=>false}, {\\\"id\\\"=>1420, \\\"level\\\"=>0, \\\"names\\\"=>{\\\"zh\\\"=>\\\"工具\\\", \\\"pt\\\"=>\\\"Ferramentas\\\", \\\"fr\\\"=>\\\"Outils\\\", \\\"en\\\"=>\\\"Tools\\\", \\\"ru\\\"=>\\\"Инструменты\\\", \\\"es\\\"=>\\\"Herramientas\\\", \\\"in\\\"=>\\\"Alat\\\"}, \\\"isleaf\\\"=>false}, {\\\"id\\\"=>26, \\\"level\\\"=>0, \\\"names\\\"=>{\\\"zh\\\"=>\\\"玩具\\\", \\\"pt\\\"=>\\\"Brinquedos e Hobbies\\\", \\\"fr\\\"=>\\\"Jouets & loisirs\\\", \\\"en\\\"=>\\\"Toys & Hobbies\\\", \\\"ru\\\"=>\\\"Игрушки и хобби\\\", \\\"es\\\"=>\\\"Juguetes y pasatiempos\\\", \\\"in\\\"=>\\\"Mainan & hobi\\\"}, \\\"isleaf\\\"=>false}, {\\\"id\\\"=>200003498, \\\"level\\\"=>0, \\\"names\\\"=>{\\\"zh\\\"=>\\\"旅游及代金券\\\", \\\"pt\\\"=>\\\"Viagens e serviços de cupom\\\", \\\"fr\\\"=>\\\"Voyage promo Services\\\", \\\"en\\\"=>\\\"Travel and Coupon Services\\\", \\\"ru\\\"=>\\\"Путешествия и купон услуги\\\", \\\"es\\\"=>\\\"Viajes y cupón servicios\\\", \\\"in\\\"=>\\\"Perjalanan dan jasa kupon\\\"}, \\\"isleaf\\\"=>false}, {\\\"id\\\"=>320, \\\"level\\\"=>0, \\\"names\\\"=>{\\\"zh\\\"=>\\\"婚礼及重要场合\\\", \\\"pt\\\"=>\\\"Casamentos e eventos\\\", \\\"fr\\\"=>\\\"Mariages et événements\\\", \\\"en\\\"=>\\\"Weddings & Events\\\", \\\"ru\\\"=>\\\"Свадьбы и события\\\", \\\"es\\\"=>\\\"Bodas y eventos\\\", \\\"in\\\"=>\\\"Pernikahan & acara\\\"}, \\\"isleaf\\\"=>false}], \\\"success\\\"=>true}\""
    
  • 是用的 gem 'rack-mini-profiler' # https://github.com/MiniProfiler/rack-mini-profiler 这个 gem 包。

  • 不知为何,我发现 match 总是匹配第一个就返回了,用 scan 将其全部查找出来:

    a = "<p>15021170067&nbsp;400-695-8541 &nbsp; &nbsp;15021170067 &nbsp; &nbsp; &nbsp;15021170067</p>\\r\\n\\r\\n<p>400-665-5632</p>\\r\\n\\r\\n<p>&nbsp;</p>\\r\\n\\r\\n<p>15021170067</p>\\r\\n\\r\\n<div id=\\\"xunlei_com_thunder_helper_plugin_d462f475-c18e-46be-bd10-327458d045bd\\\">&nbsp;</div>\\r\\n"
    b = []
    re = /\d{11}|\d+-\d+-\d+/
    a.scan(re) { |x| b << x}
    a.match re     
    => #<MatchData "15021170067">
    

    这样就可以了,请问如何开启 match 全部匹配的模式,默认好像职匹配第一个。我 ruby 的版本是 2.1.5,难道是新特性?

  • +1

  • 微信开放平台 Omniauth 探索 at 2015年05月25日

    #2 楼 @winnie 可以穿透内网的。

  • 微信开放平台 Omniauth 探索 at 2015年05月25日

    #1 楼 @zedde 我觉的 只是搭了个 ngrok 的 server,或者转发了一下请求而已,我就直接在.ngrok 配置中,写入了 tunnel.mobi 提供的配置就可以用了。

  • 微信开放平台 Omniauth 探索 at 2015年05月25日

    #21 楼 @ruby_sky 可以使用这个,http://www.tunnel.mobi/。在 $HOME/.ngrok 中添加:

    server_addr: "tunnel.mobi:44433"
    trust_host_root_certs: true
    

    就可以继续用了。

  • Redis-objects 介绍 at 2015年05月25日

    #3 楼 @rei 可能是我经验不足吧,不是特别明白线程安全相关的问题,也没遇到过这类问题。多线程这么麻烦,干脆直接用多进程得了。

  • Redis-objects 介绍 at 2015年05月25日

    #1 楼 @as181920 如果自己写连接语句的话,那可能就要自己负责处理线程安全之类的了。gem 包推荐使用连接池,这样,会安全一点吧。具体的,我也没试过。不过 Rails 4 不是内置了线程安全的吗?

    如上文:

    推荐使用[ConnectionPool](https://github.com/mperham/connection_pool),这样能够保证redis客户端不会污染现有的连接。但是,在多线程的环境中,需要确保正确的设置:timeout和:size。