Skip to content

Instantly share code, notes, and snippets.

View tonyrosario's full-sized avatar

Tony Rosario tonyrosario

View GitHub Profile
@kule
kule / mini_rspec.rb
Created September 11, 2018 09:37
Simplified example of how rspec works
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'colorize'
end
class MatcherInterface
def initialize(some_object)
@some_object = some_object
@math2001
math2001 / Revert sublime text 3 to a fresh state.md
Last active March 21, 2024 13:34
Revert Sublime Text 3 to a fresh state step by step 🙂

[UPDATE] Sublime Text 4

If you have the latest sublime text (version 4), you can just do:

subl --safe-mode

How do I revert Sublime Text 3 to a fresh state

@mraccola
mraccola / DateUtils.java
Last active August 10, 2021 23:29
Android DateUtils for RFC 1123 dates and ISO 8601 dates
package org.wta.util;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
public final class DateUtils {
@daytonn
daytonn / iTerm triggers.md
Last active March 15, 2018 11:13
iTerm triggers for ruby happiness

iTerm Triggers

  • ^diff.+$ -- Highlight Text (Whatever Background)
  • ^diff.+$ -- Highlight Text (Whatever Foreground)
  • uninitialized\sconstant\s([\w:]+) -- Highlight Text (White on Red)
  • undefined\slocal\svariable\sor\smethod\s(.+)'` -- Highlight Text (White on Red)
  • undefined\smethod\s(.+)'` -- Highlight Text (White on Red)
  • no\simplicit\sconversion\sof\s(\w+)\sinto\s(\w+) -- Highlight Text (White on Red)
  • \?(.+)?'?:?\swrong\snumber\sof\sarguments\s` -- Highlight Text (White on Red)
  • \(\d+\sfor\s\d[\.\+\d]?\) -- Highlight Text (Red on White)
@TheKidCoder
TheKidCoder / example_controller.rb
Last active October 29, 2020 18:40
Rails - Sanitize Ordering Params
class ExampleController
include OrderingHelpers
def index
@clients = Clients.order(sanitized_ordering).where(user_id: current_user.id)
end
end
@kristopherjohnson
kristopherjohnson / TimestampUtils.java
Created July 31, 2013 18:20
Methods for generating ISO 8601 timestamps in Java/Android
package net.kristopherjohnson.util;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
/**
* Methods for dealing with timestamps
@mankyKitty
mankyKitty / SolrQuerySyntaxPrimer.md
Last active March 19, 2024 07:52
The documentation around the basics of the Solr query syntax is terrible, this is an attempt to alleviate the doc-shock associated with trying to learn some fundamentals.

Solr Query Syntax Basics

This is a super basic beginners guide to Solr Lucene query syntax. We're going to cover running a straightforward query, as well as some of the more useful functionality such as filtering and creating facets. We'll point out some things you can't do and generally give you enough instruction so that you can get yourself into trouble.

For testing you need a REST client capable of sending requests to your Solr instance. Either RESTClient for Firefox or Postman for Chrome are good choices.

Misc

Request Specific Fields

To specify a list of fields to return instead of the default Solr response use fl and provide a comma delimited list of fields: