Skip to content

Instantly share code, notes, and snippets.

View kennym's full-sized avatar

Kenny Meyer kennym

View GitHub Profile
function loadMoreChatMessage(func) {
if (!PreviousMessageListQuery) {
PreviousMessageListQuery = currChannelInfo.createPreviousMessageListQuery();
}
PreviousMessageListQuery.load(50, false, function(messages, error){
if (error) {
return;
}
@kennym
kennym / wrapURLs.js
Created December 21, 2016 22:43 — forked from ryasmi/wrapURLs.js
Wraps all URLs in anchor tags with a `href` and `target` inside some given text.
var wrapURLs = function (text, new_window) {
var url_pattern = /(?:(?:https?|ftp):\/\/)?(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\x{00a1}\-\x{ffff}0-9]+-?)*[a-z\x{00a1}\-\x{ffff}0-9]+)(?:\.(?:[a-z\x{00a1}\-\x{ffff}0-9]+-?)*[a-z\x{00a1}\-\x{ffff}0-9]+)*(?:\.(?:[a-z\x{00a1}\-\x{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?/ig;
var target = (new_window === true || new_window == null) ? '_blank' : '';
return text.replace(url_pattern, function (url) {
var protocol_pattern = /^(?:(?:https?|ftp):\/\/)/i;
var href = protocol_pattern.test(url) ? url : 'http://' + url;
return '<a href="' + href + '" target="' + target + '">' + url + '</a>';
});
};
@kennym
kennym / import.rb
Last active January 22, 2016 17:57
user.favorites.each do |favorite_user|
follows << { source: "flat:#{user.id}", target: "user:#{favorite_user.id}" }
end
user.followers.each do |follower|
followers << { source: "user:#{follower.id}", target: "flat:#{user.id}" }
end
[Skip]
STREAM_CLIENT.follow_many(follows)
STREAM_CLIENT.follow_many(followers)
User.dataset.each_page(50) do |dataset|
follows = []
followers = []
dataset.each do |user|
puts "Processing user ##{user.id}"
user.favorites.each do |favorite_user|
follows << { source: "flat:#{user.id}", target: "user:#{favorite_user.id}" }
end
user.followers.each do |follower|
followers << { source: "user:#{follower.id}", target: "flat:#{user.id}" }
/************************************************************************
*************************************************************************
@Name : BackToTop - jQuery Plugin
@Revison : 1.0
@Date : 12/2011
@Author: ALPIXEL AGENCY - (www.myjqueryplugins.com - www.alpixel.fr)
@Support: FF, IE7, IE8, MAC Firefox, MAC Safari
@License : Open Source - MIT License : http://www.opensource.org/licenses/mit-license.php
**************************************************************************

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
@kennym
kennym / -
Created April 17, 2014 18:01
config/newrelic.yml:2:# This file configures the New Relic Agent. New Relic monitors
config/newrelic.yml:4:# For more information, visit www.newrelic.com.
config/newrelic.yml:15: # You must specify the license key associated with your New Relic
config/newrelic.yml:17: # New Relic service.
config/newrelic.yml:18: license_key: '<%= ENV["NEW_RELIC_LICENSE_KEY"] %>'
config/newrelic.yml:31: # you'd like it show up in New Relic. The service will then auto-map
config/newrelic.yml:45: app_name: <%= ENV["NEW_RELIC_APP_NAME"] %>
config/newrelic.yml:48: # application and reports this data to the New Relic service at
config/newrelic.yml:49: # newrelic.com. This global switch is normally overridden for each
config/newrelic.yml:57: # The newrelic agent generates its own log file to keep its logging
@kennym
kennym / gist:9507927
Created March 12, 2014 14:21
mail.log
Mar 12 14:13:33 saturn postfix/smtp[19150]: 5830FD8B1E: to=<[email protected]>, orig_to=<[email protected]>, relay=gmail-smtp-in.l.google.com[74.125.196.26]:25, delay=0.53, delays=0.02/0.01/0.1/0.4, dsn=2.0.0, status=sent (250 2.0.0 OK 1394633613 3si13224909yhx.43 - gsmtp)
Mar 12 14:13:33 saturn postfix/qmgr[2528]: 5830FD8B1E: removed
INPUT = <<-EOS
O O O O X O O O O O X
X X O X O O O O X O X
O O O X X O O O O O X
O O O O O O O O O O X
O O O O O X O O O O X
EOS
#INPUT = "BMC_TEST_INPUT_MAGIC"
MINE = "X"
{
"_index": "people",
"_type": "person",
"_id": "T6320k45S0GqNKE-fnayHA",
"_score": 1,
"_source": {
"type": "person",
"family_name": "Garnick",
"full_name": "Nathaniel Garnick",
"given_name": "Nathaniel",