Skip to content

Instantly share code, notes, and snippets.

Scott Tesoriere scottkf

Block or report user

Report or block scottkf

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@scottkf
scottkf / product_scopes.rb
Last active Aug 29, 2015
Sort by stock in spree commerce
View product_scopes.rb
add_search_scope :by_stock_location do
order(%q{
(
SELECT
CASE
WHEN tt.count_on_hand > 0
THEN 2
WHEN zz.backorderable = true
THEN 1
ELSE 0
@scottkf
scottkf / config-deploy.rb
Created Dec 18, 2012
Puma capistrano deployment script, w/init.d script and nginx conf
View config-deploy.rb
require "bundler/capistrano"
server "server", :web, :app, :db, primary: true
set :application, "<application>"
set :user, "<user>"
set :group, "wheel"
set :deploy_to, "/home/#{user}/apps/#{application}"
set :deploy_via, :remote_cache
set :use_sudo, false
View gist:4327994
VERSION=2.6.7
apt-get -y install wget
rm -rf redis-$VERSION
wget http://redis.googlecode.com/files/redis-$VERSION.tar.gz -O redis-$VERSION.tar.gz
tar -xzvf redis-$VERSION.tar.gz
cd redis-$VERSION
./configure --prefix=/usr
make
rm -rf /tmp/redis-$VERSION.$$
mkdir /tmp/redis-$VERSION.$$
@scottkf
scottkf / hooks-before-fail-test.js
Created Aug 23, 2012
node-resourceful before update fail
View hooks-before-fail-test.js
var assert = require('assert'),
vows = require('vows'),
resourceful = require('../lib/resourceful');
vows.describe('resourceful/hooks/sync').addBatch({
"a Resource (update)": {
topic: function () {
return resourceful.define('ResourceUpdate', function () {
this.property('name');
this.property('full');
@scottkf
scottkf / omniauth-steam.rb
Created Nov 23, 2011
omniauth-steam, prior to being bundled
View omniauth-steam.rb
module OmniAuth
module Strategies
class Steam < OmniAuth::Strategies::OpenID
include OmniAuth::Strategy
args [:store, :api_key]
option :options, {}
option :identifier, "http://steamcommunity.com/openid"
option :name, :steam
@scottkf
scottkf / create_people.rb
Created Oct 31, 2011
Self-referential rails example
View create_people.rb
class CreatePeople < ActiveRecord::Migration
def change
create_table :people do |t|
t.string :name
t.timestamps
end
end
end
@scottkf
scottkf / app-views-index.jade
Created Oct 10, 2011
railwayjs environment config
View app-views-index.jade
- var items = ["facebook", "github", "twitter", "instagram"]
- if (!everyauth.loggedIn)
h2 Not Authenticated
each item in items
a(href='/auth/' + item)
span Connect with <span style="text-transform: capitalize">!{item}</span><br />
- else
h2 Authenticated
#user-id Logged in with `user.id` #{user.id} - aka `everyauth.user.id` #{everyauth.user.id}
View nokogiri_steam_failure_spec.rb
require 'rspec'
require 'nokogiri'
require 'open-uri'
describe "nokogiri steam failure" do
it "should only see a url once since they don't repeat" do
doc = Nokogiri::HTML(open(URI.encode("http://store.steampowered.com/search/results?sort_by=Name&sort_order=ASC&category1=998&cc=us&v6=1&page=1")))
@kickthebaby = doc.search('//a[@href="http://store.steampowered.com/app/15540/?snr=1_7_7_230_150_1"]').size
@scottkf
scottkf / event.generate_a_calendar.php
Created Apr 4, 2011
The event needed for generating a calendar in Symphony CMS 2.2
View event.generate_a_calendar.php
<?php
require_once(TOOLKIT . '/class.event.php');
Class eventgenerate_a_calendar extends Event {
const ROOTELEMENT = 'generate-a-calendar';
public $eParamFILTERS = array();
public static function about() {
return array(
'name' => 'Generate a Calendar',
'author' => array(
View calendar.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:date="http://exslt.org/dates-and-times"
extension-element-prefixes="date">
<xsl:import href="get-schedule.xsl" />
<!--
Name: XSLT Calendar
You can’t perform that action at this time.