Skip to content

Instantly share code, notes, and snippets.

View TiuTalk's full-sized avatar
🌴
Tropical Developer

Thiago Belem TiuTalk

🌴
Tropical Developer
  • Assando Sites
  • Arraial d'Ajuda, BA - Brazil
  • 11:49 (UTC -03:00)
View GitHub Profile
<?php
// Cria um cookie chamado 'usuario' com o valor 'Fulano'
setcookie('usuario', 'Fulano');
// Cria o mesmo cookie acima só que irá durar três dias
setcookie('usuario', 'Fulano', (time() + (3 * 24 * 3600)));
// Cria o novo cookie para durar duas horas
setcookie('nome', 'Ciclano', (time() + (2 * 3600)));
# This file is copied to spec/ when you run 'rails generate rspec:install'
if ENV['coverage'] == 'on'
require 'simplecov'
SimpleCov.start 'rails' do
minimum_coverage 100
end
end
ENV['RAILS_ENV'] ||= 'test'
@TiuTalk
TiuTalk / gist:dd18b2797f9bbddce8dc
Last active May 19, 2021 23:59
CakePHP on Heroku

CakePHP via composer

composer.json

{
  "name": "assando-sites",
  "require": {
    "cakephp/cakephp": ">=2.5.0",
    "ext-apcu": "*",
require 'active_support/concern'
module Lockable
@locked = false
def locked?
@locked == true
end
def lock!
require 'spec_helper'
class FakeModelWithPersistenceMethods
include Lockable
attr_accessor :locked
def lock!
@locked = true
end
@TiuTalk
TiuTalk / 0_reuse_code.js
Created March 15, 2014 04:36
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
* [Features](#features)
* [Key Bindings](#key-bindings)
* [GFM Spesific Features](#gfm-spesific-features)
* [Commands for Command Palette](#commands-for-command-palette)
* [Installation](#installation)
* [Configuration](#configuration)
* [Tips](#tips)
* [Similar Plugins](#similar-plugins)
* [Contributing](#contributing)
* [Credits](#credits)

The error looks like this?

Bundler::GemNotFound: Could not find jumpup-heroku-0.0.1.gem for installation
An error occurred while installing jumpup-heroku (0.0.1), and Bundler cannot continue.
Make sure that `gem install jumpup-heroku -v '0.0.1'` succeeds before bundling.

How to run only the broken integration task:

2.0.0p353 :001 > "2".to_i +2
=> 0
2.0.0p353 :002 > "2".to_i + 2
=> 4
outdated_gems = `gem outdated`
regex = %r((?<gem>[\w-]+) \((?<old>[\d\.]+) < (?<new>[\d\.]+)\))
gemfile = File.read("./Gemfile")
outdated_gems.each_line do |line|
data = line.match(regex)
gemfile.gsub!(%r(gem '#{data[:gem]}',(\s+)'[^']+'), "gem '#{data[:gem]}',\\1'#{data[:new]}'")
end