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
| var request = require('request'); | |
| var ZabbixApi = function(user, password, api_url) { | |
| this.user = user; | |
| this.password = password; | |
| this.api_url = api_url; | |
| this.id = 0; | |
| }; | |
| ZabbixApi.prototype.post = function(data, fn) { |
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 Fakeit | |
| extend self | |
| attr_accessor :array_mark, :hash_mark | |
| @array_mark = '[ ]' | |
| @hash_mark = '{:,}' | |
| # Not effient way to parse json-like structure | |
| # The problem is `split` is called too many times. | |
| # The better way to do it, is something like the original js json parser . | |
| # It's done by using only one pass. |
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
| Rails3 - CheatSheet - CommandLine | |
| rails new ApplicationName – Create a new application | |
| rails _3.0.9_ new ApplicationName – Create a new application with a specific version of rails | |
| rails generate/g model ModelName – Creates a model with the specified model_name | |
| rails generate/g controller ControllerName – Creates a controller with the specified controller_name | |
| rails generate/g migration MigrationName – Creates a migration with the specified migration_name | |
| rails generate/g scaffold ModelName ControllerName – A shortcut for creating your controller, model and view files etc. | |
| rails destroy controller ControllerName – Destroys the created controller and its related file. | |
| rails destroy model - Destroys the created model and its related file. |
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
| (defvar <- "\\(") | |
| (defvar -> "\\)") | |
| (defalias '@ 'regexp-quote) | |
| (defun re/start-of-line (&optional next) | |
| (concat "^" next)) | |
| (defun re/end-of-line (&optional next) | |
| (concat "$" next)) |
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
| Hello World |
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
| import random | |
| class _: | |
| def __init__(self, data): | |
| if isinstance (data, _): return data | |
| self.data = data | |
| def value (self): | |
| return self.datan | |
| def each (self, func): |
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
| # NOTICE: to get Nginx+Unicorn best-practices configuration see the gist https://gist.github.com/3052776 | |
| $ cd /usr/src | |
| $ wget http://nginx.org/download/nginx-1.2.1.tar.gz | |
| $ tar xzvf ./nginx-1.2.1.tar.gz && rm -f ./nginx-1.2.1.tar.gz | |
| $ wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.30.tar.gz | |
| $ tar xzvf pcre-8.30.tar.gz && rm -f ./pcre-8.30.tar.gz | |
| $ wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz |
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
| class Hash | |
| def pick(*args) | |
| result = {} | |
| args.each do |k| | |
| result[k] = self[k] | |
| end | |
| result | |
| end | |
| end | |
| a = {a: 1 , b: 2, c: 3} |
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
| https://github.com/hecbuma/compass-bootstrap | |
| http://twitter.github.io/bootstrap/javascript.html#carousel | |
| http://twitter.github.io/bootstrap/javascript.html#tooltips | |
| http://twitter.github.io/bootstrap/javascript.html#dropdowns | |
| http://twitter.github.io/bootstrap/components.html#breadcrumbs |
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
| ;;; real-time-markdown.el --- Mou in emacs . | |
| ;; Author: Wenjun Yan <mylastnameisyan@gmail.com> | |
| ;; Version: 0.1 | |
| ;; URL: https://gist.github.com/v2e4lisp/5613374 | |
| ;; Package-Requires: ((impatient-mode "0.1")) | |
| ;; | |
| ;; Copyright (C) 2013 Wenjun Yan | |
| ;; | |
| ;; This program is free software; you can redistribute it and/or modify |