Skip to content

Instantly share code, notes, and snippets.

<!-- JSFiddle: http://jsfiddle.net/antishok/pDc7L/2/ -->
<input id="i" data-bind="ipAddress: ip" />
<br>
<input data-bind="value: ip">
@antishok
antishok / jqmobile-orientationchange.js
Created January 26, 2016 13:30
jqmobile orientationchange
(function($, undefined) {
$.extend($.support, {
orientation: "orientation" in window && "onorientationchange" in window
});
}(jQuery));
// throttled resize event
(function($) {
$.event.special.throttledresize = {
beforeShowDay: function(date) {
var enabled = disabledDates.every(function(disabledDate){
var from = new Date(disabledDate['from']);
var to = new Date(disabledDate['to']);
from.setHours(0);
from.setMinutes(0);
from.setSeconds(0);
to.setHours(23);
@antishok
antishok / client.js
Created April 21, 2016 21:50
bhttp + multer
var stream = require('stream');
var bhttp = require('bhttp');
var Promise = require('bluebird');
Promise.try(function() {
return bhttp.get('http://www.pdf995.com/samples/pdf.pdf');
}).then(function(response) {
var bufferStream = new stream.PassThrough();
bufferStream.end(response.body);
var data = {
@antishok
antishok / chrome-debug.log
Last active September 10, 2016 13:52
connect-session-knex issue
Listening on port 3000
express:router dispatching GET /increment +6s
express:router query : /increment +3ms
express:router expressInit : /increment +1ms
express:router session : /increment +2ms
express-session fetching 9uxMmBYUXEWSBRlZH2f8j0X3IH4eYFyb +5ms
express-session session found +8ms
express-session saving 9uxMmBYUXEWSBRlZH2f8j0X3IH4eYFyb +8ms
express-session split response +1ms
express:router dispatching GET / +9ms
@antishok
antishok / auth-popup-callback.html
Last active May 20, 2023 09:23
passport popup login
<!doctype html>
<html>
<head><title>Log-In</title></head>
<script>
if (window.opener) {
window.opener.postMessage("popup-done", "*");
setTimeout(function() { window.close() }, 0);
}
</script>
</head>
@antishok
antishok / NODE_ENV production.md
Last active September 25, 2020 07:09
What does `NODE_ENV=production` do?
@antishok
antishok / tensorflow 101.md
Last active July 25, 2017 23:36
tensorflow 101

Node types:

  • constants (no inputs, outputs a value it stores internally) tf.constant(3.0)
  • operations (inputs to outputs) tf.add(node1, node2) or node1 + node2
  • (Variables and placeholders are operations too. For variables, an 'assign' op might also be created for assigning the initial value)

Tensor shapes:

3 # a rank 0 tensor; this is a scalar with shape []
@antishok
antishok / char-rnn-keras-train.py
Last active December 11, 2017 09:06
keras char-rnn
import sys
import numpy as np
from keras.models import Sequential, load_model
from keras.layers import Dense, Activation, Dropout, LSTM, Embedding, Lambda
from keras import optimizers
from keras import backend as K
from keras.callbacks import ModelCheckpoint
filepath = 'input.txt'
seq_len = 80
<html>
...
<script>
fetch('/ping')
.then((response) => response.json())
.then((data) => {
console.log('pong', data);
});
</script>