Skip to content

Instantly share code, notes, and snippets.

View acreeger's full-sized avatar

Adam Creeger acreeger

  • Engineering Manager, Facebook
  • New York, NY
View GitHub Profile
/**
* @license Angulartics v0.17.0
* (c) 2013 Luis Farzati http://luisfarzati.github.io/angulartics
* License: MIT
*/
(function(angular) {
'use strict';
/**
* @ngdoc overview
@acreeger
acreeger / gist:7556067
Created November 20, 2013 01:36
counting connections and origins
netstat -an|grep 10.176.2.157:27017|awk '{print $5}'|awk -F: '{print $1}'|sort -n -t. -k1,1 -k2,2 -k3,3 -k4,4|uniq -c|sort -n
@acreeger
acreeger / gist:5367689
Created April 11, 2013 22:23
Code from parse.com to give developers a little hello when they open the console.
<script type="text/javascript">
if (typeof console == "object") {
if (Util.is_chrome) {
console.log("%cHey! Like what you see and enjoy looking under the hood? That's cool. We love curious people. You should join us and help us build great stuff. https://www.parse.com/jobs", "color: #0677c8; font-size: 18px; font-family: 'Helvetica-Neue', Helvetica, Arial, sans-serif;");
} else {
console.log("Hey! Like what you see and enjoy looking under the hood? That's cool. We love curious people. You should join us and help us build great stuff. https://www.parse.com/jobs");
}
}
</script>
@acreeger
acreeger / TrieNode.groovy
Created May 8, 2012 07:30
Simple TrieNode implementation in groovy
public class TrieNode {
boolean value = false
def children = [:]
public void build(words) {
if (words in String) words = [words]
def startTime = System.currentTimeMillis();
for (String word : words) {
word = word.toLowerCase()
using Microsoft.CommerceServer.Catalog;
using Microsoft.CommerceServer.Runtime.Profiles;
namespace Enticify.CommerceServer.Tests.Scenarios
{
public class PromoInfoSourceApi
{
public void GetPromoInfoForProductAndDoSomething(Product csProduct, Profile csUserProfile)
{
var promotionQueryService = new PromotionQueryService();
@acreeger
acreeger / Description.txt
Created March 6, 2012 00:50
A potential addition to the Grails framework to promote secure data binding.
Crucially, a class with an empty or missing dataBindable property would not be processed at all by bindData or other batch updating mechanisms. This is a harsh breaking change, but makes it clear that the developer must think about security. Since it is a breaking change, there should be a configurable "legacy mode" that could be configured to "true" to enable old behavior for all objects, or it could also be configured to a list of classes or namespaces to enable gradual migration. "dateCreated" and "lastUpdated" should never be updated via bindData or similar.
@acreeger
acreeger / Spock-Tests-for-truncate-tag.groovy
Created January 6, 2012 20:25 — forked from RGBz/truncate-abbr
Grails truncate tag with abbr
def "truncate works for text longer than max length"() {
setup:
def fullText = ("D" * 2) + "&" + ("D" * 12)
def maxLength = "10"
when:
tagLib.truncate(maxlength:maxLength, {fullText})
then:
tagLib.out.toString() == createdTruncatedAbbr(fullText,maxLength)
@acreeger
acreeger / truncate-abbr
Created January 6, 2012 20:25 — forked from RGBz/truncate-abbr
Grails truncate tag with abbr
def truncate = { attrs, body ->
if (body().length() > attrs.maxlength.toInteger()) {
out << """<abbr title="${body()}">${body()[0..attrs.maxlength.toInteger() - 1]}...</abbr>"""
} else {
out << body()
}
}
@acreeger
acreeger / ES_logs.txt
Created August 23, 2011 04:30
Logs of an ElasticSearch node that won't join a cluster.
2011-08-22 23:16:07.907991500 2011-08-22 23:16:07,907 [main] DEBUG ping.multicast - [API-srch01Queryier] using group [224.2.2.4], with port [54328], ttl [3], and address [null]
2011-08-22 23:16:07.916496500 2011-08-22 23:16:07,916 [main] DEBUG ping.unicast - [API-srch01Queryier] using initial hosts []
2011-08-22 23:16:07.917451500 2011-08-22 23:16:07,917 [main] DEBUG discovery.zen - [API-srch01Queryier] using initial_ping_timeout [3s]
2011-08-22 23:16:07.918631500 2011-08-22 23:16:07,918 [main] DEBUG zen.fd - [API-srch01Queryier] [master] uses ping_interval [1s], ping_timeout [30s], ping_retries [3]
2011-08-22 23:16:07.922849500 2011-08-22 23:16:07,922 [main] DEBUG zen.fd - [API-srch01Queryier] [node ] uses ping_interval [1s], ping_timeout [30s], ping_retries [3]
2011-08-22 23:16:11.490543500 2011-08-22 23:16:11,489 [elasticsearch[cached]-pool-1-thread-1] DEBUG discovery.zen - [API-srch01Queryier] ping responses: {none}
2011-08-22 23:16:11.497600500 2011-08-22 23:16:11,496 [New I/O server worker #1-2]
@acreeger
acreeger / gist:1146989
Created August 15, 2011 15:23
Downloading and installing ElasticSearch
curl -o elasticsearch-0.17.4.tar.gz http://cloud.github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.17.4.tar.gz
tar xvfz elasticsearch-0.17.4.tar.gz