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 * as fs from "fs"; | |
const coverage = JSON.parse( | |
fs.readFileSync("coverage/coverage-final.json", "utf-8") | |
); | |
const output = Object.values(coverage).map((x) => { | |
const path = x.path; | |
const totalStatements = Object.keys(x.statementMap).length; | |
const coveredStatements = Object.entries(x.s).filter( |
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
using System.Collections.Generic; | |
using System.Linq; | |
using UnityEngine; | |
[System.Serializable] | |
public abstract class BaseReconciler<TKey, TObject> : ISerializationCallbackReceiver where TObject : Object | |
{ | |
private Dictionary<TKey, TObject> managedObjects; | |
private List<TObject> serializedManagedObjects; |
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
// importing a dependency from Cargo (the package manager) | |
extern crate threadpool; | |
use std::sync::{self, mpsc}; | |
use std::thread; | |
use std::time; | |
// data type to keep a handle for a task | |
struct ThreadpoolTask<T> { | |
rx: mpsc::Receiver<T>, |
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
const nock = require('nock'); | |
const test = require('tap').test; | |
const superagent = require('superagent'); | |
test('reqheaders ignored #748 - test matching', t => { | |
nock('http://www.example.com', { | |
reqheaders: { | |
'authorization': 'Bearer TOKEN' | |
} | |
}) |
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
function render1() { | |
return ( | |
<div> | |
{ templates.length | |
? null | |
: <div>Nothing to see here, move along...</div> | |
} | |
</div> | |
); | |
} |
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
// Paste this into the Developer Console for any project that uses jQuery | |
function stopMonkey() { | |
clearInterval(monkey); | |
} | |
monkey = setInterval(function() { | |
var $els = $('body').find('*:visible'); | |
var rand = Math.round(Math.random() * $els.length); | |
$els.eq(rand).click(); |
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 SessionsController < ApplicationController | |
layout 'basic' | |
def new | |
end | |
def create | |
puts params[:email] | |
puts params[:password] |
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
/// <reference path="quintus.d.ts" /> | |
var Q = Quintus() | |
.include("Sprites, Scenes, Input"); | |
// No need to call Q.Sprite.extend | |
class Player extends Q.Sprite { | |
init(p) { | |
super.init(p, { | |
asset: "somegraphic.png", |
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
// AwaitScript sample compiled to JavaScript | |
var async = require('async'); | |
function recurse(path, fn) { | |
var files = []; | |
fs.readdir(path, function(err, dir) { | |
if (err) return fn(err); | |
async.forEach(dir, function(f, fn) { | |
fs.stat(f, function(err, stat) { | |
if (err) return fn(err); |
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
var Resource = require('deployd/lib/resource') | |
, util = require('util'); | |
function Rewrite(name, options) { | |
Resource.apply(this, arguments); | |
this.rewriteUrl = this.config.rewriteUrl || '/index.html'; | |
} | |
util.inherits(Rewrite, Resource); | |
module.exports = Rewrite; |
NewerOlder