Skip to content

Instantly share code, notes, and snippets.

@Iristyle
Iristyle / encoding.md
Last active April 1, 2022 14:04
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
stanislaw / utf8.c
Created November 19, 2015 23:09
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…
//
// 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
sivaprasadreddy / angularjs-filters.html
Created September 15, 2014 06:28
AngularJS filters final HTML
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<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="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
@ssmiech
ssmiech / invisibleText.java
Last active August 29, 2015 13:57
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;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.Wait;

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 http://gist.neo4j.org/ which has additional features to create examples for the Neo4j graph database.

How To Use

@khris
khris / OAuth1.java
Created January 18, 2014 08:54
Alternative OAuth 1 implements for Twitter's hbc. It's compatible with joauth 6.0.+ so independent from Scala.
/**
* Original: https://github.com/twitter/hbc/blob/master/hbc-core/src/main/java/com/twitter/hbc/httpclient/auth/OAuth1.java
*
* 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
danharper / background.js
Last active March 30, 2024 18:25
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.
// 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'
});
});
@esfand
esfand / .gitignore
Created December 31, 2013 14:00 — forked from dsyer/.gitignore
target/
*/src/main/*/META-INF/
.access_token
.result
.classpath
.project
.DS_Store
.settings/
*.iml
*.iws
@esfand
esfand / 0-UAA-Configuration.md
Last active August 22, 2023 10:44
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
danveloper / Promises.java
Created April 16, 2013 19:40
Java 8 CompletableFuture (Promise) and Lambda example
public class Promises {
private static class PageMetrics {
Integer visits;
Long avgMsOnPage;
@Override
public String toString() {
return String.format("{ avgMsOnPage=%d, visits=%d }", avgMsOnPage, visits);
}