This file contains hidden or 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
def listen(self): | |
httpd = simple_server.make_server('0.0.0.0', 8080, self.application) | |
httpd.serve_forever() | |
# from werkzeug.serving import run_simple | |
# run_simple('0.0.0.0', 8000, self.application, use_reloader=True) |
This file contains hidden or 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
CSV.open(filename, "w+", {:col_sep => ",", :row_sep => "\r\n"}) do |csv| | |
csv << ["bar", "test", "foo"] | |
csv << ["bar", "test", "foo"] | |
end |
This file contains hidden or 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
EntityDrupalWrapper Object | |
( | |
[id:protected] => 36241 | |
[bundle:protected] => commerce_order | |
[entityInfo:protected] => Array | |
( | |
[label] => Commerce Order | |
[controller class] => CommerceOrderEntityController | |
[locking mode] => pessimistic | |
[base table] => commerce_order |
This file contains hidden or 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
<?php | |
/* Field: Content: Title */ | |
$handler->display->display_options['fields']['title']['id'] = 'title'; | |
$handler->display->display_options['fields']['title']['table'] = 'node'; | |
$handler->display->display_options['fields']['title']['field'] = 'title'; | |
$handler->display->display_options['fields']['title']['label'] = ''; | |
$handler->display->display_options['fields']['title']['alter']['alter_text'] = TRUE; | |
$handler->display->display_options['fields']['title']['alter']['text'] = '<div class="text-overlay"> | |
<div class="clearfix"><h1>[title]</h1></div> | |
[field_banner_body] |
This file contains hidden or 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_stats = [ | |
{"brand_name"=>"AMY GEE", "product_type_name"=>"Ceinture", "gender_name"=>"F", "sales"=>1}, | |
{"brand_name"=>"AMY GEE", "product_type_name"=>"Ceinture", "gender_name"=>"F", "stock"=>10}, | |
{"brand_name"=>"ZLK", "product_type_name"=>"T-shirt", "gender_name"=>"M", "stock"=>0}, | |
{"brand_name"=>"ZLK", "product_type_name"=>"T-shirt", "gender_name"=>"M", "sales"=>0} | |
] | |
wanted_array = [ | |
{"brand_name"=>"AMY GEE", "product_type_name"=>"Ceinture", "gender_name"=>"F", "sales"=>1, "stock"=>10}, | |
{"brand_name"=>"ZLK", "product_type_name"=>"T-shirt", "gender_name"=>"M", "sales"=>0, "stock"=>0} |
This file contains hidden or 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
stock_start = [{"brand_name"=>"AMY GEE", "product_type_name"=>"Accessoires", "gender_name"=>"F", "stock_start"=>10}] | |
stock_end = [{"brand_name"=>"AMY GEE", "product_type_name"=>"Accessoires", "gender_name"=>"F", "stock_end"=>0}] | |
sales = [{"brand_name"=>"AMY GEE", "product_type_name"=>"Accessoires", "gender_name"=>"F", "sales"=>5}] | |
wanted_result = [{"brand_name"=>"AMY GEE", "product_type_name"=>"Accessoires", "gender_name"=>"F", "sales"=>5, "stock_end"=>0, "stock_start"=>10}] |
This file contains hidden or 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
module Spree | |
class Taxon < ActiveRecord::Base | |
include ::Spree::ProductFilters # for detailed defs of filters | |
def applicable_filters | |
fs = [] | |
fs << ProductFilters.price_filter if ProductFilters.respond_to?(:price_filter) | |
fs << ProductFilters.brand_filter if ProductFilters.respond_to?(:brand_filter) | |
fs | |
end |
This file contains hidden or 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
# User.birtdate = 29/03/1989 | |
# User in mysql = 28/03/1989 22:00:00 +2 UTC | |
# | |
User.where(["day(birthdate) = day(?) AND month(birtdate) = month(?)", Time.now.utc, Time.now.utc ]) |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> | |
<title>Virtual Tour generated by Panotour</title> | |
<meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/> | |
<meta name="apple-mobile-web-app-capable" content="yes"/> | |
<style type="text/css"> | |
@media only screen and (min-device-width: 800px) { html { overflow:hidden; } } | |
* { padding: 0; margin: 0; } |
This file contains hidden or 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
{ | |
:error_message=> "Code retour OK", | |
:liste_point_retrait => | |
[ | |
{ | |
:horaires_ouverture_dimanche => "00:00-00:00 00:00-00:00", | |
:poids_maxi => "20000", | |
:conges_partiel => false, | |
:horaires_ouverture_vendredi => "09:00-12:00 14:30-18:00", | |
:acces_personne_mobilite_reduite => false, |
NewerOlder