Skip to content

Instantly share code, notes, and snippets.

@rclark
rclark / TileLayer.Bing.js
Created March 11, 2012 16:50 — forked from pagameba/TileLayer.Bing.js
Leaflet Bing layer
L.TileLayer.Bing = L.TileLayer.extend({
supportedTypes: ['Road', 'Aerial', 'AerialWithLabels'],
attributionTemplate: '<span style="display:inline-block">' +
'<a target="_blank" href="http://www.bing.com/maps/">' +
'<img src="{logo}" /></a><br><span>{copyrights}' +
'<a style="white-space: nowrap" target="_blank" '+
'href="http://www.microsoft.com/maps/product/terms.html">' +
'Terms of Use</a></span></span>',
@Tomalak
Tomalak / jquery-tablesorter-textextractor.js
Created July 6, 2012 17:11
A custom textExtraction function for jQuery tablesorter that allows better sorting for accented characters and dates in dd.mm.yyyy format. Primarily targeted at German text; might work well for other languages.
// Details: StackOverflow (http://stackoverflow.com/a/614397/18771)
// License: cc-by-sa (http://creativecommons.org/licenses/by-sa/3.0/)
// Extends: jQuery Tablesorter 2.0+ (http://tablesorter.com)
// -------------------------------------------------------------------
// file encoding must be UTF-8!
function getTextExtractor()
{
return (function() {
var patternLetters = /[öäüÖÄÜáàâéèêúùûóòôÁÀÂÉÈÊÚÙÛÓÒÔß]/g;
@RandomEtc
RandomEtc / convert.js
Created October 26, 2012 01:13
Simplify GeoJSON using d3-plugins/simplify (thanks @jasondavies for preserving topology!)
// TODO: options parser with overrides for projection, area etc.
if (process.argv.length != 4) {
console.error("usage: node convert.js <input.json> <output.json>");
process.exit(1);
}
require('d3')
require('./node_modules/d3-plugins/simplify/simplify.js')
var fs = require('fs');
@carlbergman
carlbergman / Code.gs
Created July 16, 2015 09:38
Get filtered/non-filtered values from Google Sheet with Google Apps Script
/**
* Get values in range
*
* @param {String} rangeA1 The range in A1 notation
*
* @return {Array} array with non-filtered values
*/
function getValues (rangeA1) {
// Get range
@gurdiga
gurdiga / minify-js.sh
Created November 25, 2012 13:34
JS minifying script with curl and Closure Compiler REST API
#!/bin/sh
# Use like this:
#
# minify-js.sh < app.js > app.min.js
#
curl -s \
-d compilation_level=SIMPLE_OPTIMIZATIONS \
-d output_format=text \
@karlkranich
karlkranich / apitest.php
Last active July 17, 2018 14:49
Updated PHP code to use the Google Sheets API. See usage instructions at http://karl.kranich.org/2015/04/16/google-sheets-api-php/ More examples at https://gist.github.com/karlkranich/afa39e3d778455b38c38
<?php
// apitest.php
// by Karl Kranich - karl.kranich.org
// version 3.1 - edited query section
require_once realpath(dirname(__FILE__) . '/vendor/autoload.php');
include_once "google-api-php-client/examples/templates/base.php";
$client = new Google_Client();
@MikeRogers0
MikeRogers0 / weather-class.inc.php
Created June 16, 2012 17:04
Getting the Weather in PHP
<?php
class Weather {
 public $lat, $long, $weather, $location;
 private $weather_data, $location_data;

 public function __construct($lat=0.0, $long=0.0){
  $this->lat = (float) $lat;
  $this->long = (float) $long;
 }

@phpfiddle
phpfiddle / fiddle_053877.php
Created September 18, 2019 15:24
[ Posted by Expangea ] PHP preg_match_all xml tags
<?php
$text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. <code>Donec sed erat</code> vel diam ultricies commodo.
Nunc venenatis tellus eu quam suscipit quis fermentum <code>dolor vehicula.</code> fin";
$regex='';
$regex = '#<\s*?code\b[^>]*>(.*?)</code\b[^>]*>#s';
$code = preg_match_all($regex, $text, $matches);
echo $text."<hr>";
echo var_export($matches,true);
?>
@reinvented
reinvented / camino-with-waypoints.geojson
Last active April 27, 2020 19:18
Camino Frances walking route with overnight waypoints
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pinceladasdaweb
pinceladasdaweb / imgur.js
Created March 27, 2014 13:14
Upload images to imgur via JavaScript
/*
--------------------------------
imgur Upload
--------------------------------
+ https://github.com/pinceladasdaweb/imgur-upload
+ version 1.1
+ Copyright 2014 Pedro Rogerio
+ Licensed under the MIT license
+ Documentation: https://github.com/pinceladasdaweb/imgur-upload