Skip to content

Instantly share code, notes, and snippets.

View snowattitudes's full-sized avatar

Mohd Zaki Zakaria snowattitudes

View GitHub Profile
@snowattitudes
snowattitudes / TokenValidator.cs
Created February 8, 2017 06:11 — forked from anonymous/TokenValidator.cs
Validate JSON Web Token (JWT) With .NET JWT Library
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IdentityModel.Tokens;
using System.Linq;
using System.Net.Http;
using System.Security.Cryptography.X509Certificates;
using System.Text;
@snowattitudes
snowattitudes / gist:78a682b24d8748b08625c281dac1165b
Created December 27, 2016 16:27
Javascript Inherits from NodeJS
function inherits(ctor, superCtor) {
ctor.super_ = superCtor;
ctor.prototype = Object.create(superCtor.prototype, {
constructor: {
value: ctor,
enumerable: false,
writable: true,
configurable
}
requirejs.config({
paths: {
"dropboxchooser": ["https://www.dropbox.com/static/api/2/dropins"]
},
//Remember: only use shim config for non-AMD scripts,
//scripts that do not already call define(). The shim
//config will not work correctly if used on AMD scripts,
//in particular, the exports and init config will not
//be triggered, and the deps config will be confusing
//for those cases.
@snowattitudes
snowattitudes / !README.md
Created August 8, 2016 10:25 — forked from L422Y/!README.md
Dynamic, Responsive font-sizes and spacing using em units and JavaScript

Dynamic responsive font-sizing is something I see missing on many “responsive” websites. Breakpoints are nice but I have better things to do with my time than defining infinite font-size adjustments. (so do you!)

To implement this, we’re going to take advantage of the em font sizing unit in CSS.

Click here to see what I'm talking about: codepen.io/lawrencealan/full/eJqlu

Text sizing using the em unit

A single em is equal to the current font-size of the closest parent which has a font-size set.

{
"require": {
"guzzlehttp/guzzle": "~5.0",
"commerceguys/guzzle-oauth2-plugin": "~2.0"
}
}
@snowattitudes
snowattitudes / BinaryMediaTypeFormatter
Last active August 29, 2015 14:25 — forked from aliostad/BinaryMediaTypeFormatter
An ASP.NET Web API media type formatter for application/octet-stream
public class BinaryMediaTypeFormatter : MediaTypeFormatter
{
private static Type _supportedType = typeof (byte[]);
private bool _isAsync = false;
public BinaryMediaTypeFormatter() : this(false)
{
}
<html>
<head>
<script type="text/javascript" src="http://canvg.googlecode.com/svn/trunk/rgbcolor.js"></script>
<script type="text/javascript" src="http://canvg.googlecode.com/svn/trunk/canvg.js"></script>
<script>
function getImgData(chartContainer) {
var chartArea = chartContainer.getElementsByTagName('svg')[0].parentNode;
var svg = chartArea.innerHTML;
var doc = chartContainer.ownerDocument;
var canvas = doc.createElement('canvas');