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
package main | |
import "fmt" | |
type A struct{} | |
type B struct { | |
A | |
} | |
func (a A) HiThere() { |
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 A { | |
void print() { | |
System.out.println(secret()); | |
} | |
String secret() { | |
return "A"; | |
} | |
static void staticPrint() { | |
System.out.println(staticSecret()); |
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
##### Rails app: config/boot.rb Added by VaskoZ | |
@stats = {} | |
@tp = TracePoint.trace(:a_call) do |tp| | |
@stats[tp.defined_class] ||= {} | |
@stats[tp.defined_class][tp.method_id] ||= 0 | |
@stats[tp.defined_class][tp.method_id] += 1 | |
end | |
@tp.enable | |
##### End VaskoZ changes | |
# Set up gems listed in the Gemfile. |
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
package main | |
import ( | |
g "github.com/moovweb/gokogiri" | |
. "io/ioutil" | |
_ "fmt" | |
"os" | |
) | |
func main() { |
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
package main | |
import ( | |
g "github.com/moovweb/gokogiri" | |
"github.com/moovweb/gokogiri/html" | |
. "io/ioutil" | |
"fmt" | |
"os" | |
"strconv" | |
) |
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
#denom = popular_usd_denom = [100_00, 50_00, 20_00, 10_00, 5_00, 1_00, 25, 10, 5, 1] | |
#denom = official_usd_denom = [100_00, 50_00, 20_00, 10_00, 5_00, 2_00, 1_00, 50, 25, 10, 5, 1] | |
#denom = power2_denom = [64_00, 32_00, 16_00, 8_00, 4_00, 2_00, 1_00, 32, 16, 8, 4, 2, 1] | |
denom = power3_denom = [27_00, 9_00, 3_00, 1_00, 27, 9, 3, 1] | |
#denom = power4_denom = [64_00, 16_00, 4_00, 1_00, 64, 16, 4, 1] | |
total_prices = 100_00 | |
needed = Array.new(total_prices, 0) | |
denom_count = denom.size |
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
import java.util.*; | |
public class AscendingSortSpeed { | |
public static void main(String[] args) { | |
int[] data = new int[1_000_000_000]; // 1 BILLION INTS | |
for (int i = 0; i < data.length; i++) { | |
data[i] = i; | |
} | |
// Sort to ascending | |
long start = System.currentTimeMillis(); |
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
package main | |
import "fmt" | |
type Point struct {} | |
func (p *Point) Scale() { | |
fmt.Println("method") | |
} |
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
package main | |
// There are 4 FOR examples below, but they differ in how they require | |
// blocks to start. | |
import "fmt" | |
// CANNOT start block on next line | |
func CForLoop() { | |
sum := 0 |
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
#include <stdio.h> | |
int main (void) | |
{ | |
int a = -1; | |
unsigned int b = 2; | |
printf("%d\n", 1 > 0); // TRUE == 1 | |
printf("%d\n", 0 > 1); // FALSE == 0 | |
printf("%d\n", a > b); // -1 > 2 apparently TRUE == 1 | |
printf("%d\n", -1 > 2u); // -1 > 2unsigned apparently TRUE == 1 | |
printf("%d\n", -1 > 2); // -1 > 2 FALSE == 0 |
OlderNewer