Skip to content

Instantly share code, notes, and snippets.

View yoichiro-manabe's full-sized avatar
🌿
ケムリクサいいですね

Yoichiro Manabe yoichiro-manabe

🌿
ケムリクサいいですね
  • beaglesoft LLC
  • Japan
View GitHub Profile

PDF Make Definitions

A list of all the properties for the Document Definition objects in PDF Make. Gathered from the examples source code. Up to date for version 0.1.38.

Basic definition

  • The Document Definition is a javascript object: {}. It can contain the following.
  • content: array. This defines the layout of your document. All your tags will be defined in there. You define tags using object (e.g. content: [{text: 'Hello World'}])
  • styles: object. A dictionary of all the named styles in your document. You can then apply a style to any object using style: 'name' or style: ['name1', 'name2']
  • defaultStyle: object. Defines a style to be applied to every element in the document.
  • images: object. Another dictionary that you can use to specify all the images in your document.
@joepie91
joepie91 / random.md
Last active April 10, 2024 18:45
Secure random values (in Node.js)

Not all random values are created equal - for security-related code, you need a specific kind of random value.

A summary of this article, if you don't want to read the entire thing:

  • Don't use Math.random(). There are extremely few cases where Math.random() is the right answer. Don't use it, unless you've read this entire article, and determined that it's necessary for your case.
  • Don't use crypto.getRandomBytes directly. While it's a CSPRNG, it's easy to bias the result when 'transforming' it, such that the output becomes more predictable.
  • If you want to generate random tokens or API keys: Use uuid, specifically the uuid.v4() method. Avoid node-uuid - it's not the same package, and doesn't produce reliably secure random values.
  • If you want to generate random numbers in a range: Use random-number-csprng.

You should seriously consider reading the entire article, though - it's

#!/bin/bash
#
# Script to setup a Elastic Beanstalk AMI with geospatial libraries and postGIS
#
# sh aws_ami_prep.sh > aws_ami_prep.log 2>&1 &
# Go to ec2-user home directory
cd /home/ec2-user
# yum libraries
@tugberkugurlu
tugberkugurlu / gist:3848723
Created October 7, 2012 15:50 — forked from benfoster/gist:3848715
Adding IServiceProvider to ValidationContext in ASP.NET MVC
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
/* usual sh** ommitted for brevity */
var resolver = new CustomDependencyResolver();
DependencyResolver.SetResolver(resolver);
DataAnnotationsModelValidatorProvider.RegisterDefaultAdapterFactory(
@comp615
comp615 / leaflet_numbered_markers.css
Created April 2, 2012 23:51
Numbered Markers in Leaflet (JS Mapping)
.leaflet-div-icon {
background: transparent;
border: none;
}
.leaflet-marker-icon .number{
position: relative;
top: -37px;
font-size: 12px;
width: 25px;