Skip to content

Instantly share code, notes, and snippets.

View bwsewell's full-sized avatar

Brian Sewell bwsewell

View GitHub Profile
@ashleymason
ashleymason / luxpo_retargeting_using_real_estate_ads.rb
Last active February 25, 2019 19:49
luxpo_retargeting_using_real_estate_ads
partner = Partner[:luxpo];
partner.extra_data[:default_layouts][:retargeting] = {anx_web: 'luxpo_retargeting_web', facebook: 'luxpo_retargeting_fb'};
partner.save;
pas = PartnerAutomationSetting.find_by(partner_id: partner.id);
unless pas.present?
pas = PartnerAutomationSetting.create(
automation_type: 'retargeting',
send_email: false,
launch_date: 1.year.ago,
@wteuber
wteuber / encrypt_decrypt.rb
Last active May 10, 2024 12:04
Simply encrypt and decrypt Strings in Ruby.
require 'openssl'
class String
def encrypt(key)
cipher = OpenSSL::Cipher.new('DES-EDE3-CBC').encrypt
cipher.key = Digest::SHA1.hexdigest key
s = cipher.update(self) + cipher.final
s.unpack('H*')[0].upcase
end
@anantn
anantn / firebase_player_assignment.js
Last active January 14, 2023 01:51
Firebase: Assigning players in a multiplayer game. This snippet assigns you a spot in a game if the game isn't full yet.
function go() {
var userId = prompt('Username?', 'Guest');
// Consider adding '/<unique id>' if you have multiple games.
var gameRef = new Firebase(GAME_LOCATION);
assignPlayerNumberAndPlayGame(userId, gameRef);
};
// The maximum number of players. If there are already
// NUM_PLAYERS assigned, users won't be able to join the game.
var NUM_PLAYERS = 4;