Skip to content

Instantly share code, notes, and snippets.

View R2D221's full-sized avatar
🤔
Pondering

Arturo Torres Sánchez R2D221

🤔
Pondering
View GitHub Profile
@beccasaurus
beccasaurus / README.markdown
Created May 5, 2011 19:37
Adds hooks to jQuery.validate's form/element validation methods (via trigger())

jQuery Validate Hooks

If you're using [ASP.NET MVC3][], it uses [jQuery Validate][] to do client-side validations. Instead of using [jQuery Validate][] directly, however, it wraps it with its own jQuery plugin called [jQuery.Validate.Unobtrusive][]. [jQuery.Validate.Unobtrusive][] sets up [jQuery Validate][] for you, behind the scenes, so you don't have an opportunity to customize your [jQuery Validate][] settings at all!

We've been running into trouble with this when we've been doing our own custom client-side validations. We need a way to integrate with the build-in [ASP.NET MVC3][] validation so we can:

@brianlow
brianlow / FindConflictingReferences.cs
Created January 3, 2012 03:04
Find conflicting assembly references
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using NUnit.Framework;
namespace MyProject
{
[TestFixture]
@josheinstein
josheinstein / RemoveWhere.cs
Created July 11, 2012 20:12
RemoveWhere Extension Method
/// <summary>
/// Modifies a collection in-place by removing items from the collection that match
/// a given <see cref="T:Predicate[T]"/>.
/// </summary>
/// <remarks>
/// The type of collection passed in will affect how the method performs. For collections
/// with a built-in method to remove in-place (such as sets) the existing implementation
/// will be used. For collections implementing IList[T], the method will perform better
/// because the collection can be enumerated more efficiently. For all other collections,
/// the items to remove will be buffered and Remove will be called individually which,
@Warry
Warry / Article.md
Created December 11, 2012 00:11
How to make faster scroll effects?

How to make faster scroll effects?

  • Avoid too many reflows (the browser to recalculate everything)
  • Use advanced CSS3 for graphic card rendering
  • Precalculate sizes and positions

Beware of reflows

The reflow appens as many times as there are frames per seconds. It recalculate all positions that change in order to diplay them. Basically, when you scroll you execute a function where you move things between two reflows. But there are functions that triggers reflows such as jQuery offset, scroll... So there are two things to take care about when you dynamically change objects in javascript to avoid too many reflows:

@alwerner
alwerner / retroactively add items to .gitignore
Last active March 21, 2022 23:14
retroactively add items to .gitignore
// make change to .gitignore
git rm --cached <filename>
// or, for all files
git rm -r --cached .
git add .
// then
@tschneidereit
tschneidereit / iterable-weak-key-map.js
Created November 3, 2013 21:15
Iterable WeakMap implemented using Weak References
function IterableWeakKeyMap() {
const keyMap = new WeakMap();
const refValueMap = new Map();
return Object.freeze({
get: function(key) {
const entry = keyMap.get(key);
return entry && entry.value;
},
set: function(key, value) {
const ref = makeWeakRef(key);
@chrisbanes
chrisbanes / SystemUiHelper.java
Last active March 2, 2024 18:57
SystemUiHelper
/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@sdennler
sdennler / A Sad Web App Notifier
Last active March 24, 2020 10:28
Bring the necessary Desktop Notification to Outlook Web App.
Bring the necessary Desktop Notification to Outlook Web App.
@dsdsdsdsdsds
dsdsdsdsdsds / cursor.css
Last active November 1, 2023 11:45
CSS: Cross Browser hires/retina cursor image
.cursor {
cursor: url("cursor.png") 0 0, pointer; /* Legacy */
cursor: url("cursor.svg") 0 0, pointer; /* FF */
cursor: -webkit-image-set(url("cursor.png") 1x, url("cursor@2x.png") 2x) 0 0, pointer; /* Webkit */
}
@istupakov
istupakov / ShuntingYardParser.cs
Created September 29, 2016 18:39
C# realization of Shunting-yard algorithm
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace ShuntingYardParser
{
enum TokenType { Number, Variable, Function, Parenthesis, Operator, Comma, WhiteSpace };