Skip to content

Instantly share code, notes, and snippets.

View ca0v's full-sized avatar

Corey Alix ca0v

  • Greenville, SC
View GitHub Profile
@nickscript0
nickscript0 / date-fns-migrate.js
Last active October 2, 2021 02:33
How to migrate from moment.js to date-fns (as the package is way smaller)
/**
* date-fns v2 is still in alpha, but has built-in Typescript support so best to use it:
* Docs: https://date-fns.org/v2.0.0-alpha.16/docs/Getting-Started
*
* npm install --save date-fns@next
*/
// Useful functions to import
import { formatDistanceStrict, isAfter, isBefore, format, subDays, isSameDay } from 'date-fns';
@arguiot
arguiot / xorcipher.js
Created October 30, 2017 14:31
XOR Cipher encryption in JavaScript
const XORCipher = {
encode(key, data) {
data = xor_encrypt(key, new String(data).split(""));
return b64_encode(data);
},
decode(key, data) {
data = b64_decode(data);
return xor_decrypt(key, new String(data).split(""));
}
};
@SKalt
SKalt / Wfs-T-2-examples.md
Last active September 19, 2023 09:21
WFS-T 2.0.0 example requests

WFS-T 2.0.0 examples

Here I've translated the geoserver Web Feature Service Transactions (WFS-T) 1.0.0 examples into WFS-T 2.0.0 xml. All of these have been verified to work on geoserver 2.11.

Additional resources

action docs examples
delete docs examples
insert docs examples
replace docs example
update docs examples
@hrbrmstr
hrbrmstr / continents.json
Created January 22, 2015 01:01
Continents GeoJSON
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@RhysC
RhysC / CSharpObjectDefinition.cs
Created October 31, 2014 02:55
Code generator from JSON Schema - swap out the impl of ObjectDef to write, view model, dtos etc
using System;
using System.Linq;
using System.Text;
using Newtonsoft.Json.Schema;
namespace JsonSchemaToCode
{
public class CSharpObjectDefinition : ObjectDefinition
{
public override string ToString()
@mkropat
mkropat / jquery-then-vs-done.html
Last active October 25, 2016 22:01
A study in jQuery deferreds, based on Lu4's answer to “jQuery deferreds and promises - .then() vs .done()”.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>jQuery deferreds and promises - .then() vs .done()</title>
<link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-git.css">
</head>
<body>
<p>
A study in jQuery deferreds, based on <em>Lu4's</em> <a
@ca0v
ca0v / ogc.d.ts
Last active December 30, 2015 16:19
First shot at describing OGC interfaces in json
// converted from ol readers
declare module ogc {
module wms {
export interface ContactPersonPrimary {
ContactPerson: string;
ContactOrganization: string;
}
@michielvaneerd
michielvaneerd / Backbone and JSONP
Last active November 4, 2021 16:27
Fetching a Backbone collection with JSONP is really simple. It turns out you only need to override the sync method (to set the dataType to jsonp). In this case I also had to override the parse method, because the response consists of more than the models. This example uses the Discogs API to search for artists.
var Artist = Backbone.Model.extend();
var Artists = Backbone.Collection.extend({
model : Artist,
url : "http://api.discogs.com/database/search?type=artist",
sync : function(method, collection, options) {
// By setting the dataType to "jsonp", jQuery creates a function
// and adds it as a callback parameter to the request, e.g.:
// [url]&callback=jQuery19104472605645155031_1373700330157&q=bananarama
// If you want another name for the callback, also specify the
@wildmichael
wildmichael / README.md
Created March 1, 2013 11:24
superscript test

This is some superscript text.

@mateuszkocz
mateuszkocz / 3d-ball.css
Last active January 22, 2022 23:32
3D ball with CSS radial-gradient
#ball {
width: 300px;
height: 300px; border-radius: 150px;
background-color: blue;
background-image: radial-gradient(circle 400px at 0 0, rgba(0,0,0,0), rgba(0,0,0,0), rgba(0,0,0,.8)), radial-gradient(circle 180px at 90px 80px, rgba(255,255,255,.7), rgba(0,0,0,0));
background-repeat: no-repeat, no-repeat;
position:relative;
}
#ball:after {