Skip to content

Instantly share code, notes, and snippets.

Iristyle /
Last active Aug 16, 2019
Encoding in Puppet

Basic encoding info

  • ASCII is 0 - 7F (128 total characters) - ASCII is a subset of UTF-8
  • UTF-8 - variable width 1 to 4 bytes
Numberof bytes Bits forcode point Firstcode point Lastcode point Byte 1 Byte 2 Byte 3 Byte 4
1 7 U+0000 U+007F 0xxxxxxx      
2 11 U+0080 U+07FF 110xxxxx 10xxxxxx    
3 16 U+0800 U+FFFF 1110xxxx 10xxxxxx 10xxxxxx  
stanislaw / utf8.c
Created Nov 19, 2015
Some C functions to work with UTF-8 string : you can check if a string is valid UTF-8, get the length of a UTF-8 string and replace things in a UTF-8 string. All `char *` arguments must be regular, null-byte terminated, C strings. I've tried to optimize the best I could. I'd be grateful for any suggestions or improvements. Please note I have onl…
View utf8.c
// utf8.c
// training
// Created by Conrad Kleinespel on 5/27/13.
// Copyright (c) 2013 Conrad Kleinespel. All rights reserved.
#include <stdio.h>
#include <stdlib.h>
sivaprasadreddy / angularjs-filters.html
Created Sep 15, 2014
AngularJS filters final HTML
View angularjs-filters.html
<!DOCTYPE html>
<html ng-app="myApp">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>My AngularJS App</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="//" rel="stylesheet" type="text/css"/>
ssmiech /
Last active Aug 29, 2015
How to read text from hidden divs
package selenium;
import java.sql.Driver;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
View DocGist Example.adoc

DocGist Example

DocGist is a tool that renders AsciiDoc documents fetched from GitHub gists or other sources. The rendering is performed in the browser using the asciidoctor.js library. The original use case for this was which has additional features to create examples for the Neo4j graph database.

How To Use

khris /
Created Jan 18, 2014
Alternative OAuth 1 implements for Twitter's hbc. It's compatible with joauth 6.0.+ so independent from Scala.
* Original:
* It is compatible with scala-less joauth 6.0.+, but hbc is not
* compatible with Android. #EpicFail
* Licensed under the Apache License, Version 2.0 (the "License");
danharper / background.js
Last active Jun 30, 2020
Bare minimum Chrome extension to inject a JS file into the given page when you click on the browser action icon. The script then inserts a new div into the DOM.
View background.js
// this is the background code...
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
chrome.tabs.executeScript(tab.ib, {
file: 'inject.js'
View .gitignore
esfand /
Last active Dec 23, 2015
UAA Security Features and Configuration

UAA Features and Configuration

It is the responsibility of a Resource Server to extract information about the user and client application from the access token and make an access decision based on that information.

This guide will help authors of resource Servers and maintainers of client and user account data to understand the range of information available and the kinds of decisions that can be taken.

danveloper /
Created Apr 16, 2013
Java 8 CompletableFuture (Promise) and Lambda example
public class Promises {
private static class PageMetrics {
Integer visits;
Long avgMsOnPage;
public String toString() {
return String.format("{ avgMsOnPage=%d, visits=%d }", avgMsOnPage, visits);
You can’t perform that action at this time.