Skip to content

Instantly share code, notes, and snippets.

@kzjeef
kzjeef / gist:9565261
Created March 15, 2014 11:05
simple token auth user model, this is an comment code from : https://gist.github.com/gonzalo-bulnes/9001010
class User < ActiveRecord::Base
before_save :ensure_authentication_token
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable, :timeoutable,
:recoverable, :rememberable, :trackable, :validatable, :lockable
def ensure_authentication_token
#!/usr/bin/env ruby
require 'logger'
require 'rest_client'
$stdout.sync = true
$stdin.sync = true
path = "/usr/local/var/log/ejabberd/auth.log"
file = File.open(path, File::WRONLY | File::APPEND | File::CREAT)
@kzjeef
kzjeef / cpp
Last active December 1, 2022 17:45
async call example of gmock & gtest
#include <iostream>
#include <gtest/gtest.h>
#include <gmock/gmock.h>
using ::testing::_;
using ::testing::AtLeast; // #1
using ::testing::Ge;
using ::testing::NotNull;
using ::testing::StrictMock;