Skip to content

Instantly share code, notes, and snippets.

View creamidea's full-sized avatar

NekoTrek creamidea

View GitHub Profile
@cowboy
cowboy / HEY-YOU.md
Last active July 1, 2024 08:37
jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery.
@wilmoore
wilmoore / convert.sh
Created June 2, 2011 00:29
convert markdown to reStructured Text (Thanks Doctrine2) - https://github.com/doctrine/dbal-documentation/blob/master/convert.sh
#!/bin/bash
FILES=`find -iname *.txt -print`
for FILE in $FILES
do
# replace the + to # chars
sed -i -r 's/^([+]{4})\s/#### /' $FILE
sed -i -r 's/^([+]{3})\s/### /' $FILE
sed -i -r 's/^([+]{2})\s/## /' $FILE
sed -i -r 's/^([+]{1})\s/# /' $FILE
sed -i -r 's/(\[php\])/<?php/' $FILE
@alex-1q84
alex-1q84 / compild.py
Last active March 8, 2022 09:22
使用python的sched和Timer执行定时任务
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import sched, time
from threading import Thread, Timer
import subprocess
s = sched.scheduler(time.time, time.sleep)
class Job(Thread):
@timoxley
timoxley / drop_collections.js
Created July 27, 2012 17:30
mongoose drop collections helper
var async = require('async')
var _ = require('underscore')
var Helpers = function(mongoose) {
this.mongoose = mongoose || require('mongoose')
this.dropCollections = function(callback) {
var collections = _.keys(mongoose.connection.collections)
async.forEach(collections, function(collectionName, done) {
var collection = mongoose.connection.collections[collectionName]
@agnoster
agnoster / README.md
Last active July 13, 2024 19:26
My ZSH Theme

agnoster.zsh-theme

A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

For Mac users, I highly recommend iTerm 2 + Solarized Dark

@t1anchen
t1anchen / Makefile
Created October 2, 2012 15:07
C++0x Lambda Demo
CXX = i686-pc-mingw32-g++
CXXFLAGS = -Wall
CXXDEBUGFLAG = -g
CXXOPTFLAG = -O3
CXX0XFLAG = -std=c++0x
CXXLINKFLAG = -static
BINS = cxx0x-address
all: $(BINS)
@creamidea
creamidea / jquery.ba-tinypubsub.js
Created December 17, 2012 14:00 — forked from cowboy/HEY-YOU.md
这是一个用js实现的订阅/发布系统,写的很简洁,但是非常的完美。
/* jQuery Tiny Pub/Sub - v0.7 - 10/27/2011
* http://benalman.com/
* Copyright (c) 2011 "Cowboy" Ben Alman; Licensed MIT, GPL */
(function($) {
var o = $({});
$.subscribe = function() {
o.on.apply(o, arguments);
@johnbender
johnbender / prefs.js
Created February 23, 2013 06:20
Set up Chrome Secure Shell to handle solarized terminal colors
// Disable bold.
term_.prefs_.set('enable-bold', false)
// Use this for Solarized Dark
term_.prefs_.set('background-color', "#002b36");
term_.prefs_.set('foreground-color', "#839496");
term_.prefs_.set('color-palette-overrides', [
'#073642',
'#dc322f',
#include <assert.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <windows.h> // 各种位图数据结构
class Converter
{
public:
Converter() : pixels_(NULL), width_(0), height_(0) {}
#ifndef SMART_IRRIGATION_H
#define SMART_IRRIGATION_H
#define RESERVED_LEN 1
// list of operation -> request_code
#define SET_SWITCH_STATUS_REQUEST 0x01// 设置传感器开关
#define GET_SWITCH_STATUS_REQUEST 0x02// 获取开关状态
#define GET_READING_REQUEST 0x03// 获取传感器采集的数据
#define SET_READING_PERIOD_REQUEST 0x04// 设置采集的周期