Skip to content

Instantly share code, notes, and snippets.

View valerysntx's full-sized avatar
🔋
99%

valery sntx valerysntx

🔋
99%
  • Ukraine, Uzhgorod
View GitHub Profile
@valerysntx
valerysntx / example.html
Last active August 29, 2015 14:09 — forked from joelnet/example.html
jquery.unobtrusive-knockout.js
Choose a ticket class: <select id="tickets"></select>
<p id="ticketOutput"></p>
<script id="ticketTemplate" type="text/x-jquery-tmpl">
{{if chosenTicket}}
You have chosen <b>${ chosenTicket().name }</b>
($${ chosenTicket().price })
<button data-bind="click: resetTicket">Clear</button>
{{/if}}
(function(knockout){
var knockoutElementMapping = function(knockoutElement, dataElement)
{
if(typeof(knockoutElement.mergeConstructor) == "undefined")
{
if (!knockout.isComputed(knockoutElement))
{
if(knockoutElement.mergeMethod)
{ knockoutElement.mergeMethod(knockoutElement, dataElement); }
define(['jquery', 'knockout', 'knockout.mapping', 'knockout.validation'],
function ($, ko) {
/** The module. */
var self = {};
/** The knockout view model. */
self.viewModel = {};
/** The knockout container. */
self.container = null;
@valerysntx
valerysntx / knockoutifyUnderscore.js
Last active August 29, 2015 14:10 — forked from togakangaroo/knockoutifyUnderscore
Underscore functions transparently unwrap knockout observables
//make a limited set of underscore functions transparently unwrap knockout observables
(function knockoutifyUnderscore(_) {
var unwrap = ko.utils.unwrapObservable;
//These can be shimed in a standard way
var koFriendly = ['map', 'filter', 'find', 'each', 'findBy', 'first', 'last', 'head', 'tail', 'union', 'compact', 'flatten', 'difference', 'without'];
var oldMap = _.map;
for (var _i = 0; _i < koFriendly.length; _i++) {
(function(fnName) {
var originalFn = _[fnName];
@valerysntx
valerysntx / frameless-querySelectorAll.js
Created August 20, 2015 19:59 — forked from vmysla/frameless-querySelectorAll.js
Frameless document.querySelectorAll shim
document.querySelectorAll = function(){
var result = [].slice.call( HTMLDocument.prototype.querySelectorAll.apply(document, arguments ) );
for(var i=0; i< frames.length; i++){
try {
var doc = frames[i].document;
result = result.concat( [].slice.call( doc.querySelectorAll.apply(doc, arguments) ) );
} catch(e){}
}
return result;
@valerysntx
valerysntx / websocket.py
Created October 27, 2017 15:40 — forked from julienguigner/websocket.py
Python 3.1 version of python-websocket
"""
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@valerysntx
valerysntx / pbr.glsl
Created December 5, 2017 14:05 — forked from galek/pbr.glsl
PBR GLSL SHADER
in vec2 v_texcoord; // texture coords
in vec3 v_normal; // normal
in vec3 v_binormal; // binormal (for TBN basis calc)
in vec3 v_pos; // pixel view space position
out vec4 color;
layout(std140) uniform Transforms
{
mat4x4 world_matrix; // object's world position
@valerysntx
valerysntx / README.md
Created December 23, 2017 05:59 — forked from bsergean/README.md
offscreen rendering with three.js and headless-gl, in coffee-script

Getting the code

git clone https://gist.github.com/6780d7cc0cabb1b4d6c8.git

Executing the code

$ npm install # maybe npm start will take care of it but just in case
$ npm start && open out.png

> offscreen-sample@1.0.0 start /Users/bsergean/src/offscreen_sample

@valerysntx
valerysntx / demo.html
Created February 11, 2018 19:43 — forked from RichAyotte/demo.html
Performance Comparison for React, Angular and Knockout
<!DOCTYPE html>
<html ng-app="test">
<head>
<title>Performance Comparison for Knockout, Angular and React</title>
<link href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.1/css/bootstrap.css" rel="stylesheet" />
<style type="text/css">
* { box-sizing:border-box; }
body { padding:30px 0; }
h2 { margin:0; margin-bottom:25px; }
h3 { margin:0; padding:0; margin-bottom:12px; }
@valerysntx
valerysntx / Example1.cs
Created August 30, 2018 14:22 — forked from davidfowl/Example1.cs
How .NET Standard relates to .NET Platforms
namespace Analogy
{
/// <summary>
/// This example shows that a library that needs access to target .NET Standard 1.3
/// can only access APIs available in that .NET Standard. Even though similar the APIs exist on .NET
/// Framework 4.5, it implements a version of .NET Standard that isn't compatible with the library.
/// </summary>INetCoreApp10
class Example1
{
public void Net45Application(INetFramework45 platform)