Skip to content

Instantly share code, notes, and snippets.

View sidvishnoi's full-sized avatar

Sid Vishnoi sidvishnoi

View GitHub Profile
@sidvishnoi
sidvishnoi / index.html
Last active November 25, 2020 10:16
ReSpec external definitions without xref
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>
Replace me with a real title
</title>
<script src="https://www.w3.org/Tools/respec/respec-w3c" async class=
"remove"></script>
<script class="remove">
@sidvishnoi
sidvishnoi / print-nsAutoString.cpp
Last active November 11, 2020 13:44
Printing a nsAutoString in Gecko (C++)
nsAutoString myString;
printf("%s\n", NS_ConvertUTF16toUTF8(myString).get());
​console.log("hey");
// There is a space before the first line, which is not renderered by many
// IDEs/text editors.
//
// It bit me once when I copied a snippet from some site, and they added
// (probably accidentally; evil otherwise) a zero-width space before every line
// of code. The code failed to compile saying "unexpected token", but it took me
// quite some time to understand what just happened.
@sidvishnoi
sidvishnoi / bisection.f
Created September 11, 2017 13:36
Bisection method with while loop
program bisection
REAL a, b, c, TOL
INTEGER NMAX, N
WRITE(*, *) "Enter a and b"
READ(*, *) a, b
NMAX = 20
N = 1
TOL = 1.0e-04
@sidvishnoi
sidvishnoi / ubuntu_graphics.sh
Last active April 5, 2017 08:20
Sets up graphics.h for Ubuntu, based on libxbgi
# see the libxbgi project here: http://libxbgi.sourceforge.net/
# #include <graphics.h> in your code
# usage (to compile):
# for gcc, use: ggcc filename.c
# for g++, use: ggpp filename.cpp
# if you want to use delay(int milliseconds) command with g++, create a macro in your source code:
# #define delay(t) sleep(t/1000)
# install dependencies
sudo apt-get install libx11-dev -y