This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Paperclip | |
#converts a string into a file for paperclip to save | |
# useage | |
# self.avatar = Paperclip::string_to_file('bob.png', 'image/png', 'BASE64 here') | |
def self.string_to_file(name, type, data) | |
image = StringIO.new(data) | |
image.class.class_eval { attr_accessor :original_filename, :content_type } | |
image.original_filename = name | |
image.content_type = type |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This task will notify Sentry via their API[1] that you have deployed | |
# a new release. It uses the release timestamp as the `version` | |
# (like 20151113182847) and the git ref as the optional `ref` value. | |
# | |
# This task requires several environment variables be set (or just | |
# hardcode the values in here if you like living on the edge): | |
# | |
# ENV['SENTRY_API_ENDPOINT'] : API endpoint, https://app.getsentry.com | |
# ENV['SENTRY_ORG'] : the organization for this app | |
# ENV['SENTRY_PROJECT'] : the project for this app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FLCNBYGG-W4BMMPTX-QVOCMG4S-EG5CWUPH-BYMM6QKU-DI7HT4D2-GAWAEFBU-5PQPK3U6-KTLAYUKP-HEYE2CZA-B5L4DMQC-CRGQJKG5-AABZGREJ-LIEAPOBV-5LQ2HGOY-OUGQKQIP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module PayPal::SDK | |
module REST | |
module DataTypes | |
Payer.class_eval do | |
object_of :merchant_id, String | |
end | |
class ChargeModel < Base | |
object_of :id, String | |
object_of :type, String |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.trailbehind.downloads; | |
import android.util.Log; | |
import com.amazonaws.services.s3.AmazonS3Client; | |
import com.amazonaws.services.s3.model.GetObjectMetadataRequest; | |
import com.amazonaws.services.s3.model.GetObjectRequest; | |
import com.amazonaws.services.s3.model.ObjectMetadata; | |
import com.amazonaws.services.s3.model.S3Object; | |
import com.crashlytics.android.Crashlytics; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.memtrip; | |
import java.io.FileNotFoundException; | |
import java.io.IOException; | |
import java.io.OutputStream; | |
import android.content.ContentResolver; | |
import android.content.ContentUris; | |
import android.content.ContentValues; | |
import android.graphics.Bitmap; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
port = 6379 | |
$redis = Redis.new(:port => port) | |
$redis.flushall |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ListRecurringDetailsResponse#details | |
def details | |
mapped_attributes = { | |
:recurring_detail_reference => "recurringDetailReference", | |
:creation_date => "creationDate", | |
:variant => "variant", | |
:card_holder_name => "card.holderName", | |
:card_expiry_month => "card.expiryMonth", | |
:card_expiry_year => "card.expiryYear", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/ftp' | |
CONTENT_SERVER_DOMAIN_NAME = "one-of-the-ftp-server.thought-sauce.com.hk" | |
CONTENT_SERVER_FTP_LOGIN = "saucy-ftp-server-login" | |
CONTENT_SERVER_FTP_PASSWORD = "saucy-ftp-server-password" | |
# LOGIN and LIST available files at default home directory | |
Net::FTP.open(CONTENT_SERVER_DOMAIN_NAME, CONTENT_SERVER_FTP_LOGIN, CONTENT_SERVER_FTP_PASSWORD) do |ftp| | |
files = ftp.list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Version 1 | |
class Publisher | |
def initialize(page) | |
@page = page | |
end | |
def publish | |
# do things that publish @page | |
end | |
end |