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
| class Data < ActiveRecord::Base | |
| belongs_to :user | |
| before_create :user_allowed_to_create? | |
| private | |
| def user_allowed_to_create? | |
| offset = Date.today.cweek % User.count | |
| User.offset(offset).limit(1).pluck(:id).first == user_id | |
| 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
| find . -iname "*.php" > /tmp/my_php_files.txt | |
| # new template | |
| xgettext --from-code=utf-8 -d my_dir -f /tmp/my_php_files.txt -o languages/my_theme.pot | |
| # update template | |
| xgettext --from-code=utf-8 -d my_dir -j -f /tmp/my_php_files.txt -o languages/my_theme.pot | |
| # To update the already translated .po files and add new strings to them, run: |
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
| diff --git a/wordpress/wp-content/plugins/woocommerce/includes/class-wc-cart.php b/wordpress/wp-content/plugins/woocommerce/includes/class-wc-cart.php | |
| index 5563396..681a859 100644 | |
| --- a/wordpress/wp-content/plugins/woocommerce/includes/class-wc-cart.php | |
| +++ b/wordpress/wp-content/plugins/woocommerce/includes/class-wc-cart.php | |
| @@ -105,6 +105,7 @@ class WC_Cart { | |
| * Constructor for the cart class. Loads options and hooks in the init method. | |
| */ | |
| public function __construct() { | |
| + add_action( 'wp_head', array( $this, 'force_shipping_to_be_set_on_checkout' ) ); | |
| add_action( 'wp_loaded', array( $this, 'init' ) ); // Get cart after WP and plugins are loaded. |
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
| !function() { | |
| var myURL = function(str) { | |
| this.str = str; | |
| this.toString = function() { return str; }; | |
| } | |
| function createFromString(urlString) { | |
| return new myURL(urlString); | |
| } |
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
| var jsdom = require("jsdom"); | |
| var _ = require("lodash"); | |
| var WebCrawler = {}; | |
| var Storage = {}; | |
| !function (crawler) { | |
| var getFreeDownloadableTracks = function(page, finishCallback) { | |
| jsdom.env({ | |
| url: "http://www.last.fm/music/+free-music-downloads?page=" + page, |
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
| require 'brazilian_cardinal_number' | |
| class BrazilianCardinalCurrency | |
| class << self | |
| def cardinal(value) | |
| return 'grátis' if value.zero? | |
| abs_value = value.abs | |
| cents = abs_value.to_s.split('.')[1].to_s[0, 2].to_i | |
| integer = abs_value.to_i |
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
| require 'spec_helper' | |
| shared_examples_for 'durable_record' do | |
| let(:duration) { nil } | |
| let(:end_date) { nil } | |
| let(:start_date) { nil } | |
| let(:instance) { described_class.new } | |
| let(:attributes) do | |
| { duration: duration, end_date: end_date, start_date: start_date } | |
| 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
| var modalQuarteirao = $('#modal-quarteirao') | |
| , botaoQuarteiraoCancelar = modalQuarteirao.find('.cancelar'); | |
| new ProtetorDeAlteracoes(modalQuarteirao, botaoQuarteiraoCancelar); |
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
| # frozen_string_literal: true | |
| # Main Backoffice | |
| class Backoffice::AdminsController < BackofficeController | |
| before_action :set_admin, only: %i[edit update destroy] | |
| after_action :verify_authorized, only: :new | |
| after_action :verify_policy_scoped, only: :index | |
| def index | |
| @admins = policy_scope(Admin) |
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 create | |
| @block_edit = false | |
| debit_params = BankDebit.new(permitted_params[:bank_debit]) | |
| .attributes.symbolize_keys.merge(user_id: current_user.id) | |
| Bank.transaction do | |
| current_user.up_score!(1.3) if current_user.Potencial? | |
| create_plot_debits!(debit_params) | |
| create_debits!(debit_params) | |
| redirect_to cash_path, notice: 'Lançamento realizado com sucesso' |