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 / 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 []
<html>
...
<script>
fetch('/ping')
.then((response) => response.json())
.then((data) => {
console.log('pong', data);
});
</script>
@antishok
antishok / generate.py
Created November 11, 2017 00:08
keras stateful lstm
import numpy as np
import sys
from keras.models import Sequential
from keras.layers import Dense, Dropout, LSTM, Embedding, Lambda, Activation
from keras.layers.wrappers import TimeDistributed
from keras import backend as K
filepath = 'input.txt'
weights_file = 'model.best.h5'
@antishok
antishok / generate.py
Last active November 17, 2017 17:20
keras stateful lstm - word-level rnn
import numpy as np
import sys
from keras.models import Sequential
from keras.layers import Dense, LSTM, Embedding, Activation
from keras.layers.wrappers import TimeDistributed
from keras import backend as K
from utils import Data, weighted_sample
@antishok
antishok / scenaric-sf-package-post-install.md
Created November 21, 2017 22:59
Scenaric salesforce package post-install instructions

Before using the Scenaric Salesforce app, the administrator must authorize use of the app for certain profiles, users, or permission sets.

To achieve this, we recommend the following steps:

  • In Setup, go to Manage Apps -> Connected Apps
  • Click "Edit" next to "ScenaricCanvas" app
  • Change the "Permitted Users" setting to "Admin approved users are pre-authorized"
  • Ignore the warning, then click Save
  • Click the ScenaricCanvas app, then scroll down and click "Manage Profiles"
  • Select for example "System Administrator" and "Standard User", and click Save