Skip to content

Instantly share code, notes, and snippets.

View rchrd2's full-sized avatar

Richard Caceres rchrd2

View GitHub Profile
@joyrexus
joyrexus / README.md
Last active September 6, 2025 15:46 — forked from liamcurry/gist:2597326
Vanilla JS equivalents of jQuery methods

Sans jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@aviddiviner
aviddiviner / run-service.sh
Created March 4, 2014 00:11
Quick bash wrapper around a service; allows for environment setup and sends trapped signals
#!/bin/bash
handler () {
kill -s SIGINT $PID
while kill -0 $PID &>/dev/null
do
wait $PID
done
}
@rayfranco
rayfranco / README.md
Created April 7, 2014 23:42
Convert YML to JSON with gulp

Convert YML to JS with gulp

This was a very straightforward workaround I used in a project to get things done while the assemble team is working on some serious converter gulp-convert.

def nearby_spots_old(request, lat, lng, radius=5000, limit=50):
"""
WITHOUT use of any external library, using raw MySQL and Haversine Formula
http://en.wikipedia.org/wiki/Haversine_formula
"""
radius = float(radius) / 1000.0
query = """SELECT id, (6367*acos(cos(radians(%2f))
*cos(radians(latitude))*cos(radians(longitude)-radians(%2f))
+sin(radians(%2f))*sin(radians(latitude))))
@NotSqrt
NotSqrt / settings_test_snippet.py
Last active May 1, 2022 01:34 — forked from nealtodd/settings_test_snippet.py
Another shot at this problem ..
class DisableMigrations(object):
def __contains__(self, item):
return True
def __getitem__(self, item):
return "notmigrations"
MIGRATION_MODULES = DisableMigrations()
@jeremydw
jeremydw / gist:bc901de8b7e59cbeb190
Created February 27, 2015 02:06
Python webapp2 application that serves files behind HTTP Basic Auth
import webapp2
import mimetypes
import os
import time
from datetime import datetime
import base64
_here = os.path.dirname(__file__)
USERNAME = 'foo'
@rchrd2
rchrd2 / Toaster_AI_v2.c
Last active April 12, 2023 17:34
Toaster_AI_v2.pd
// Toaster AI v2
// by Richard Caceres
// 11/12/09
//
// Safety Precautions that could be put in place
// Overheating
// Description: Precautions to prevent the toaster from being on too long.
// Status: A solution is put in place where the toaster can only be on N seconds at a time.
// There is also a cool down period.
//
@robdodson
robdodson / index.html
Created July 10, 2015 21:19
poly-storage
<!DOCTYPE html>
<html>
<head>
<!-- Web Components -->
<script src="bower_components/webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="bower_components/polymer/polymer.html">
<link rel="import" href="bower_components/iron-localstorage/iron-localstorage.html">
</head>
<body unresolved>
@qtrandev
qtrandev / Polymer
Last active November 6, 2015 04:02
Polymer 1.0 snippets and notes from Polycasts YouTube videos
Info:
=====
These snippets help me remember how to use Polymer syntax. Many come from the Polycasts YouTube videos.
Message me @qtrandev in the Polymer Slack or email [email protected] and I'll message you links I know.
Getting started:
================
bower init
bower install --save Polymer/polymer#^1.0.0
@neutronstein
neutronstein / share_text_attach_ace.js
Last active April 23, 2016 03:59 — forked from geakstr/share_text_attach_ace.js
Ace editor (v1.2.3) and ShareJS (v0.7.40) text adapter
function attachAce(editor, doc) {
if (!doc.provides.text) {
throw new Error("Cannot attach ace to non-text share document");
}
let suppress = false;
editor.setValue(doc.getSnapshot() || "");
check();
const newline = editor.session.getDocument().getNewLineCharacter();