This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- mode: snippet -*- | |
| # name: debug | |
| # key: db | |
| # -- | |
| require ` (let ((version (shell-command-to-string "rbenv version"))) | |
| (if (string-match-p "^2" version) | |
| (concat "'byebug';byebug") | |
| (concat "'ruby-debug';debugger"))) | |
| ` | |
| $0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'delegate' | |
| class GuestRole < SimpleDelegator | |
| def books | |
| Book.published | |
| end | |
| end | |
| class AdminRole < SimpleDelegator | |
| def books |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'yaml' | |
| require 'multi_json' | |
| module MyApp | |
| module Queue | |
| extend self | |
| def redis | |
| MyApp.redis | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module WuakiBackground | |
| module DelayedTask | |
| def self.include(base) | |
| base.extend(ClassMethods) | |
| end | |
| module ClassMethods | |
| def before_perform(*args) | |
| _args = args.dup | |
| options = _args.extract_options! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| redis = require('redis') | |
| client = redis.connect('127.0.0.1', 6379) | |
| class RedisModel | |
| @primary_key: "id" | |
| @model: nil | |
| @counters: {} | |
| -- class methods | |
| @counter: => |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defun copy-buffer () | |
| "Copy buffer to clipboard" | |
| (clipboard-kill-ring-save (point-min) (point-max))) | |
| (defun git-changelog () | |
| (interactive) | |
| (shell-command "git --no-pager log --no-merges --pretty=format:'- %s' `git describe --abbrev=0 --tags`.." "*changelog*") | |
| (switch-to-buffer "*changelog*") | |
| (copy-buffer)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| # | |
| # Git commit-msg hook. If your branch name is in the form "username/vod-45-new-feature" | |
| # it automatically adds the prefix "[VOD-45]" to commit | |
| # messages. | |
| # | |
| # Example | |
| # ======= | |
| # | |
| # git checkout -b bob/vod-45-some-cool-feature |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int main(int argc, char *argv[]) | |
| { | |
| int *array, i; | |
| array = malloc(sizeof(int) * 100); | |
| memset((void *)array, 0, sizeof(int) * 100); | |
| *(array + sizeof(int) * 30) = 4; | |
| for(i = 0; i < 100; i++) { | |
| int value; | |
| value = *(array + sizeof(int) * i); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export PROJECTS=~/wuaki/ | |
| function cs { | |
| local dest current | |
| mkdir -p "$PROJECTS" | |
| cd "$PROJECTS/$1" | |
| } | |
| function _cs_scandir |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| thin start -p 3000 -R test.ru |