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 DealsHelper | |
| def slider(klass,attr,opts={}) | |
| options = { | |
| :max => max=klass.maximum(attr), | |
| :min => min=klass.minimum(attr), | |
| :range => true, | |
| :values => [min,max] | |
| }.merge(opts).to_json | |
| input = hidden_field_tag "#{klass.to_s.underscore}[#{attr}]" | |
| raw <<-HTML |
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
| $ () -> | |
| window.search = new LiveSearch("#search") | |
| class LiveSearch | |
| constructor: (context,result) -> | |
| el = @context = $(context) | |
| @result = el.find(".result") | |
| @form = el.find("form") | |
| @form.bind "ajax:success", (e,data) => | |
| window.data = data |
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
| def print | |
| @doc = Document.find(params[:id]) | |
| respond_to do |format| | |
| format.html { | |
| render "final", :layout => "print" | |
| } | |
| format.pdf { | |
| html = render_to_string "final", :layout => "print" | |
| p [:output,html] | |
| kit = PDFKit.new(html, :page_size => 'Letter') |
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 ruby-reindent-then-newline-and-indent () | |
| (interactive "*") | |
| (let* ((cur (point)) | |
| ;; we need to insert a space artificially for this test to work properly :( | |
| (expand-p (progn (insert " ") | |
| (ruby-electric-space-can-be-expanded-p)))) | |
| ;; remove the inserted space | |
| (progn (goto-char cur) | |
| (delete-char 1)) |
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
| auto_minimize: () -> | |
| @_auto_minimize ||= _.debounce (=> this.minimize()), 4000 | |
| @_auto_minimize() |
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
| drag: function(event, ui) { | |
| var inst = $(this).data("draggable"), o = inst.options; | |
| var d = o.snapTolerance; | |
| var x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width, | |
| y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height; | |
| for (var i = inst.snapElements.length - 1; i >= 0; 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
| a = (a / 2) - (b / 2) | |
| c = / 2) - (b / |
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
| server { | |
| # server_name baolaika.com api.baolaika.com demo.baolaika.com; | |
| server_name pfadmin.baolaika.com; | |
| root /home/deploy/www/puffant-admin/current/public; | |
| location ~ ^/assets/sdk { | |
| access_log off; | |
| gzip_static on; | |
| } |
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
| #include <stdio.h> | |
| #include <assert.h> | |
| #include <stdlib.h> | |
| typedef struct node{ | |
| int e; | |
| struct node *next; | |
| } node; | |
| node *list_build(int* a,int size) { |
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
| # adapted from bin/sidekiq | |
| # to invoke, run: zeus runner sidekiq.rb | |
| require 'sidekiq/cli' | |
| begin | |
| cli = Sidekiq::CLI.instance | |
| cli.parse | |
| cli.run | |
| rescue => e |