Dynamic languages, such as JavaScript, give programmers the freedom to ignore types, and enable them to write concise code in short time. Despite this freedom, many programs follow implicit type rules, for example, that a function has a particular signature or that a property has a particular type. Violations of such implicit type rules often correlate with problems in the program. This paper presents Type Devil, a mostly dynamic analysis that warns developers about inconsistent types. The key idea is to assign a set of observed types to each variable, property, and function, to merge types based in their structure, and to warn developers about variables, properties, and functions that have inconsistent types. To deal with the pervasiveness of polymorphic behavior in real-world JavaScript programs, we present a set of techniques to remove spurious warnings and to merge related warnings. Applying Type Devil to widely used benchmark suites and rea
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
#!/usr/bin/env bash | |
# | |
# Run from the project root. Pass the full name of a script, or substring of the names of the scripts to check. | |
# | |
# Example | |
# $) ./findrefs.sh BackgroundCamera | |
# Finding matches for script Assets/Scripts/Camera/BackgroundCamera.cs.meta ... | |
# Assets/Prefabs/CaveBGCamera.prefab: m_Script: {fileID: 11500000, guid: 7e63acfee367c4314852b87218149bd3, type: 3} | |
# Assets/Prefabs/ForestBGCamera.prefab: m_Script: {fileID: 11500000, guid: 7e63acfee367c4314852b87218149bd3, type: 3} | |
# |
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
WindowsHelpers-Run-As-Admin.lnk |
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 time | |
import psutil | |
import winsound | |
last_disk_time = None | |
last_time = None | |
while (True): | |
curr_time = time.time() | |
counters = psutil.disk_io_counters() |
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
var seed = '1', rands; | |
Math.seedrandom(seed); | |
if ( | |
window.seed && window.seed !== seed || | |
!window.rands | |
) { | |
rands = window.rands = []; | |
for (var i = 0; i < 50000; i++) { | |
rands.push(Math.random()); | |
} |
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
// Converts double quotes to single quotes using a JavsScript language parser. | |
// Single quotes and escaped doubled quotes inside strings are converted to | |
// double quotes. | |
// | |
// Adapted from | |
// http://ariya.ofilabs.com/2012/02/from-double-quotes-to-single-quotes.html | |
// | |
// Usage: | |
// $ node singlequote.js <input> [output] | |
// If an output file is not given, the script modified the input file itself. |
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
/* | |
Get acceleration data from Chronos watch. | |
Taken from info posted at: http://e2e.ti.com/support/microcontrollers/msp43016-bit_ultra-low_power_mcus/f/166/t/32714.aspx | |
Based off of the latest Python code on the Chronos wiki that I wrote. | |
Copyright (c) 2010 Sean Brewer | |
Permission is hereby granted, free of charge, to any person | |
obtaining a copy of this software and associated documentation |
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
<snippet> | |
<content><![CDATA[ | |
import ipdb; ipdb.set_trace() | |
]]></content> | |
<!-- Optional: Set a tabTrigger to define how to trigger the snippet --> | |
<!-- <tabTrigger>hello</tabTrigger> --> | |
<!-- Optional: Set a scope to limit where the snippet will trigger --> | |
<!-- <scope>source.python</scope> --> | |
<tabTrigger>ipdb</tabTrigger> | |
<scope>source.python</scope> |
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
// Taken from http://ariya.ofilabs.com/2012/02/from-double-quotes-to-single-quotes.html | |
// Usage: | |
// $ node singlequote.js <input> [output] | |
(function () { | |
'use strict'; | |
var fs = require('fs'), | |
esprima = require('esprima'), | |
input = process.argv[2], | |
output = process.argv[3] || input, |