Skip to content

Instantly share code, notes, and snippets.

View mgrigajtis's full-sized avatar

Matthew Grigajtis mgrigajtis

View GitHub Profile
@mgrigajtis
mgrigajtis / ScrapeCraigslist.rb
Created January 30, 2012 17:18
Script that searches Craigslist
require 'rubygems'
require 'nokogiri'
require 'open-uri'
require 'tlsmail'
require 'time'
require 'net/smtp'
def send_email(from, from_alias, to, to_alias, subject, message)
msg = <<END_OF_MESSAGE
From: #{from_alias} <#{from}>
@mgrigajtis
mgrigajtis / gist:4236084
Created December 7, 2012 20:03
JavaScript function that returns info from between tags (Requires jQuery).
function getTitle(html) {
var strHtml = null;
try {
strHtml = html.replace(/<!\[CDATA\[(.+?)\]\]>/g, function (_match, body) {
return body.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
});
strHtml = strHtml.replace(/<!--.+?-->/g, '');
@mgrigajtis
mgrigajtis / jSearch.ashx
Created December 12, 2012 19:19
jSearch Addon
Imports System.Net
Imports System.Web
Imports System.Web.Services
Public Class jSearch
Implements System.Web.IHttpHandler
Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
Dim byteRequestedHtml() As Byte = Nothing
@mgrigajtis
mgrigajtis / gist:e8cc737ecf405b14bf24
Created May 29, 2014 13:53
Parsing ElasticSearch Results with Java
import java.io.BufferedInputStream;
import java.net.URL;
import java.net.URLConnection;
import org.json.JSONArray;
import org.json.JSONObject;
protected void foo () {
// The input stream from the JSON response
BufferedInputStream buffer = null;
enscript -1rG --line-numbers -p - --highlight=javascript --color=1 --word-wrap file_name.txt > ~/http://out.ps && open ~/http://out.ps`
@mgrigajtis
mgrigajtis / gist:144897e0a20c890e5891
Created August 8, 2014 20:05
DataTables in Rails
In the CoffeeScript:
# Row clicking
selected_id = ''
$('#table_name tbody').on "click", "tr", ->
if $(event.target.parentNode).hasClass("info")
$(event.target.parentNode).removeClass "info"
selected_frame_order = ''
else
table_name.$("tr.info").removeClass "info"
$(event.target.parentNode).addClass "info"
@mgrigajtis
mgrigajtis / flip-button.css
Last active September 20, 2016 20:10
An example of flashy HTML 5 effects
.flip-button.is-open ~ .description {
opacity: 0;
}
.flip-button {
display: block;
position: relative;
width: 100px;
height: 2em;
border-radius: 5px;
@mgrigajtis
mgrigajtis / Contract Killer 3.md
Last active November 22, 2016 23:41 — forked from malarkey/Contract Killer 3.md
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web professionals by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: March 15th 2016
  • Original post

@mgrigajtis
mgrigajtis / Three Wise Monkeys.md
Created November 13, 2016 00:48 — forked from malarkey/Three Wise Monkeys.md
Three Wise Monkeys (NDA)

Date: [date]

Between us [company name] and you [customer name].

Summary:

In short; neither of us will share any confidential information about each-other, by any means, with anyone else.

What’s confidential information?

@mgrigajtis
mgrigajtis / css3backlight.css
Created January 20, 2017 04:43
CSS3 backlight
div {
position: relative;
width: 30vw;
height: 30vw;
line-height: 30vw;
text-align: center;
color: #252B37;
background-color: #151823;
animation: textColor 10s ease infinite;
}