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
<?php | |
/* get a relative path to the sites root */ | |
$root = preg_replace(':/[^/]+:', '../', dirname($_SERVER['SCRIPT_NAME'])); |
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
const lerp = (f0, f1, t) => (1 - t) * f0 + t * f1; | |
const lerp2 = (v1, v2, t) => { | |
return { | |
x: lerp(v1.x, v2.x, t), | |
y: lerp(v2.y, v2.x, t) | |
}; | |
}; |
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
import java.io.ByteArrayInputStream; | |
import java.io.ByteArrayOutputStream; | |
import java.io.IOException; | |
import java.io.ObjectInputStream; | |
import java.io.ObjectOutputStream; | |
public class DeepCopy { | |
private DeepCopy() { } |
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
import org.paninij.lang.*; | |
@Root | |
@Capsule | |
public class HelloWorldTemplate { | |
@Local Greeter g; | |
@Local Console c; | |
void design(HelloWorld self) { | |
g.imports(c); |
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
import org.paninij.lang.*; | |
@Capsule | |
public class GreeterTemplate { | |
@Imports Console c; | |
String message; | |
void init() { | |
message = "Hello"; |
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
import org.paninij.lang.*; | |
@Capsule | |
public class ConsoleTemplate { | |
@Block | |
public void write(String s) { | |
System.out.println(s); | |
} | |
} |
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
'use strict'; | |
var | |
gutil = require('gulp-util'), | |
gulp = require('gulp'), | |
browserify = require('browserify'), | |
babelify = require('babelify'), | |
source = require('vinyl-source-stream'), | |
buffer = require('vinyl-buffer'), | |
browser = require('browser-sync'), |
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
/* | |
* NodeJS driver for MongoDB | |
* | |
* This is from the https://docs.mongodb.org/getting-started/node/client/ documentation. | |
* Expects database on mongodb://localhost:27017/test | |
*/ | |
var MongoClient = require('mongodb').MongoClient; | |
var assert = require('assert'); | |
var url = 'mongodb://localhost:27017/test'; |
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
server { | |
# Port that the web server will listen on. | |
listen 80; | |
# Host that will serve this project. | |
server_name my-project.local; | |
access_log /var/www/my-project/log/access.log; | |
error_log /var/www/my-project/log/error.log; |
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
let _id; | |
const id = () => { | |
let now = Date.now(); | |
if (now <= _id) now++; | |
_id = now; | |
return now; | |
} | |
const hash = (n) => n.sort((a, b) => a > b).join('$'); | |
const remove = (a, v) => a.splice(a.indexOf(v), 1); |
OlderNewer