View function.rb
This file contains 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
# frozen_string_literal: true | |
module Ai | |
class Function | |
# Returns a formatted function payload | |
def to_payload | |
{ | |
"name" => name, | |
"description" => description, | |
"parameters" => parameters, |
View css_classes.rb
This file contains 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
# frozen_string_literal: true | |
module Views | |
module CssClasses | |
extend ActiveSupport::Concern | |
class CssHelper; end | |
class_methods do | |
def css_helper |
View Item URI2.js
This file contains 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
{ | |
"translatorID":"90ed0f17-6ead-42fe-afb9-d34adb230099", | |
"translatorType":2, | |
"label":"Item URI para cucho", | |
"creator":"jojo", | |
"target":"html", | |
"minVersion":"2.0", | |
"maxVersion":"", | |
"priority":200, | |
"inRepository":false, |
View hardware-raspberry-pi.nix
This file contains 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
{ config, lib, pkgs, modulesPath, ... }: | |
{ | |
imports = | |
[ | |
"${fetchTarball "https://github.com/NixOS/nixos-hardware/archive/2a7063461c3751d83869a2a0a8ebc59e34bec5b2.tar.gz" }/raspberry-pi/4" | |
]; | |
boot.kernelPackages = pkgs.linuxPackages_rpi4; | |
boot.kernel.sysctl."vm.swappiness" = 0; |
View gist:885b007b510e211d53451b15d4f60edd
This file contains 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
[Unit] | |
After=docker.service docker.socket | |
After=ifup@eth0.service | |
Wants=ifup@eth0.service | |
[Service] | |
ExecStart=/usr/bin/docker run \ | |
--rm \ | |
--name=traefik \ |
View debug_turbolinks.patch
This file contains 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
diff --git a/lib/assets/javascripts/turbolinks.js.coffee b/lib/assets/javascripts/turbolinks.js.coffee | |
index 4f59e37..d1d0640 100644 | |
--- a/lib/assets/javascripts/turbolinks.js.coffee | |
+++ b/lib/assets/javascripts/turbolinks.js.coffee | |
@@ -137,6 +137,7 @@ removeHash = (url) -> | |
link.href.replace link.hash, '' | |
triggerEvent = (name) -> | |
+ console.log 'trigering event', name | |
event = document.createEvent 'Events' |
View 0_reuse_code.js
This file contains 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
View string_each_match.rb
This file contains 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 String | |
def each_match(regex) | |
result = [] | |
position = 0 | |
while match_data = regex.match(self, position) do | |
result << if block_given? then yield(match_data) else match_data end | |
position = match_data.end(match_data.size - 1) | |
end | |
View frown.coffee
This file contains 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
show_frown_gif = -> | |
@result.html $('<img>').attr('src', 'http://mrwgifs.com/wp-content/uploads/2013/07/Zooey-Deschanels-Cute-Sad-Frown.gif') |
View amazon_item.rb
This file contains 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 AmazonItem | |
attr_accessor :asin, :url, :manufacturer, :category, :title, \ | |
:ean, :item_number, :model, :lowest_price, :image_url, \ | |
:list_price, :offer_price | |
def initialize(attributes = {}) | |
update_attributes(attributes) | |
end | |
def update_attributes(new_attributes) |
NewerOlder