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
| package main | |
| import ( | |
| "fmt" | |
| "os" | |
| "github.com/charmbracelet/bubbles/help" | |
| "github.com/charmbracelet/bubbles/key" | |
| "github.com/charmbracelet/bubbles/textinput" | |
| tea "github.com/charmbracelet/bubbletea" |
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 Modulo | |
| include Comparable | |
| [:+, :-, :*, :**].each do |meth| | |
| define_method(meth) { |other_n| Modulo.new(@n.send(meth, other_n.to_i), @m) } | |
| end | |
| def initialize(n = 0, m = 26) | |
| @n, @m = n % m, m | |
| end | |
| def <=>(other_n) | |
| @n <=> other_n.to_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
| _obj | |
| *~ | |
| bin |
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
| abc |
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
| func HomeHandler(w http.ResponseWriter, req *http.Request) *Error { | |
| if login, accessToken := getUserInfoFromCookie(req); login != "" && accessToken != "" { | |
| api := NewGithubAPI(login, accessToken) | |
| if gists, err := api.ListGists(); err != nil { | |
| return &Error{err, "Internal server error", 500} | |
| } else { | |
| w.(*Template).Data = map[string]interface{}{"login": login, "gists": gists} | |
| return nil | |
| } | |
| } |
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
| package main | |
| import ( | |
| "path" | |
| "regexp" | |
| "http" | |
| "log" | |
| "io/ioutil" | |
| "flag" | |
| "fmt" |
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 create | |
| offer = Offer.find(params[:offer_id]) | |
| if params[:offer_id] | |
| task = JSON.parse(params[:tasks]) | |
| unless task.nil? | |
| # seleziona i parametri rispondenti alla RE active_(.*) | |
| # in questo modo otterrai una lista "elems" di al max 3 elementi del tipo | |
| # elems == ['active_gift', 'active_encoding', ...] | |
| elems.each do |elem| | |
| klass_name = elem.split('_')[1].capitalize |
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 create | |
| ['gift', 'encoding', 'epd'].each do |param| | |
| eval <<EOC | |
| if active_#{param} | |
| puts "#{param} CREATE" | |
| delete_item = #{param.capitalize}.find_by_task_id(task_id) | |
| delete_item.delete unless delete_item.nil? | |
| new_item = #{param.capitalize}.new(#{param}) | |
| new_task.#{param} = new_item | |
| new_task.save |
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
| package spectrum | |
| import "time" | |
| const ( | |
| second = 1e9 | |
| ms = 1e6 | |
| ) | |
| type FpsCounter struct { |
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
| package spectrum | |
| import ( | |
| "testing" | |
| "time" | |
| ) | |
| const ( | |
| second = 1e9 | |
| ms = 1e6 |
NewerOlder