Skip to content

Instantly share code, notes, and snippets.

View bitdewy's full-sized avatar

bitdewy bitdewy

  • Bytedance
  • beijing
View GitHub Profile
cmake_minimum_required(VERSION 2.6)
project(lua C)
if(MSVC)
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_C_FLAGS_DEBUG "/D_DEBUG /MTd /Zi /Ob0 /Od /RTC1")
set(CMAKE_C_FLAGS_RELEASE "/MT /O2 /Ob2 /D NDEBUG")
set(CMAKE_C_FLAGS_MINSIZEREL "/MT /O1 /Ob1 /D NDEBUG")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "/MT /Zi /O2 /Ob1 /D NDEBUG")
@bitdewy
bitdewy / bo.cc
Created April 15, 2014 03:48
bo. make unique with deleter
#include <memory>
#include <iostream>
namespace bo {
template<typename T, typename Arg, typename Deleter = std::default_delete<T>>
std::unique_ptr<T, Deleter> make_unique(Arg&& a, Deleter&& d = std::default_delete<T>()) {
return std::unique_ptr<T, Deleter>(new T(std::forward<Arg>(a)), std::forward<Deleter>(d));
}
}
@bitdewy
bitdewy / xocean.db.js
Created March 12, 2014 17:30
xocean schema
// !!! sketch, no constraint
var mongoose = require('mongoose'),
Schema = mongoose.Schema;
var WorkItemSchema = new Schema({
description: String,
createdAt: Date,
lastModified: Date,
status: Number
@bitdewy
bitdewy / logo-css3.css
Last active January 4, 2016 03:09
cyou logo
body {
margin: 0;
padding: 0;
font: 12px Tahoma, arial, sans-serif;
}
header {
font-family: 'Segoe UI Light', 'Segoe UI', 'Microsoft Jhenghei', '微软雅黑', sans-serif;
color: #666;
font-size: 50px;
@bitdewy
bitdewy / 6.lisp
Created April 10, 2013 12:02
Project Euler #6 in Common LIsp
;;;;
;;;; 6.lisp
;;;; ProjectEuler
;;;;
;;;; Created by bitdewy on 4/10/13.
;;;; Copyright (c) 2013 bitdewy. All rights reserved.
;;;;
;; Project Euler #6
(defun square (x)
@bitdewy
bitdewy / 5.lisp
Created April 10, 2013 06:21
Project Euler #5 in Common Lisp
;;;;
;;;; 5.lisp
;;;; ProjectEuler
;;;;
;;;; Created by bitdewy on 4/10/13.
;;;; Copyright (c) 2013 bitdewy. All rights reserved.
;;;;
;; Project Euler #5
(defun smallest_multiple1 (max)
@bitdewy
bitdewy / 3.lisp
Last active December 16, 2015 00:10
Project Euler #3 in Common Lisp
;;;;
;;;; 3.lisp
;;;; ProjectEuler
;;;;
;;;; Created by bitdewy on 4/9/13.
;;;; Copyright (c) 2013 bitdewy. All rights reserved.
;;;;
;; Project Euler #3
(defun factorization (number)
@bitdewy
bitdewy / 2.lisp
Created April 7, 2013 16:55
Project Euler #2 in Common Lisp
;;;;
;;;; 2.lisp
;;;; ProjectEuler
;;;;
;;;; Created by bitdewy on 4/8/13.
;;;; Copyright (c) 2013 bitdewy. All rights reserved.
;;;;
;; Project Euler #2
(defun fibonacci (max)
@bitdewy
bitdewy / gl_practice.cpp
Created April 7, 2013 10:39
openGL practice
#include <iostream>
#include <map>
#include <vector>
#include <boost/bind.hpp>
#include <boost/function.hpp>
#include <boost/noncopyable.hpp>
#include <gl/glut.h>
#include <gl/SOIL.h>
class KeyboardManger : boost::noncopyable
@bitdewy
bitdewy / 1.lisp
Last active December 15, 2015 21:39
Project Euler #1 in Common Lisp
;;;;
;;;; 1.lisp
;;;; ProjectEuler
;;;;
;;;; Created by bitdewy on 4/7/13.
;;;; Copyright (c) 2013 bitdewy. All rights reserved.
;;;;
;; Project Euler #1
(defun sum_of_values_multiples (max values)