by Angel Leon. March 17, 2015;
Last update on December 14, 2023
Updated on February 27, 2023
Updated August 29, 2019.
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="viewport" content="initial-scale=1.0, user-scalable=no"> | |
<meta charset="UTF-8"> | |
<title>Drawing Tools</title> | |
<script type="text/javascript" | |
src="http://maps.google.com/maps/api/js?sensor=false&libraries=drawing"></script> | |
<style type="text/css"> | |
#map, html, body { |
CREATE OR REPLACE FUNCTION generate_object_id() RETURNS varchar AS $$ | |
DECLARE | |
time_component bigint; | |
machine_id int := FLOOR(random() * 16777215); | |
process_id int; | |
seq_id bigint := FLOOR(random() * 16777215); | |
result varchar:= ''; | |
BEGIN | |
SELECT FLOOR(EXTRACT(EPOCH FROM clock_timestamp())) INTO time_component; | |
SELECT pg_backend_pid() INTO process_id; |
#!/usr/bin/env python | |
import os | |
import pprint | |
import subprocess | |
import sys | |
from optparse import make_option | |
from urllib import quote_plus | |
from urlparse import urljoin | |
import dateutil.parser |
#WIP
Last updated: Wednesday, April 6
This is a quick primer for the cool 1.8.9 kids. Knowledge of 1.8.9 assumed.
<?php | |
// composer require ramsey/uuid moontoast/math | |
require_once 'vendor/autoload.php'; | |
use Ramsey\Uuid\Codec\OrderedTimeCodec; | |
use Ramsey\Uuid\Codec\TimestampFirstCombCodec; | |
use Ramsey\Uuid\Generator\CombGenerator; | |
use Ramsey\Uuid\UuidFactory; |
FROM alpine | |
RUN apk add --update --no-cache nodejs | |
RUN npm i -g yarn | |
ADD package.json yarn.lock /tmp/ | |
ADD .yarn-cache.tgz / | |
RUN cd /tmp && yarn | |
RUN mkdir -p /service && cd /service && ln -s /tmp/node_modules |
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:
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.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.uuid
, specifically the uuid.v4()
method. Avoid node-uuid
- it's not the same package, and doesn't produce reliably secure random values.random-number-csprng
.You should seriously consider reading the entire article, though - it's
defmodule Absinthe.Ecto.Resolution.Schema do | |
@moduledoc """ | |
This module provides helper functions to resolve a GraphQL query into `Ecto.Query`. | |
""" | |
import Absinthe.Resolution.Helpers | |
import Ecto.Query | |
alias Absinthe.Resolution | |
alias Absinthe.Blueprint.Document.Field | |
let relayStore; | |
function relayCreateStore() { | |
const env = new Relay.Environment(); | |
env.injectNetworkLayer(new Relay.DefaultNetworkLayer('/graphql')); | |
if (__DEV__) { | |
RelayNetworkDebug.init(env); | |
} | |
env.reset = () => relayCreateStore(); | |
env.mutate = ({ | |
query, |