Skip to content

Instantly share code, notes, and snippets.

dstarh

Block or report user

Report or block dstarh

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
View gist:99e9bc79f0c4db62fd7ae26b3f3b49ca
Problem: Virgin common runs apt-get update, writes a file named apt-get.updated, but it only runs apt-get update once, if apt-get-updated does not exist
It only runs apt-get update then installs a list of packages
View BaseFoodCommonNameBridgeUpdate.sql
USE eshadata
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE insert_or_update_common_name
-- Add the parameters for the stored procedure here
View gist:f42273bdda7f7d123034
Jennifer: Thank you for contacting ThinkGeek! My name is Jennifer. How can I help you today?
David Herman: Trying to determine if I order something if it will make it by the 25th and what shipping method I can chose
David Herman: *choose
David Herman: order number is 64eaf9c02
David Herman: hello?
Jennifer: Hi sorry to keep you waiting. Let me check on that.
David Herman: that's ok, I'm guessing you guys are a tad busy ;)
Jennifer: The status is incomplete. Do you want me to complete your order David. Sorry fore the inconvenience.
David Herman: No, I want to know what type of shipping I would need to do to get it here before the 25th
Jennifer: Do you want me to expedite the method?
View foo.haml
:template{id: "foo"}
.this
.that.somethingelse
%h1 Title
.body
some text {{foo}}
View app_controller.rb
class ApplicationController < ActionController::Base
@@page_title = nil
def self.set_title(page_title)
@@page_title = page_title
end
def page_title
ignore_for = %w{sessions devise}
View application.rb
Rails.application.eager_load! #ensure all controllers are loaded
ApplicationController.descendants.each do |controller|
puts "#{controller.name}"
end
View foo.yml
foo_plan:
FOO_ID: 1
bar_group:
FOO_ID: foo_plan #doesn't work
FOO: foo_plan #doesn't work
FOO_ID: 1 #works but not ideal
View query.json
{
"query": {
"filtered": {
"filter": {
"and": [
{
"and": [
{
"or": [
{
View average.rb
average = (50.0 + 75.0 + 90.0) / 3.0 => 71.66666666666667 (14 decimal places)
average = ratings.average(:rating).to_f => 71.6666666666667 (13 decimal places)
:rating is a double in postgres.
View UAgentInfo.java
/* *******************************************
// LICENSE INFORMATION
// The code, "Detecting Smartphones Using PHP"
// by Anthony Hand, is licensed under a Creative Commons
// Attribution 3.0 United States License.
//
// Updated 01 March 2010 by Bryan J Swift
// - Remove un-needed if statements instead just returning the boolean
// inside the if clause
//
You can’t perform that action at this time.