Instantly share code, notes, and snippets.

View wtf.js
/* VT100 terminal reset (<ESC>c) */
console.log('\033c');
/* numbers comparations */
> '2' == 2
true
> '2' === 2
@supereggbert
supereggbert / index.html
Last active Feb 7, 2019
3D Surface Plot in D3.js
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
body{
font-family: sans;
padding: 10px;
}
svg path{
@benburry
benburry / echo.py
Last active Nov 15, 2018
Python 2 - mock & unittest example for Popen
View echo.py
from subprocess import Popen, PIPE
def shell_out(command):
return Popen(command.split(' '), stdout=PIPE,stderr=PIPE).communicate()[0].strip('\n').split('\n')
def main():
return shell_out('echo one\ntwo\nthree\n')
@lost-theory
lost-theory / gist:3925738
Created Oct 21, 2012
different delimiters in jinja2 + flask
View gist:3925738
from flask import Flask, render_template_string, request
class CustomFlask(Flask):
jinja_options = Flask.jinja_options.copy()
jinja_options.update(dict(
block_start_string='<%',
block_end_string='%>',
variable_start_string='%%',
variable_end_string='%%',
comment_start_string='<#',
@marcoarment
marcoarment / Bcrypt.php
Created Jun 29, 2011
Simple PHP 5.3+ Bcrypt class and functions
View Bcrypt.php
<?php
/*
By Marco Arment <me@marco.org>.
This code is released in the public domain.
THERE IS ABSOLUTELY NO WARRANTY.
Usage example:
// In a registration or password-change form:
@DataWraith
DataWraith / Neural_Net_demo.rb
Created Jul 1, 2010
Example of a _very_ simple feed-forward neural network.
View Neural_Net_demo.rb
class Link
def initialize(to, weight)
@to = to
@weight = weight
end
def propagate(activation)
puts " propagating #{activation} * #{@weight} = #{@weight * activation} to #{@to.name}"
puts " old activation: #{@to.activation}"