Skip to content

Instantly share code, notes, and snippets.

View Loschcode's full-sized avatar
🌀
Probably coding

Laurent Schaffner Loschcode

🌀
Probably coding
View GitHub Profile
# before
<%= form.fields_for :desc_translations do |trans_field| %>
<div class="col-md-5">
<%= trans_field.text_area :de, :value => form.object.desc_translations[:de], :class => 'form-control', :required => true %>
<div class="help-block with-errors"></div>
</div>
<div class="col-md-5">
<%= trans_field.text_area :'zh-CN', :value => form.object.desc_translations[:'zh-CN'], :class => 'form-control', :required => true %>
<div class="help-block with-errors"></div>
</div>
defmodule FeedApi.Utils.Feeder do
@doc """
We try to get the tweets from the timeline of the user
It will fetch all the needed entry and return them into an array
"""
def feed! do
from_twitter!
end
defmodule FeedApi.Utils.Feeder do
@doc """
We try to get the tweets from the timeline of the user
It will fetch all the needed entry and return them into an array
"""
def feed!, do: from_twitter!
def from_twitter! do
FeedApi.Scrappers.Twitter.dispatch! |> fetch!
require 'cgi'
# Get notifications from Wirecard when a transaction has been done
class Api::Webhook::Wirecard::CustomersController < Api::ApplicationController
skip_before_filter :verify_authenticity_token
WIRECARD_CONFIG = Rails.application.config.wirecard
REQUEST_ID_TRIM = %w(-check-enrollment)
require 'cgi'
# Get notifications from Wirecard when a transaction has been done
class Api::Webhook::Wirecard::CustomersController < Api::ApplicationController
skip_before_filter :verify_authenticity_token
WIRECARD_CONFIG = Rails.application.config.wirecard
REQUEST_ID_TRIM = %w(-check-enrollment)
# webhook communication with Wirecard.
# any communication with Wirecard from server to server linked to the merchant / shopkeeper
# such as `wirecard_status` to activate their payment account is under this controller.
class Api::Webhook::Wirecard::MerchantsController < Api::ApplicationController
WIRECARD_CONFIG = Rails.application.config.wirecard
CREDENTIALS_PAYMENT_METHODS = {
:creditcard => [:ee_maid_cc, :ee_secret_cc],
:upop => [:ee_maid_cup, :ee_secret_cup],
:paypal => [:ee_maid_paypal, :ee_secret_paypal]
class Customer::Checkout::Callback::WirecardController < ApplicationController
authorize_resource :class => false
layout :default_layout
protect_from_forgery :except => [:success, :fail, :cancel, :processing]
def success
callback = checkout_callback.wirecard!
unless callback.success?
SlackDispatcher.new.message("[Exception] Error checkout callback #{callback.error}")
/**
* Charts Class
*/
var Charts = {
/**
* Initializer
*/
init: function() {
def perform
if requests[request]
requests[request].response
end
# if requests.map(&:keys).include? request
# # it's a match
# end
end
def subclasses(target)
class WechatBot
class Exchange < Base
class Qrcode < Base
def request
'二维码'
end
# this is not the best way at a performance level because it accepts #request and then cancel it via a false if the user is not referrer
# best is to control this from the #request itself and return nil. The result is the same tho.
# WE KEPT THIS AS A GOOD EXAMPLE