Skip to content

Instantly share code, notes, and snippets.

Avatar
🕛
Code

Salvatore dested

🕛
Code
View GitHub Profile
View let_test.js
let a = 1;
if (a == 1) {
let a = 2;
console.log(a);
}
console.log(a);
let b = 1;
if (a == 1) {
let b = b;
View compose.ts
type restParam<R> = ((...a: any[]) => R);
type oneParam<A, R> = ((a: A) => R);
type twoParam<A, B, R> = ((a: A, b: B) => R);
type threeParam<A, B, C, R> = ((a: A, b: B, c: C) => R);
type composeFn = (
(() => () => void) &
//1 param, 5 composes
View conditional_type.ts
export enum MemberActionOptions {
DoThis,
DoThat,
OtherThing
}
export type MemberAction = {
type: MemberActionOptions.DoThis,
thisThing: number,
} | {
View lock.cs
var locker = new object();
long count1 = 0,count2=0;
Task.Run(() =>{while (true)lock (locker)count1++;});
Task.Run(() =>{while (true)lock (locker)count2++;});
Task.Run(() =>{while (true)Console.WriteLine(" Diff :" + (count1 - count2));});
Console.ReadLine();
View oop.cs
public class ServerGame : Game
{
public override void MakePlayer()
{
MainPlayer = new ServerPlayer();
}
public void Tick()
{
MainPlayer.ServerThing();//Unavailable without casting
View encode-decode-5-bits.js
//actual inputs
var t0 = process.hrtime();
var m = new Uint8Array(30*60*60*5);
for (var c = 0; c < m.length; c++)m[c] = Math.random() * 32 | 0;
var mk = [];
View bezier.html
<html>
<head>
<title>Bezier</title>
</head>
<body>
<canvas id="canvas" width="1500" height="1200"></canvas>
<input type="range" value="0.5" oninput="updateBezier(this.value)" min="0" max="1" step="0.005" style="position:absolute; width:98%; left:0; top:0;" />
<script type="text/javascript">
function Point(x, y) {
this.x = x;
View gist:97aa4b574b58fc8da898e3efb1f1809d
package cse360assign1;
import java.util.*;
public class stringList {
private ArrayList<String> list;
private int count;
boolean DEBUG = true;
stringList() {
View gist:f69d1ca70a13f05e27d3d8cefb5997a5
var page = new tabris.Page({
title: "TabFolder - Swipe",
topLevel: true
});
var sv = new tabris.ScrollView({
left: 0,
top: 50,
height: 400,
background: "#AB47BC"
View gist:fba9cdd2f66cd9b5460d
import java.io.*;
import java.util.*;
public class NameApp {
private String name;
private int[] popularityRanks;
public static void main (String[] args) throws FileNotFoundException {