Skip to content

Instantly share code, notes, and snippets.

Giorgio Arata garata

Block or report user

Report or block garata

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Interface.js
/**
* Simple implementation of interfaces in JavaScript
*
* @description
*
* Advantages of interfaces:
* + Self-documenting
* + Encapsulation
* + Code reuse
*
@garata
garata / tryjsil.cs
Created Dec 21, 2017
JSIL 1051 issue
View tryjsil.cs
using System;
using JSIL;
using JSIL.Meta;
class Class1
{
public Class1()
{
Delegate d = new Action<int>(
(int someVar) =>
View Anchor-Smooth-Page-Scroll.markdown

Anchor Smooth Page Scroll

This is a quick way to make even the simple act of scrolling up and down a page more visually appealing. Check this PEN to see Smoothy script in action, and then keep reading to learn how to add Smooth Scroll to your website.

So lets start with the basics. To add an anchor on your page add the following in the place that you would like your page scroll to.

<a id="bottom"></a>

Then to point your link at this anchor, on the same page use one of the following.

@garata
garata / roundup10s.js
Created Jul 25, 2014
Round up a number to the nearest tens
View roundup10s.js
Math.roundUp10s = (function(m) {
var ln10 = (m.LN10 || m.log(10));
// (C) Giorgio Arata - DO WHAT YOU WANT LICENSE
return function roundUp10s(value) {
var length, power, isNeg;
if (isNeg = (value < 0))
value = Math.abs(value);
length = m.floor((m.log(value) / ln10) + 1.0) - 1;
power = m.pow(10, length);
return (isNeg ? -1 : 1) * m.ceil((value) / power) * power;
@garata
garata / tryjsil.cs
Created Jul 23, 2014
C# Dispatch table based on "Generic Dictionary", "Collection Initializer" and "Lambda Expressions"
View tryjsil.cs
using System;
using System.Linq;
using System.Collections.Generic;
public class Program
{
static void Main()
{
Func<int, bool> Default = (x => true);
@garata
garata / ie-xml5633-monkeypatch.js
Created Jun 15, 2014
An Internet Explorer specific snippet useful on MS IE9 and above when XML5633 error message is shown in the Dev Tool console: "XML5633: End-tag name does not match the corresponding start-tag name".
View ie-xml5633-monkeypatch.js
/*@cc_on
@if (@_jscript_version >= 9)
// (C) Giorgio Arata - Mit Style License.
(typeof DOMParser === "function") && !function(dp) {
var TEXT_SE = "[^<]+",
TILL_HYPHEN = "[^-]*-",
TILL_HYPHEN2 = TILL_HYPHEN + "([^-]" + TILL_HYPHEN + ")*-",
COMMENT_CE = TILL_HYPHEN2 + ">?",
TILL_RSB = "[^]]*]([^]]+])*]+",
CDATA_CE = TILL_RSB + "([^]>]" + TILL_RSB + ")*>",
You can’t perform that action at this time.