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 / jsbin.xaruj.css
Created June 10, 2014 15:05
anchor hover animation effect. http://jsbin.com/xaruj/70/
body {
font: 16px/1 sans-serif;
margin: 0;
background-color: #fefefe;
}
nav a {
font: 0/0 Tahoma;
text-align: center;
text-decoration: none;
@valerysntx
valerysntx / TemplifyExtensions
Created August 29, 2014 09:14
String extension method for class-based token replacement on strings, using reflection on class properties
public static string TemplifyWith<T>(this string templatedString, T obj, string tokenFormat = "[{0}]")
{
var result = templatedString;
var type = typeof(T);
foreach (var propertyInfo in type.GetProperties())
{
var token = string.Format(tokenFormat, propertyInfo.Name);
@valerysntx
valerysntx / RazorScriptBlock.cs
Created August 29, 2014 09:30
Script Block Templated Delegate for Inline Scripts in Razor Partials
private const string SCRIPTBLOCK_BUILDER = "ScriptBlockBuilder";
public static MvcHtmlString ScriptBlock(this WebViewPage webPage,
Func<dynamic, HelperResult> template)
{
if (!webPage.IsAjax)
{
var scriptBuilder = webPage.Context.Items[SCRIPTBLOCK_BUILDER]
as StringBuilder ?? new StringBuilder();
.box
.btn
@valerysntx
valerysntx / webstack.install.cmd
Created September 23, 2014 16:09
webstack windows install
powershell -Command "Set-ExecutionPolicy unrestricted"
powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin
choco install sublime
choco install nodejs.commandline
choco install npm
choco install yeoman
powershell -Command "New-Item -path $profile file -force"
powershell -Command "write "Set-Alias subl 'C:\Program Files\Sublime Text 2\sublime_text.exe'" " >$profile
@powershell -Command "subl"
@valerysntx
valerysntx / templify-bind.html
Last active August 29, 2015 14:06 — forked from vmysla/gist:f33a50f802c1e8a8c45f
templifyed data binding example
<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+'\\]');