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
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.1.js"></script>
<script>
(function Templify(undefined) {
var models = {};
function replace(template, pattern, value){
var expression = new RegExp('\\['+pattern+'\\]');
@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 / viewmodelbase.js
Last active September 15, 2015 02:23
ViewModelBase observable properties wrapper class
(function(ko){
ko.ViewModel = function ViewModel(){
Object.getOwnPropertyNames(this)
.map(name => ({
name,
desc: Object.getOwnPropertyDescriptor(this, name)
}))
.filter(o => o.desc.configurable)
.forEach(o => {
@koenbollen
koenbollen / SimpleConsole.cs
Created April 26, 2011 12:23
A simple line based game console for XNA.
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
@bsatrom
bsatrom / addSpeaker-brief.html
Created July 1, 2011 20:07
Moving from markup-based KnockoutJS bindings to unobtrusive bindings (After)
<form id="addSpeaker">
<fieldset>
<legend>Speaker Info</legend>
Name: <input type="text" id="name" /> <br />
Bio: <textarea id="bio"></textarea> <br />
Twitter Handle: <input type="text" id="twitterHandle" /> <br />
State: <input type="text" id="state" /> <br />
Photo Url: <input type="text" id="photoUrl" />
</fieldset>
<fieldset>
@vmysla
vmysla / gist:5316941
Last active December 15, 2015 20:09
// Subject: Complex object with set of properties and inner objectss
// Mission: Describe fluent DSL to define scheme and delegate action execution
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Text.RegularExpressions;