Skip to content

Instantly share code, notes, and snippets.

View jxpx777's full-sized avatar
🤠

Jamie Phelps jxpx777

🤠
View GitHub Profile
@jxpx777
jxpx777 / internet_fail.md
Last active August 29, 2015 13:56
Charter internet slowness
--- google.com ping statistics ---
228 packets transmitted, 228 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 39.070/1937.931/19344.446/3880.397 ms



@jxpx777
jxpx777 / FileTagger.m
Created February 25, 2014 15:36
A demonstration of how to read and set tags using xattr APIs.
- (NSSet *)tagsForFileAtPath:(NSString *)path {
const char *attrName = [@"com.apple.metadata:_kMDItemUserTags" UTF8String];
const char *filePath = [path fileSystemRepresentation];
ssize_t bufferLength = getxattr(filePath, attrName, NULL, 0, 0, 0);
void *buffer = malloc(bufferLength);
// now actually get the attribute string
getxattr(filePath, attrName, buffer, 255, 0, 0);
// convert to NSString
$("#sections .panel.section").hide().first().show();
$("li.highlight a").click(function(event) {
event.preventDefault();
var target = $(event.currentTarget.getAttribute("href"));
if (target.is(":visible")) return;
$("#sections .panel.section:visible").children().fadeOut("fast", function(){
$("#sections .panel.section").hide();
target.show().children().fadeIn("fast");
});
});
@jxpx777
jxpx777 / development.log
Last active December 25, 2015 13:39
Error output
Started POST "/account" for 127.0.0.1 at 2013-10-14 19:45:05 -0500
Processing by AccountsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"ALG1cWqa6VZn+LIjfi/aeCOLl9rDFI+JSKDn6yyn+V4=", "plan"=>"Free", "account"=>{"name"=>"Test2 Here", "domain"=>"test2", "admin_attributes"=>{"email"=>"jamie@epiphanymedia.net", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}}}
Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`full_domain` = 'myhood.dev' AND (`accounts`.`deleted_at` IS NULL) LIMIT 1
Account Load (40.4ms) SELECT `accounts`.* FROM `accounts` WHERE (`accounts`.`deleted_at` IS NULL) LIMIT 1
SubscriptionPlan Load (0.3ms) SELECT `subscription_plans`.* FROM `subscription_plans` WHERE `subscription_plans`.`name` = 'Free' LIMIT 1
(0.1ms) BEGIN
User Exists (0.3ms) SELECT 1 AS one FROM `users` WHERE (`users`.`email` = 'jamie@epiphanymedia.net' AND `users`.`account_id` IS NULL) LIMIT 1
CACHE (0.0ms) SELECT 1 AS one FROM `users` WHERE (`
@jxpx777
jxpx777 / errorlog.txt
Created October 3, 2013 22:30
This is the error we're seeing in production only. Production uses Apache+Passenger. Dev using Pow
ActionView::MissingTemplate (Missing template /invoice with {:locale=>[:en], :formats=>[:text], :handlers=>[:erb, :builder]}. Searched in:
* "/var/www/appname/releases/20131003214241/app/views"
):
app/mailers/mailer.rb:42:in `block in invoice'
app/mailers/mailer.rb:41:in `invoice'
app/controllers/admin_controller.rb:410:in `resend_invoice'
var pageModParams = {
'include': ["*"],
'attachTo': ["top", "existing", "frame"],
'contentScriptFile': [
data.url("src/common.js"),
data.url("src/end.js")
//other scripts to include
]
};
function attachWorkerToTab(tab){
function workersForTab(tab, callback) {
var result = [], emitted;
for (var i = 0; i < workers.length; ++i) {
if (workers[i].tab == tab) result.push(workers[i]);
}
return result;
}
@jxpx777
jxpx777 / fun_time.rb
Created November 7, 2012 16:04
Simple example against using bang methods
#!/usr/bin/env ruby
class FunTime
def initialize
@array = ['foo', 'bar', 'zing']
end
def gimme_bar
hinky
bar = @array[1]
puts bar.inspect
def get_js(self):
js = memcache.get(CACHE_EXT_VERSIONS_JS)
if js is None:
params = {
'releases': {
'chrome': self.get_version(PRODUCT_CHROME),
'safari': self.get_version(PRODUCT_SAFARI),
'firefox': self.get_version(PRODUCT_FIREFOX)
},
'betas': {
require 'delayed_job'
require 'net/http'
class ImagesController < ApplicationController
def fetch
components = params[:url].split('/')
url = clean_url(components[0])
filename = components[1] + params[:format]