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
| function lazyCompileFactory(id, html) { | |
| crunch.global.templates[id] = function(context) { | |
| var compiled = Handlebars.compile(html); | |
| crunch.global.templates[id] = compiled; | |
| return compiled(context); | |
| } | |
| } | |
| $('script[type="text/x-handlebars-template"]').each(function() { | |
| var text = this.textContent; |
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 'listen' | |
| require 'rb-fsevent' | |
| LISTEN_PATH = '/tmp/m' | |
| consumer, producer = IO.pipe | |
| Dir["#{LISTEN_PATH}/*"].each {|n| producer.puts n } | |
| 2.times do |
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 'benchmark/ips' | |
| Benchmark.ips do |x| | |
| RESULT = [1] | |
| x.report('first') do |times| | |
| i = 0 | |
| while i < times | |
| id = RESULT.first | |
| i += 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
| require 'benchmark/ips' | |
| require_relative '../config/environment' | |
| Benchmark.ips do |x| | |
| x.report("without patch - by slug") { | |
| User.uncached do | |
| User.find("tj-singleton") | |
| 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
| CREATE TABLE report ( | |
| account_id INT UNIQUE, | |
| classification VARCHAR(11) | |
| ); | |
| CREATE TABLE report_temp ( | |
| account_id INT UNIQUE, | |
| classification VARCHAR(11) | |
| ); |
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
| cl = ContentLicense.last | |
| cl.content.object_id == cl.presentation.content.object_id | |
| #=> false | |
| cl.reload | |
| cl.association(:content).target = cl.presentation.content | |
| >> cl.content.object_id == cl.presentation.content.object_id | |
| #=> true |
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
| names = [ | |
| "ERock560", | |
| "jeep19950", | |
| "meltin-BARRELS", | |
| "RMAN2010", | |
| "maden471", | |
| "zeSPACE_NAZl", | |
| "mud-racer2005", | |
| "RICHIEJMONEY", | |
| "yotamallcrawler", |
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
| turn_right = true | |
| function dig_forward() | |
| turtle.dig() | |
| turtle.forward() | |
| end | |
| function dig_down() | |
| turtle.digDown() | |
| turtle.down() |
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 'pathname' | |
| ROOT = Pathname.pwd | |
| SIZES = %W[ | |
| 1056x792 | |
| 1162x871 | |
| 1278x958 | |
| 1406x1054 | |
| 1546x1160 | |
| 1701x1276 |
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> | |
| int main() { | |
| unsigned long dword; | |
| char converted; | |
| dword = 255L; | |
| converted = (char) dword; | |
| printf("value is: %lu\n", dword); | |
| printf("value is: %lu\n", converted); |