Skip to content

Instantly share code, notes, and snippets.

View ryanmcgrath's full-sized avatar
💭
==bG9s

Ryan McGrath ryanmcgrath

💭
==bG9s
View GitHub Profile
@ryanmcgrath
ryanmcgrath / SVG.js
Last active August 29, 2015 14:24
An incredibly basic module that handles injecting SVG sprites into the document, and then displaying it in a simple <SVG> component tag. Allows for easy PNG fallback for older/unsupported browsers.
import React from 'react';
import icons from './icons';
// This will inject our packaged SVG into the document, if it belongs there
const supportsSVGNatively = (
!!document.createElementNS &&
!!document.createElementNS('http://www.w3.org/2000/svg', "svg").createSVGRect
);
if(supportsSVGNatively) {
<script type="text/javascript">
var updateStatus = {
isLoggedIn: false,
workingForm: null,
newRequestEl: null,
init: function(formName) {
// We need the user to actually be logged in before we can let them use this, so we'll hack a check
updateStatus.isLoggedIn = updateStatus.checkLogin();
#!/usr/bin/ruby
require "optparse"
# Impact v0.1
# @Author: Ryan McGrath
# @Email: ryan [at] venodesigns.net
# Impact is a Ruby script to strip out spaces and useless junk from CSS and Javascript files. It doesn't
# obfuscate the code in any manner, it simply kills all whitespace and newlines. Very simple...
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>The history of David Johnson | He's awesome, in summary</title>
<style type="text/css">
/* The following CSS isn't optimized for anything but standards compliant browsers.
Don't copy and paste with any expectations, this is just a demo.
*/
html {
import twython
twitter = twython.setup("username", "password")
homeTimeline = twitter.getHomeTimeline()
# Loop through our results, find one that contains "Firefox", reTweet it
for tweet in homeTimeline:
if "Firefox" in tweet["text"]:
twitter.reTweet(tweet["id"])
var sys = require("sys"),
currPath = process.cwd();
var buildCommands = [
{dir: "", cmd: ""},
{dir: "", cmd: ""},
{dir: "", cmd: ""},
{dir: "", cmd: ""}
];
import twython, csv
# We're going to read in a CSV file full of Twitter IDs, and see
# if they're still following us or not, as well as if I'm still following them
# or not. If either case turns up negative, we're gonna fix it by establishing
# a relationship and giving them a heads up.
# Get our Twython instance going, so we can talk back and forth with Twitter
twitter = twython.core.setup("ryanmcgrath", "*********************")
host = gowah.ryanmcgrath.org
user-agent = Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-us) AppleWebKit/532.8+ (KHTML, like Gecko) Version/4.0.4 Safari/531.21.10
accept = application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
cache-control = max-age=0
accept-language = en-us
accept-encoding = gzip, deflate
cookie = __utma=2828083.1120180551775986600.1250223672.1262751094.1262757572.9; __utmz=2828083.1250223672.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)
x-forwarded-for = 71.62.141.4
x-forwarded-host = gowah.ryanmcgrath.org
x-forwarded-server = gowah.ryanmcgrath.org
// ...
load: function(url, callback) {
var newScript = document.createElement("script");
newScript.type = "text/javascript";
newScript.src = url;
if(newScript.readyState) {
newScript.onreadystatechange = function() {
if(newScript.readyState == "loaded" || newScript.readyState == "complete") {
{
"error": false,
"folders": [
{
"name": "folder name",
"path": "folder_path"
}
],