Skip to content

Instantly share code, notes, and snippets.

@iamjpg
iamjpg / toast.js
Created May 30, 2019 01:01
Vitruvius Toast Signature
import Toast from 'path_to_toast_js';
let toast = new Toast();
toast.show({
type: 'success',
header: 'This is a Header',
message: 'This toast was created with the "removeIn" option meaning this toast will dissapear in 5 seconds.',
removeIn: 5000,
});
@iamjpg
iamjpg / PhysicalLatLonToPixelXY.html
Last active September 19, 2018 10:23
Google Maps v3 – Translate Physical Latitude/Longitude into Screen Pixel X/Y
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>google_maps_custom_point</title>
<style>
body {
margin: 0;
@iamjpg
iamjpg / jquery.ba-tinypubsub.js
Created August 22, 2012 00:22 — forked from cowboy/HEY-YOU.md
jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery.
/* jQuery Tiny Pub/Sub - v0.7 - 10/27/2011
* http://benalman.com/
* Copyright (c) 2011 "Cowboy" Ben Alman; Licensed MIT, GPL */
(function($) {
var o = $({});
$.subscribe = function() {
o.on.apply(o, arguments);
@iamjpg
iamjpg / gist:3194394
Created July 28, 2012 18:48
The Iron by Henry Rollins
This article originally appeared in Details Magazine some time around 1994 or 1995, I believe. This is a great essay by Henry Rollins on the benefits and lessons of lifting weights.
=================================================
I believe that the definition of definition is reinvention. To not be like your parents. To not be like your friends. To be yourself.
Completely.
When I was young I had no sense of myself. All I was, was a product of all the fear and humiliation I suffered. Fear of my parents. The humiliation of teachers calling me "garbage can" and telling me I'd be mowing lawns for a living. And the very real terror of my fellow students. I was threatened and beaten up for the color of my skin and my size. I was skinny and clumsy, and when others would tease me I didn't run home crying, wondering why.
@iamjpg
iamjpg / gist:3044289
Created July 4, 2012 00:09
Reactive Image jQuery Plugin
// Written by: J.P. Given
// http://johnpatrickgiven.com
// jgiven { at } gmail { com }
(function ( $, window ) {
var pluginName = 'reactiveImage',
pl = null,
document = window.document,
defaults = {
@iamjpg
iamjpg / server.js
Created November 21, 2011 19:24 — forked from jeffrafter/server.js
Twitter OAuth with node-oauth for node.js+express
var express = require('express');
var sys = require('sys');
var oauth = require('oauth');
var app = express.createServer();
var _twitterConsumerKey = "YOURTWITTERCONSUMERKEY";
var _twitterConsumerSecret = "YOURTWITTERCONSUMERSECRET";
function consumer() {
@iamjpg
iamjpg / gist:1304547
Created October 21, 2011 18:20
search.html.haml
%script{:type => "text/javascript"}
:plain
$(document).ready(function(){
$('body').attr('data-sitebase', "#{request.url}");
$('body').attr('data-servicebase',"#{@service_base_url}");
$('body').attr('data-serviceversion',"#{@service_version}");
$('body').attr('data-usertoken',"#{@user_id}");
$('body').attr('data-agenttoken', "6f62a0d9-479d-4e16-a473-90e671c65979");
var search_height = $(window).height() - $('#shared-footer').outerHeight(true) - $('#shared-header').outerHeight(true);
var search_width = $(window).width();
@iamjpg
iamjpg / gist:1302277
Created October 20, 2011 20:30
Javascript Riddle
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>JS Riddle</title>
</head>
<body>
<h3>Print 0 to 100 to the browser without using a global variable in JS</h3>
<div id="print"></div>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:orientation="vertical"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="0px"
android:layout_weight="1"