Skip to content

Instantly share code, notes, and snippets.

Avatar

Jiejing Zhang kzjeef

View GitHub Profile
@kzjeef
kzjeef / cpp
Last active Dec 2, 2019
async call example of gmock & gtest
View cpp
#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;
View ejabberd_auth.rb
#!/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 / gist:9565261
Created Mar 15, 2014
simple token auth user model, this is an comment code from : https://gist.github.com/gonzalo-bulnes/9001010
View gist:9565261
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
You can’t perform that action at this time.