text:
package com.newsblur.fragment;

import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.app.DialogFragment;
import android.app.FragmentManager;
import android.text.Html;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.newsblur.R;
import com.newsblur.activity.Profile;
import com.newsblur.domain.Comment;
import com.newsblur.domain.Reply;
import com.newsblur.domain.Story;
import com.newsblur.domain.UserDetails;
import com.newsblur.domain.UserProfile;
import com.newsblur.fragment.ReplyDialogFragment;
import com.newsblur.util.FeedUtils;
import com.newsblur.util.PrefsUtils;
import com.newsblur.util.ViewUtils;
import com.newsblur.view.FlowLayout;

public class SetupCommentSectionTask extends AsyncTask<Void, Void, Void> {

    private ArrayList<View> topCommentViews;
    private ArrayList<View> topShareViews;

	private ArrayList<View> publicCommentViews;
	private ArrayList<View> friendCommentViews;
	private ArrayList<View> friendShareViews;

    private final ReadingItemFragment fragment;
	private final Story story;
	private final LayoutInflater inflater;
	private WeakReference<View> viewHolder;
	private final Context context;
	private UserDetails user;
	private final FragmentManager manager;
	private List<Comment> comments;

	public SetupCommentSectionTask(ReadingItemFragment fragment, View view, LayoutInflater inflater, Story story) {
        this.fragment = fragment;
		this.context = fragment.getActivity();
		this.manager = fragment.getFragmentManager();
		this.inflater = inflater;
		this.story = story;
		viewHolder = new WeakReference<View>(view);
		user = PrefsUtils.getUserDetails(context);
	}

    /**
     * Do all the DB access and image view creation in the async portion of the task, saving the views in local members.
     */
	@Override
	protected Void doInBackground(Void... arg0) {
        if (context == null) return null;
        comments = FeedUtils.dbHelper.getComments(story.id);

        topCommentViews = new ArrayList<View>();
        topShareViews = new ArrayList<View>();
		publicCommentViews = new ArrayList<View>();
		friendCommentViews = new ArrayList<View>();
		friendShareViews = new ArrayList<View>();

        // users by whom we saw non-pseudo comments
        Set<String> commentingUserIds = new HashSet<String>();
        // users by whom we saw shares
        Set<String> sharingUserIds = new HashSet<String>();

		for (final Comment comment : comments) {
			// skip public comments if they are disabled
			if (!comment.byFriend && !PrefsUtils.showPublicComments(context)) {
			    continue;
			}

			UserProfile commentUser = FeedUtils.dbHelper.getUserProfile(comment.userId);
            // rarely, we get a comment but never got the user's profile, so we can't display it
            if (commentUser == null) {
                Log.w(this.getClass().getName(), "cannot display comment from missing user ID: " + comment.userId);
                continue;
            }

			View commentView = inflater.inflate(R.layout.include_comment, null);
			TextView commentText = (TextView) commentView.findViewById(R.id.comment_text);
			commentText.setText(Html.fromHtml(comment.commentText));
			ImageView commentImage = (ImageView) commentView.findViewById(R.id.comment_user_image);

			TextView commentSharedDate = (TextView) commentView.findViewById(R.id.comment_shareddate);
            // TODO: this uses hard-coded "ago" values, which will be wrong when reading prefetched stories
            if (comment.sharedDate != null) {
			    commentSharedDate.setText(comment.sharedDate + " ago");
            }

			final FlowLayout favouriteContainer = (FlowLayout) commentView.findViewById(R.id.comment_favourite_avatars);
			final ImageView favouriteIcon = (ImageView) commentView.findViewById(R.id.comment_favourite_icon);
			final ImageView replyIcon = (ImageView) commentView.findViewById(R.id.comment_reply_icon);

			if (comment.likingUsers != null) {
				if (Arrays.asList(comment.likingUsers).contains(user.id)) {
					favouriteIcon.setImageResource(R.drawable.have_favourite);
				}

				for (String id : comment.likingUsers) {
					ImageView favouriteImage = new ImageView(context);
					UserProfile user = FeedUtils.dbHelper.getUserProfile(id);
                    if (user != null) {
                        FeedUtils.iconLoader.displayImage(user.photoUrl, favouriteImage, 10f, false);
                        favouriteContainer.addView(favouriteImage);
                    }
				}

                // users cannot fave their own comments.  attempting to do so will actually queue a fatally invalid API call
                if (TextUtils.equals(comment.userId, user.id)) {
                    favouriteIcon.setVisibility(View.GONE);
                } else {
                    favouriteIcon.setOnClickListener(new OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            if (!Arrays.asList(comment.likingUsers).contains(user.id)) {
                                FeedUtils.likeComment(story, comment.userId, context);
                            } else {
                                FeedUtils.unlikeComment(story, comment.userId, context);
                            }
                        }
                    });
                }
			}

			replyIcon.setOnClickListener(new OnClickListener() {
				@Override
				public void onClick(View v) {
					if (story != null) {
						UserProfile user = FeedUtils.dbHelper.getUserProfile(comment.userId);
                        if (user != null) {
                            DialogFragment newFragment = ReplyDialogFragment.newInstance(story, comment.userId, user.username);
                            newFragment.show(manager, "dialog");
                        }
					}
				}
			});

            List<Reply> replies = FeedUtils.dbHelper.getCommentReplies(comment.id);
			for (Reply reply : replies) {
				View replyView = inflater.inflate(R.layout.include_reply, null);
				TextView replyText = (TextView) replyView.findViewById(R.id.reply_text);
				replyText.setText(Html.fromHtml(reply.text));
				ImageView replyImage = (ImageView) replyView.findViewById(R.id.reply_user_image);

                final UserProfile replyUser = FeedUtils.dbHelper.getUserProfile(reply.userId);
				if (replyUser != null) {
					FeedUtils.iconLoader.displayImage(replyUser.photoUrl, replyImage, 5, false);
					replyImage.setOnClickListener(new OnClickListener() {
						@Override
						public void onClick(View view) {
							Intent i = new Intent(context, Profile.class);
							i.putExtra(Profile.USER_ID, replyUser.userId);
							context.startActivity(i);
						}
					});

					TextView replyUsername = (TextView) replyView.findViewById(R.id.reply_username);
					replyUsername.setText(replyUser.username);
				} else {
					TextView replyUsername = (TextView) replyView.findViewById(R.id.reply_username);
					replyUsername.setText(R.string.unknown_user);
				}

                if (reply.shortDate != null) {
                    TextView replySharedDate = (TextView) replyView.findViewById(R.id.reply_shareddate);
                    replySharedDate.setText(reply.shortDate + " ago");
                }

				((LinearLayout) commentView.findViewById(R.id.comment_replies_container)).addView(replyView);
			}

			TextView commentUsername = (TextView) commentView.findViewById(R.id.comment_username);
			commentUsername.setText(commentUser.username);
			String userPhoto = commentUser.photoUrl;

            TextView commentLocation = (TextView) commentView.findViewById(R.id.comment_location);
            if (!TextUtils.isEmpty(commentUser.location)) {
                commentLocation.setText(commentUser.location.toUpperCase());
            } else {
                commentLocation.setVisibility(View.GONE);
            }

            if (!TextUtils.isEmpty(comment.sourceUserId)) {
				commentImage.setVisibility(View.INVISIBLE);
				ImageView usershareImage = (ImageView) commentView.findViewById(R.id.comment_user_reshare_image);
				ImageView sourceUserImage = (ImageView) commentView.findViewById(R.id.comment_sharesource_image);
				sourceUserImage.setVisibility(View.VISIBLE);
				usershareImage.setVisibility(View.VISIBLE);
				commentImage.setVisibility(View.INVISIBLE);

                UserProfile sourceUser = FeedUtils.dbHelper.getUserProfile(comment.sourceUserId);
				if (sourceUser != null) {
					FeedUtils.iconLoader.displayImage(sourceUser.photoUrl, sourceUserImage, 10f, false);
					FeedUtils.iconLoader.displayImage(userPhoto, usershareImage, 10f, false);
				}
			} else {
				FeedUtils.iconLoader.displayImage(userPhoto, commentImage, 10f, false);
			}

			commentImage.setOnClickListener(new OnClickListener() {
				@Override
				public void onClick(View view) {
					Intent i = new Intent(context, Profile.class);
					i.putExtra(Profile.USER_ID, comment.userId);
					context.startActivity(i);
				}
			});

			if (comment.isPseudo) {
                friendShareViews.add(commentView);
                sharingUserIds.add(comment.userId);
            } else if (comment.byFriend) {
				friendCommentViews.add(commentView);
			} else {
				publicCommentViews.add(commentView);
			}

            // for actual comments, also populate the upper icon bar
            if (!comment.isPseudo) {
                ImageView image = ViewUtils.createSharebarImage(context, commentUser.photoUrl, commentUser.userId);
                topCommentViews.add(image);
                commentingUserIds.add(comment.userId);
            }
		}

        // the story object supplements the pseudo-comment share list
        for (String userId : story.sharedUserIds) {
            // for the purpose of this top-line share list, exclude non-pseudo comments
            if (!commentingUserIds.contains(userId)) {
                sharingUserIds.add(userId);
            }
        }

        // now that we have all shares from the comments table and story object, populate the shares row
        for (String userId : sharingUserIds) {
            UserProfile user = FeedUtils.dbHelper.getUserProfile(userId);
            if (user == null) {
                Log.w(this.getClass().getName(), "cannot display share from missing user ID: " + userId);
                continue;
            }
            ImageView image = ViewUtils.createSharebarImage(context, user.photoUrl, user.userId);
            topShareViews.add(image);
        }

		return null;
	}

    /**
     * Push all the pre-created views into the actual UI.
     */
	protected void onPostExecute(Void result) {
        if (context == null) return;
        View view = viewHolder.get();
		if (view == null) return; // fragment was dismissed before we rendered

        TextView headerCommentTotal = (TextView) view.findViewById(R.id.comment_by);
        TextView headerShareTotal = (TextView) view.findViewById(R.id.shared_by);

        FlowLayout sharedGrid = (FlowLayout) view.findViewById(R.id.reading_social_shareimages);
        FlowLayout commentGrid = (FlowLayout) view.findViewById(R.id.reading_social_commentimages);

        TextView friendCommentTotal = ((TextView) view.findViewById(R.id.reading_friend_comment_total));
        TextView friendShareTotal = ((TextView) view.findViewById(R.id.reading_friend_emptyshare_total));
        TextView publicCommentTotal = ((TextView) view.findViewById(R.id.reading_public_comment_total));

        int publicCommentCount = publicCommentViews.size();
        int friendCommentCount = friendCommentViews.size();
        int friendShareCount = friendShareViews.size();

        int allCommentCount = topCommentViews.size();
        int allShareCount = topShareViews.size();

        if (allCommentCount > 0 || allShareCount > 0) {
            view.findViewById(R.id.reading_share_bar).setVisibility(View.VISIBLE);
            view.findViewById(R.id.share_bar_underline).setVisibility(View.VISIBLE);
        } else {
            view.findViewById(R.id.reading_share_bar).setVisibility(View.GONE);
            view.findViewById(R.id.share_bar_underline).setVisibility(View.GONE);
        }

        sharedGrid.removeAllViews();
        for (View image : topShareViews) {
            sharedGrid.addView(image);
        }

        commentGrid.removeAllViews();
        for (View image : topCommentViews) {
            commentGrid.addView(image);
        }

        if (allCommentCount > 0) {
            String countText = context.getString(R.string.friends_comments_count);
            if (allCommentCount == 1) {
                countText = countText.substring(0, countText.length() - 1);
            }
            headerCommentTotal.setText(String.format(countText, allCommentCount));
            headerCommentTotal.setVisibility(View.VISIBLE);
        } else {
            headerCommentTotal.setVisibility(View.GONE);
        }

        if (allShareCount > 0) {
            String countText = context.getString(R.string.friends_shares_count);
            if (allShareCount == 1) {
                countText = countText.substring(0, countText.length() - 1);
            }
            headerShareTotal.setText(String.format(countText, allShareCount));
            headerShareTotal.setVisibility(View.VISIBLE);
        } else {
            headerShareTotal.setVisibility(View.GONE);
        }

        if (publicCommentCount > 0) {
            String commentCount = context.getString(R.string.public_comment_count);
            if (publicCommentCount == 1) {
                commentCount = commentCount.substring(0, commentCount.length() - 1);
            }
            publicCommentTotal.setText(String.format(commentCount, publicCommentCount));
            view.findViewById(R.id.reading_public_comment_header).setVisibility(View.VISIBLE);
        } else {
            view.findViewById(R.id.reading_public_comment_header).setVisibility(View.GONE);
        }

        if (friendCommentCount > 0) {
            String commentCount = context.getString(R.string.friends_comments_count);
            if (friendCommentCount == 1) {
                commentCount = commentCount.substring(0, commentCount.length() - 1);
            }
            friendCommentTotal.setText(String.format(commentCount, friendCommentCount));
            view.findViewById(R.id.reading_friend_comment_header).setVisibility(View.VISIBLE);
        } else {
            view.findViewById(R.id.reading_friend_comment_header).setVisibility(View.GONE);
        }

        if (friendShareCount > 0) {
            String commentCount = context.getString(R.string.friends_shares_count);
            if (friendShareCount == 1) {
                commentCount = commentCount.substring(0, commentCount.length() - 1);
            }
            friendShareTotal.setText(String.format(commentCount, friendShareCount));
            view.findViewById(R.id.reading_friend_emptyshare_header).setVisibility(View.VISIBLE);
        } else {
            view.findViewById(R.id.reading_friend_emptyshare_header).setVisibility(View.GONE);
        }

        LinearLayout publicCommentListContainer = (LinearLayout) view.findViewById(R.id.reading_public_comment_container);
        publicCommentListContainer.removeAllViews();
        for (int i = 0; i < publicCommentViews.size(); i++) {
            if (i == publicCommentViews.size() - 1) {
                publicCommentViews.get(i).findViewById(R.id.comment_divider).setVisibility(View.GONE);
            }
            publicCommentListContainer.addView(publicCommentViews.get(i));
        }

        LinearLayout friendCommentListContainer = (LinearLayout) view.findViewById(R.id.reading_friend_comment_container);
        friendCommentListContainer.removeAllViews();
        for (int i = 0; i < friendCommentViews.size(); i++) {
            if (i == friendCommentViews.size() - 1) {
                friendCommentViews.get(i).findViewById(R.id.comment_divider).setVisibility(View.GONE);
            }
            friendCommentListContainer.addView(friendCommentViews.get(i));
        }

        LinearLayout friendShareListContainer = (LinearLayout) view.findViewById(R.id.reading_friend_emptyshare_container);
        friendShareListContainer.removeAllViews();
        for (int i = 0; i < friendShareViews.size(); i++) {
            if (i == friendShareViews.size() - 1) {
                friendShareViews.get(i).findViewById(R.id.comment_divider).setVisibility(View.GONE);
            }
            friendShareListContainer.addView(friendShareViews.get(i));
        }

        fragment.onSocialLoadFinished();
	}
}


text:
using UnityEngine;
using System.Collections;
using VGDC.FX;

namespace VGDC.Notification {

	public class NotificationTest : MonoBehaviour {

		// Use this for initialization
		void Start () {
		}

		// Update is called once per frame
		void Update () {
			if (Input.GetKeyUp (KeyCode.A)) {
				SpecialEffectsFactory.createEffect (Vector3.up, SpecialEffectType.BunnyDeath);
				NotificationSystem.createNotification ("Hey!", "Whatsup brahhhhhh", 5f);

			}
		}
	}

}

redpajama_set_name: RedPajamaGithub


text:
using namespace llvm;

//===----------------------------------------------------------------------===//
// MemoryBuffer implementation itself.
//===----------------------------------------------------------------------===//

MemoryBuffer::~MemoryBuffer() {
  if (MustDeleteBuffer)
    free((void*)BufferStart);
}

/// initCopyOf - Initialize this source buffer with a copy of the specified
/// memory range.  We make the copy so that we can null terminate it
/// successfully.
void MemoryBuffer::initCopyOf(const char *BufStart, const char *BufEnd) {
  size_t Size = BufEnd-BufStart;
  BufferStart = (char *)malloc(Size+1);
  BufferEnd = BufferStart+Size;
  memcpy(const_cast<char*>(BufferStart), BufStart, Size);
  *const_cast<char*>(BufferEnd) = 0;   // Null terminate buffer.
  MustDeleteBuffer = true;
}

/// init - Initialize this MemoryBuffer as a reference to externally allocated
/// memory, memory that we know is already null terminated.
void MemoryBuffer::init(const char *BufStart, const char *BufEnd) {
  assert(BufEnd[0] == 0 && "Buffer is not null terminated!");
  BufferStart = BufStart;
  BufferEnd = BufEnd;
  MustDeleteBuffer = false;
}

//===----------------------------------------------------------------------===//
// MemoryBufferMem implementation.
//===----------------------------------------------------------------------===//

namespace {
class MemoryBufferMem : public MemoryBuffer {
  std::string FileID;
public:
  MemoryBufferMem(const char *Start, const char *End, StringRef FID,
                  bool Copy = false)
  : FileID(FID) {
    if (!Copy)
      init(Start, End);
    else
      initCopyOf(Start, End);
  }

  virtual const char *getBufferIdentifier() const {
    return FileID.c_str();
  }
};
}

/// getMemBuffer - Open the specified memory range as a MemoryBuffer.  Note
/// that EndPtr[0] must be a null byte and be accessible!
MemoryBuffer *MemoryBuffer::getMemBuffer(const char *StartPtr,
                                         const char *EndPtr,
                                         const char *BufferName) {
  return new MemoryBufferMem(StartPtr, EndPtr, BufferName);
}

/// getMemBufferCopy - Open the specified memory range as a MemoryBuffer,
/// copying the contents and taking ownership of it.  This has no requirements
/// on EndPtr[0].
MemoryBuffer *MemoryBuffer::getMemBufferCopy(const char *StartPtr,
                                             const char *EndPtr,
                                             const char *BufferName) {
  return new MemoryBufferMem(StartPtr, EndPtr, BufferName, true);
}

/// getNewUninitMemBuffer - Allocate a new MemoryBuffer of the specified size
/// that is completely initialized to zeros.  Note that the caller should
/// initialize the memory allocated by this method.  The memory is owned by
/// the MemoryBuffer object.
MemoryBuffer *MemoryBuffer::getNewUninitMemBuffer(size_t Size,
                                                  StringRef BufferName) {
  char *Buf = (char *)malloc(Size+1);
  if (!Buf) return 0;
  Buf[Size] = 0;
  MemoryBufferMem *SB = new MemoryBufferMem(Buf, Buf+Size, BufferName);
  // The memory for this buffer is owned by the MemoryBuffer.
  SB->MustDeleteBuffer = true;
  return SB;
}

/// getNewMemBuffer - Allocate a new MemoryBuffer of the specified size that
/// is completely initialized to zeros.  Note that the caller should
/// initialize the memory allocated by this method.  The memory is owned by
/// the MemoryBuffer object.
MemoryBuffer *MemoryBuffer::getNewMemBuffer(size_t Size,
                                            const char *BufferName) {
  MemoryBuffer *SB = getNewUninitMemBuffer(Size, BufferName);
  if (!SB) return 0;
  memset(const_cast<char*>(SB->getBufferStart()), 0, Size+1);
  return SB;
}

/// getFileOrSTDIN - Open the specified file as a MemoryBuffer, or open stdin
/// if the Filename is "-".  If an error occurs, this returns null and fills
/// in *ErrStr with a reason.  If stdin is empty, this API (unlike getSTDIN)
/// returns an empty buffer.
MemoryBuffer *MemoryBuffer::getFileOrSTDIN(StringRef Filename,
                                           std::string *ErrStr,
                                           int64_t FileSize) {
  if (Filename == "-")
    return getSTDIN();
  return getFile(Filename, ErrStr, FileSize);
}

//===----------------------------------------------------------------------===//
// MemoryBuffer::getFile implementation.
//===----------------------------------------------------------------------===//

namespace {
/// MemoryBufferMMapFile - This represents a file that was mapped in with the
/// sys::Path::MapInFilePages method.  When destroyed, it calls the
/// sys::Path::UnMapFilePages method.
class MemoryBufferMMapFile : public MemoryBuffer {
  std::string Filename;
public:
  MemoryBufferMMapFile(StringRef filename, const char *Pages, uint64_t Size)
    : Filename(filename) {
    init(Pages, Pages+Size);
  }

  virtual const char *getBufferIdentifier() const {
    return Filename.c_str();
  }

  ~MemoryBufferMMapFile() {
    sys::Path::UnMapFilePages(getBufferStart(), getBufferSize());
  }
};
}

MemoryBuffer *MemoryBuffer::getFile(StringRef Filename, std::string *ErrStr,
                                    int64_t FileSize) {
  int OpenFlags = 0;
#ifdef O_BINARY
  OpenFlags |= O_BINARY;  // Open input file in binary mode on win32.
#endif
  SmallString<256> PathBuf(Filename.begin(), Filename.end());
  int FD = ::open(PathBuf.c_str(), O_RDONLY|OpenFlags);
  if (FD == -1) {
    if (ErrStr) *ErrStr = strerror(errno);
    return 0;
  }

  // If we don't know the file size, use fstat to find out.  fstat on an open
  // file descriptor is cheaper than stat on a random path.
  if (FileSize == -1) {
    struct stat FileInfo;
    // TODO: This should use fstat64 when available.
    if (fstat(FD, &FileInfo) == -1) {
      if (ErrStr) *ErrStr = strerror(errno);
      ::close(FD);
      return 0;
    }
    FileSize = FileInfo.st_size;
  }

  // If the file is large, try to use mmap to read it in.  We don't use mmap
  // for small files, because this can severely fragment our address space. Also
  // don't try to map files that are exactly a multiple of the system page size,
  // as the file would not have the required null terminator.
  //
  // FIXME: Can we just mmap an extra page in the latter case?
  if (FileSize >= 4096*4 &&
      (FileSize & (sys::Process::GetPageSize()-1)) != 0) {
    if (const char *Pages = sys::Path::MapInFilePages(FD, FileSize)) {
      // Close the file descriptor, now that the whole file is in memory.
      ::close(FD);
      return new MemoryBufferMMapFile(Filename, Pages, FileSize);
    }
  }

  MemoryBuffer *Buf = MemoryBuffer::getNewUninitMemBuffer(FileSize, Filename);
  if (!Buf) {
    // Failed to create a buffer.
    if (ErrStr) *ErrStr = "could not allocate buffer";
    ::close(FD);
    return 0;
  }

  OwningPtr<MemoryBuffer> SB(Buf);
  char *BufPtr = const_cast<char*>(SB->getBufferStart());

  size_t BytesLeft = FileSize;
  while (BytesLeft) {
    ssize_t NumRead = ::read(FD, BufPtr, BytesLeft);
    if (NumRead > 0) {
      BytesLeft -= NumRead;
      BufPtr += NumRead;
    } else if (NumRead == -1 && errno == EINTR) {
      // try again
    } else {
      // error reading.
      if (ErrStr) *ErrStr = strerror(errno);
      close(FD);
      return 0;
    }
  }
  close(FD);

  return SB.take();
}

//===----------------------------------------------------------------------===//
// MemoryBuffer::getSTDIN implementation.
//===----------------------------------------------------------------------===//

namespace {
class STDINBufferFile : public MemoryBuffer {
public:
  virtual const char *getBufferIdentifier() const {
    return "<stdin>";
  }
};
}

MemoryBuffer *MemoryBuffer::getSTDIN() {
  char Buffer[4096*4];

  std::vector<char> FileData;

  // Read in all of the data from stdin, we cannot mmap stdin.
  //
  // FIXME: That isn't necessarily true, we should try to mmap stdin and
  // fallback if it fails.
  sys::Program::ChangeStdinToBinary();
  size_t ReadBytes;
  do {
    ReadBytes = fread(Buffer, sizeof(char), sizeof(Buffer), stdin);
    FileData.insert(FileData.end(), Buffer, Buffer+ReadBytes);
  } while (ReadBytes == sizeof(Buffer));

  FileData.push_back(0); // &FileData[Size] is invalid. So is &*FileData.end().
  size_t Size = FileData.size();
  MemoryBuffer *B = new STDINBufferFile();
  B->initCopyOf(&FileData[0], &FileData[Size-1]);
  return B;
}


text:
const {
  assertFalse, assertCallable
} = Assert;

function assertAnonymousFunction(f) {
  return assertFalse(f.hasOwnProperty("name"));
}

// B.3.1  __proto___ Property Names in Object Initialisers
// Anonymous function as __proto__ [[Prototype]] won't be named "__proto__"
{
  let o1 = {
    __proto__: function() {}
  };
  assertCallable(Object.getPrototypeOf(o1));
  assertAnonymousFunction(Object.getPrototypeOf(o1));

  let o2 = {
    __proto__: function*() {}
  };
  assertCallable(Object.getPrototypeOf(o2));
  assertAnonymousFunction(Object.getPrototypeOf(o2));

  let o3 = {
    __proto__: () => {}
  };
  assertCallable(Object.getPrototypeOf(o3));
  assertAnonymousFunction(Object.getPrototypeOf(o3));

  let o4 = {
    __proto__: class {}
  };
  assertCallable(Object.getPrototypeOf(o4));
  assertAnonymousFunction(Object.getPrototypeOf(o4));
}


text:
namespace tut {
    struct Sphere_fixture {
        Sphere the_sphere;
        Sphere_fixture() : the_sphere(Sphere(Point(0,0,0), 1, Color(1, 0, 0), 1, 0.5, 0.5, 0.5, 0, 0))
        {
        }
    };
    typedef test_group<Sphere_fixture> factory;
    typedef factory::object object;
}

namespace {
    tut::factory tf("sphere test");
}

namespace tut {
    template<>
    template<>
    void object::test<1>() {
        ensure_equals("Sphere returns its index of refraction",
                the_sphere.getIndexOfRefraction(), 1);
    }
}


text:
package com.ylp.date.security;

public class NothingChecker implements Pmchecker {
	public static final NothingChecker Checker = new NothingChecker();

	public boolean check(String oper, Object obj) {
		// TODO Auto-generated method stub
		return false;
	}

	public boolean check(String oper, Object obj, boolean throwex) {
		// TODO Auto-generated method stub
		return false;
	}

	public boolean check(String oper) {
		// TODO Auto-generated method stub
		return false;
	}

	public boolean check(String oper, boolean throwex) {
		// TODO Auto-generated method stub
		return false;
	}

}


text:
using System;
using System.Windows.Data;
using System.Windows.Media;
using EspaceClient.BackOffice.Silverlight.Helpers;

namespace EspaceClient.BackOffice.Silverlight.Converters
{
    /// <summary>
    /// Conversion d'un <see cref="Boolean"/> en <see cref="Brush"/> dans le cas d'une édition.
    /// </summary>
    public class EditionToColorConverter : IValueConverter
    {
        /// <summary>
        /// Conversion d'un <see cref="Boolean"/> en <see cref="Brush"/> dans le cas d'une édition.
        /// </summary>
        /// <remarks>
        /// Si la valeur est à True, un <see cref="Brush"/> vide retourné.
        /// Dans le cas contraire, un <see cref="Brush"/> correspondant à la couleur "#66FF8000" sera retourné.
        /// </remarks>
        /// <param name="value">Valeur à convertir.</param>
        /// <param name="targetType">Type de la valeur attendu après conversion.</param>
        /// <param name="parameter">Paramètre de conversion.</param>
        /// <param name="culture">Culture utilisée pour la conversion.</param>
        /// <returns><see cref="Brush"/> correspondant à la valeur donnée.</returns>
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value.GetType() != typeof(bool))
                throw new Exception("Incorrect value type.");

            if (targetType != typeof(Brush))
                throw new Exception("Incorrect target type.");

            return ((bool)value == false) ?
                new SolidColorBrush() :
                ExtendedColorHelper.SolidColorBrushFromString("#66FF8000");
        }

        /// <summary>
        /// Méthode non implémentée.
        /// </summary>
        /// <param name="value">Objet source.</param>
        /// <param name="targetType">Type de destination.</param>
        /// <param name="parameter">Paramètres du convertisseur.</param>
        /// <param name="culture">Culture à utiliser.</param>
        /// <returns>Renvoie une exception.</returns>
        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}


text:
package net.dvt32;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.password.NoOpPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;

@EnableWebSecurity
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {

	@Autowired
	UserDetailsService userDetailsService;

	@Override
	public void configure(AuthenticationManagerBuilder auth)
		throws Exception
	{
		auth.userDetailsService(userDetailsService);
	}

	@Bean
	public PasswordEncoder getPasswordEncoder() {
		return NoOpPasswordEncoder.getInstance();
	}

	@Override
	public void configure(HttpSecurity http) throws Exception {
		http.authorizeRequests()
			.antMatchers("/admin").hasRole("ADMIN")
			.antMatchers("/user").hasAnyRole("USER", "ADMIN")
			.antMatchers("/").permitAll()
			.and().formLogin();
	}

}


text:
/****************************************************************************************/
/*                                                                                */
/*                                       Pegasus                                        */
/*                                                                                */
/****************************************************************************************/

//! \file	FractalCube2Block.h
//! \author	Karolyn Boulanger
//! \date	11th January 2014
//! \brief	Timeline block for the FractalCube2 effect (colored fractal with shadows)

#ifndef TESTAPP1_FRACTALCUBE2_BLOCK_H
#define TESTAPP1_FRACTALCUBE2_BLOCK_H

#include "Pegasus/Core/IApplicationContext.h"
#include "Pegasus/Render/Render.h"
#include "Pegasus/Shader/ProgramLinkage.h"
#include "Pegasus/Mesh/Mesh.h"
#include "Pegasus/Timeline/Block.h"

namespace Pegasus {
    namespace Timeline {
        struct UpdateInfo;
        struct RenderInfo;
    }
}

//! Timeline block for the FractalCube2 effect (colored fractal with shadows)
//! \todo Use protected inheritance? In that case, give access to SetPosition() and SetLength()
class FractalCube2Block : public Pegasus::Timeline::Block
{
    DECLARE_TIMELINE_BLOCK(FractalCube2Block, "FractalCube2");

public:

    FractalCube2Block(Pegasus::Alloc::IAllocator * allocator, Pegasus::Core::IApplicationContext * appContext);

    virtual ~FractalCube2Block();
    virtual void Initialize() override;
    virtual void Shutdown()  override;
    virtual void Update(const Pegasus::Timeline::UpdateInfo& updateInfo) override;
    virtual void Render(const Pegasus::Timeline::RenderInfo& renderInfo) override;

    //------------------------------------------------------------------------------------

private:

    // Blocks cannot be copied
    PG_DISABLE_COPY(FractalCube2Block)

    Pegasus::Shader::ProgramLinkageRef mProgram;
    Pegasus::Mesh::MeshRef mQuad;
    Pegasus::Render::BufferRef mStateBuffer;
    Pegasus::Render::Uniform mStateBufferUniform;
    PEGASUS_ALIGN_BEGIN(16)
    struct UniformState
    {
        float ratio;
        float time;
    } mState;
    PEGASUS_ALIGN_END(16);
    Pegasus::Render::BlendingStateRef mCurrentBlockBlendingState;
    Pegasus::Render::BlendingStateRef mDefaultBlendingState;
};

#endif  // TESTAPP1_FRACTALCUBE2_BLOCK_H


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.batch.models;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

/** The current state of the pool. */
public enum PoolProvisioningState {
    /** Enum value Succeeded. */
    SUCCEEDED("Succeeded"),

    /** Enum value Deleting. */
    DELETING("Deleting");

    /** The actual serialized value for a PoolProvisioningState instance. */
    private final String value;

    PoolProvisioningState(String value) {
        this.value = value;
    }

    /**
     * Parses a serialized value to a PoolProvisioningState instance.
     *
     * @param value the serialized value to parse.
     * @return the parsed PoolProvisioningState object, or null if unable to parse.
     */
    @JsonCreator
    public static PoolProvisioningState fromString(String value) {
        if (value == null) {
            return null;
        }
        PoolProvisioningState[] items = PoolProvisioningState.values();
        for (PoolProvisioningState item : items) {
            if (item.toString().equalsIgnoreCase(value)) {
                return item;
            }
        }
        return null;
    }

    /** {@inheritDoc} */
    @JsonValue
    @Override
    public String toString() {
        return this.value;
    }
}


text:
package com.google.android.apps.muzei.quicksettings;

import android.app.WallpaperManager;
import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.Intent;
import android.database.ContentObserver;
import android.database.Cursor;
import android.graphics.drawable.Icon;
import android.net.Uri;
import android.os.Build;
import android.service.quicksettings.Tile;
import android.service.quicksettings.TileService;
import android.support.annotation.RequiresApi;
import android.widget.Toast;

import com.google.android.apps.muzei.MuzeiWallpaperService;
import com.google.android.apps.muzei.SourceManager;
import com.google.android.apps.muzei.api.MuzeiArtSource;
import com.google.android.apps.muzei.api.MuzeiContract;
import com.google.android.apps.muzei.event.WallpaperActiveStateChangedEvent;

import net.nurik.roman.muzei.R;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;

/**
 * Quick Settings Tile which allows users quick access to the 'Next Artwork' command, if supported.
 * In cases where Muzei is not activated, the tile also allows users to activate Muzei directly
 * from the tile
 */
@RequiresApi(api = Build.VERSION_CODES.N)
public class NextArtworkTileService extends TileService {
    private ContentObserver mSourceContentObserver;
    private boolean mWallpaperActive = false;

    @Override
    public void onTileAdded() {
    }

    @Override
    public void onStartListening() {
        // Start listening for source changes, which will include when a source
        // starts or stops supporting the 'Next Artwork' command
        mSourceContentObserver = new ContentObserver(null) {
            @Override
            public void onChange(final boolean selfChange, final Uri uri) {
                updateTile();
            }
        };
        getContentResolver().registerContentObserver(MuzeiContract.Sources.CONTENT_URI,
                true, mSourceContentObserver);

        // Check if the wallpaper is currently active
        EventBus.getDefault().register(this);
        WallpaperActiveStateChangedEvent e = EventBus.getDefault().getStickyEvent(
                WallpaperActiveStateChangedEvent.class);
        // This will call through to updateTile()
        onEventMainThread(e);
    }

    @Subscribe
    public void onEventMainThread(final WallpaperActiveStateChangedEvent e) {
        mWallpaperActive = e != null && e.isActive();
        updateTile();
    }

    private void updateTile() {
        Tile tile = getQsTile();
        if (tile == null) {
            // We're outside of the onStartListening / onStopListening window
            // We'll update the tile next time onStartListening is called.
            return;
        }
        if (!mWallpaperActive) {
            // If the wallpaper isn't active, the quick tile will activate it
            tile.setState(Tile.STATE_INACTIVE);
            tile.setLabel(getString(R.string.action_activate));
            tile.setIcon(Icon.createWithResource(this, R.drawable.ic_stat_muzei));
            tile.updateTile();
            return;
        }
        // Else, the wallpaper is active so we query on whether the 'Next Artwork' command
        // is available
        Cursor data = getContentResolver().query(MuzeiContract.Sources.CONTENT_URI,
                new String[]{MuzeiContract.Sources.COLUMN_NAME_SUPPORTS_NEXT_ARTWORK_COMMAND},
                MuzeiContract.Sources.COLUMN_NAME_IS_SELECTED + "=1", null, null);
        if (data == null) {
            return;
        }
        boolean supportsNextArtwork = false;
        if (data.moveToFirst()) {
            supportsNextArtwork = data.getInt(0) != 0;
        }
        data.close();
        if (supportsNextArtwork) {
            tile.setState(Tile.STATE_ACTIVE);
            tile.setLabel(getString(R.string.action_next_artwork));
            tile.setIcon(Icon.createWithResource(this, R.drawable.ic_notif_full_next_artwork));
        } else {
            tile.setState(Tile.STATE_UNAVAILABLE);
            tile.setLabel(getString(R.string.action_next_artwork));
            tile.setIcon(Icon.createWithResource(this, R.drawable.ic_notif_full_next_artwork));
        }
        tile.updateTile();
    }

    @Override
    public void onClick() {
        Tile tile = getQsTile();
        if (tile == null) {
            // We're outside of the onStartListening / onStopListening window,
            // ignore late arriving clicks
            return;
        }
        if (tile.getState() == Tile.STATE_ACTIVE) {
            // Active means we send the 'Next Artwork' command
            SourceManager.sendAction(this, MuzeiArtSource.BUILTIN_COMMAND_ID_NEXT_ARTWORK);
        } else {
            // Inactive means we attempt to activate Muzei
            unlockAndRun(new Runnable() {
                @Override
                public void run() {
                    try {
                        startActivityAndCollapse(new Intent(WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER)
                                .putExtra(WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT,
                                        new ComponentName(NextArtworkTileService.this,
                                                MuzeiWallpaperService.class))
                                .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
                    } catch (ActivityNotFoundException e) {
                        try {
                            startActivityAndCollapse(new Intent(WallpaperManager.ACTION_LIVE_WALLPAPER_CHOOSER)
                                    .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
                        } catch (ActivityNotFoundException e2) {
                            Toast.makeText(NextArtworkTileService.this, R.string.error_wallpaper_chooser,
                                    Toast.LENGTH_LONG).show();
                        }
                    }
                }
            });
        }
    }

    @Override
    public void onStopListening() {
        EventBus.getDefault().unregister(this);
        getContentResolver().unregisterContentObserver(mSourceContentObserver);
    }

    @Override
    public void onTileRemoved() {
    }
}


text:
package containeranalysis

import (
	src "cloud.google.com/go/containeranalysis/apiv1beta1/containeranalysispb"
	grpc "google.golang.org/grpc"
)

// Deprecated: Please use vars in: cloud.google.com/go/containeranalysis/apiv1beta1/containeranalysispb
var (
	File_google_devtools_containeranalysis_v1beta1_containeranalysis_proto = src.File_google_devtools_containeranalysis_v1beta1_containeranalysis_proto
)

// ContainerAnalysisV1Beta1Client is the client API for
// ContainerAnalysisV1Beta1 service. For semantics around ctx use and
// closing/ending streaming RPCs, please refer to
// https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
//
// Deprecated: Please use types in: cloud.google.com/go/containeranalysis/apiv1beta1/containeranalysispb
type ContainerAnalysisV1Beta1Client = src.ContainerAnalysisV1Beta1Client

// ContainerAnalysisV1Beta1Server is the server API for
// ContainerAnalysisV1Beta1 service.
//
// Deprecated: Please use types in: cloud.google.com/go/containeranalysis/apiv1beta1/containeranalysispb
type ContainerAnalysisV1Beta1Server = src.ContainerAnalysisV1Beta1Server

// Request to get a scan configuration.
//
// Deprecated: Please use types in: cloud.google.com/go/containeranalysis/apiv1beta1/containeranalysispb
type GetScanConfigRequest = src.GetScanConfigRequest

// Request to list scan configurations.
//
// Deprecated: Please use types in: cloud.google.com/go/containeranalysis/apiv1beta1/containeranalysispb
type ListScanConfigsRequest = src.ListScanConfigsRequest

// Response for listing scan configurations.
//
// Deprecated: Please use types in: cloud.google.com/go/containeranalysis/apiv1beta1/containeranalysispb
type ListScanConfigsResponse = src.ListScanConfigsResponse

// A scan configuration specifies whether Cloud components in a project have a
// particular type of analysis being run. For example, it can configure whether
// vulnerability scanning is being done on Docker images or not.
//
// Deprecated: Please use types in: cloud.google.com/go/containeranalysis/apiv1beta1/containeranalysispb
type ScanConfig = src.ScanConfig

// UnimplementedContainerAnalysisV1Beta1Server can be embedded to have forward
// compatible implementations.
//
// Deprecated: Please use types in: cloud.google.com/go/containeranalysis/apiv1beta1/containeranalysispb
type UnimplementedContainerAnalysisV1Beta1Server = src.UnimplementedContainerAnalysisV1Beta1Server

// A request to update a scan configuration.
//
// Deprecated: Please use types in: cloud.google.com/go/containeranalysis/apiv1beta1/containeranalysispb
type UpdateScanConfigRequest = src.UpdateScanConfigRequest

// Deprecated: Please use funcs in: cloud.google.com/go/containeranalysis/apiv1beta1/containeranalysispb
func NewContainerAnalysisV1Beta1Client(cc grpc.ClientConnInterface) ContainerAnalysisV1Beta1Client {
	return src.NewContainerAnalysisV1Beta1Client(cc)
}

// Deprecated: Please use funcs in: cloud.google.com/go/containeranalysis/apiv1beta1/containeranalysispb
func RegisterContainerAnalysisV1Beta1Server(s *grpc.Server, srv ContainerAnalysisV1Beta1Server) {
	src.RegisterContainerAnalysisV1Beta1Server(s, srv)
}


text:
<?xml version="1.0" encoding="UTF-8" ?>
<!--
 Copyright (c) 2010 International Business Machines Corporation and others. All rights reserved.
-->
<!DOCTYPE ldml SYSTEM "http://www.unicode.org/repos/cldr/trunk/common/dtd/ldml.dtd"
[
   <!ENTITY % icu SYSTEM "http://www.unicode.org/repos/cldr/trunk/common/dtd/ldmlICU.dtd">
   %icu;
]
>
<ldml>
    <identity>
        <version number="$Revision: 1.1 $"/>
        <generation date="$Date: 2006/04/21 00:54:07 $"/>
        <language type="el"/>
    </identity>
    <special xmlns:icu="http://www.icu-project.org/">
        <icu:breakIteratorData>
            <icu:boundaries>
                <icu:sentence icu:dependency="sent_el.brk"/>
            </icu:boundaries>
        </icu:breakIteratorData>
    </special>
</ldml>


text:
typedef struct {
    int fd, pos, size, type;
    char buf[BUFSIZE];
} FILE;

extern FILE *stderr;
extern FILE *stdin;
extern FILE *stdout;

FILE *fopen(const char *path, const char *mode);
int fclose(FILE *f);
int fflush(FILE *f);
int fgetc(FILE *f);
int fputc(int c, FILE *f);
int fseek(FILE *f, long offset, int whence);
int printf(const char *fmt, ...);
int putc(int c, FILE *f);
int puts(const char *s);
size_t fread(char *d, size_t size, size_t count, FILE *f);
size_t fwrite(const char *s, size_t size, size_t count, FILE *f);


text:
namespace {

enum SpdyProtocolTestTypes {
  SPDY2 = 2,
  SPDY3 = 3,
};

}  // namespace

namespace net {

class SpdyProtocolTest
    : public ::testing::TestWithParam<SpdyProtocolTestTypes> {
 protected:
  virtual void SetUp() {
    spdy_version_ = GetParam();
  }

  bool IsSpdy2() { return spdy_version_ == SPDY2; }

  // Version of SPDY protocol to be used.
  int spdy_version_;
};

// All tests are run with two different SPDY versions: SPDY/2 and SPDY/3.
INSTANTIATE_TEST_CASE_P(SpdyProtocolTests,
                        SpdyProtocolTest,
                        ::testing::Values(SPDY2, SPDY3));

// Test our protocol constants
TEST_P(SpdyProtocolTest, ProtocolConstants) {
  EXPECT_EQ(1, SYN_STREAM);
  EXPECT_EQ(2, SYN_REPLY);
  EXPECT_EQ(3, RST_STREAM);
  EXPECT_EQ(4, SETTINGS);
  EXPECT_EQ(5, NOOP);
  EXPECT_EQ(6, PING);
  EXPECT_EQ(7, GOAWAY);
  EXPECT_EQ(8, HEADERS);
  EXPECT_EQ(9, WINDOW_UPDATE);
  EXPECT_EQ(std::numeric_limits<int32>::max(), kSpdyMaximumWindowSize);
}

class SpdyProtocolDeathTest : public SpdyProtocolTest {};

// All tests are run with two different SPDY versions: SPDY/2 and SPDY/3.
INSTANTIATE_TEST_CASE_P(SpdyProtocolDeathTests,
                        SpdyProtocolDeathTest,
                        ::testing::Values(SPDY2, SPDY3));

#if GTEST_HAS_DEATH_TEST && !defined(NDEBUG)
TEST_P(SpdyProtocolDeathTest, TestSpdySettingsAndIdOutOfBounds) {
  scoped_ptr<SettingsFlagsAndId> flags_and_id;

  EXPECT_DEBUG_DEATH(
      {
        flags_and_id.reset(new SettingsFlagsAndId(1, ~0));
      },
      "SPDY setting ID too large.");
  // Make sure that we get expected values in opt mode.
  if (flags_and_id.get() != NULL) {
    EXPECT_EQ(1, flags_and_id->flags());
    EXPECT_EQ(static_cast<SpdyPingId>(0xffffff), flags_and_id->id());
  }
}
#endif  // GTEST_HAS_DEATH_TEST && !defined(NDEBUG)

}  // namespace net


text:
/* Workout list
 To import workout list use a tool that can make POST request. The below instruction are using POSTMAN addin for chrome browser. Other tools like CURL, that can make http requests can also be used instead of POSTMAN.
 1. Open POSTMAN and paste the url https://api.mongolab.com/api/1/databases/<yourdatabasename>/collections/auctions?apiKey=<yourapikey>
 2. Update url with your database name (<yourdatabasename>) and api key (<yourapikey>).
 3. Change option from action dropdown to POST.
 4. Change data format tab to "raw"
 5. Click on the "Headers" button or the top right next to "URL Params" button.
 6. Clicking on "Headers" shows up a key-value data entry section. Add key "Content-Type" and value "application/json".
 7. Copy and paste the below json array in the text area.
 8. Click the button "Send".
 9. Check for sucess response
 */
[{ "_id": "SmartphoneAuction", "productAuctions": [{ "name": "AppleiPhone6s", "duration": 10 }, { "name": "BlackberryDTEK50", "duration": 10 }, { "name": "SamsungGalaxyNote5", "duration": 10 }, { "name": "HTCOneA9", "duration": 10 }, { "name": "HuaweiAscendMate7", "duration": 5 }, { "name": "AppleiPhone5s", "duration": 5 }, { "name": "AppleiPhoneSE", "duration": 5 }, { "name": "LeEcoLe1s", "duration": 5 }, { "name": "LenovoZukZ1", "duration": 5 }, { "name": "Nokia6", "duration": 5 }, { "name": "OppoF1s", "duration": 5 }, { "name": "SamsungGalaxyJ5", "duration": 5 }, { "name": "SamsungGalaxyA3", "duration": 5 }, { "name": "VivoY51L", "duration": 5 }, { "name": "ZTEBladeV7", "duration": 5 }, { "name": "ZTEZmax2", "duration": 5 }], "name": "SmartphoneAuction", "title": "Smartphone Auction" }]

    /* Product Auctions
     To import exercise list use a tool that can make POST request. The below instruction are using POSTMAN addin for chrome browser. Other tools like CURL, that can make http requests can also be used instead of POSTMAN.
     1. Open POSTMAN and paste the url https://api.mongolab.com/api/1/databases/<yourdatabasename>/collections/product-auctions?apiKey=<yourapikey>
     2. Update url with your database name (<yourdatabasename>) and api key (<yourapikey>).
     3. Follow step 3 and 9 from above.
     */
    [
        {
            "_id": "AppleiPhone6s",
            "name": "AppleiPhone6s",
            "title": "Apple iPhone 6s",
            "image": "Apple_iPhone_6S_800.png",
            "description": "The iPhone 6S has a similar design to the 6 but updated hardware, including a strengthened chassis and upgraded system-on-chip, a 12-megapixel camera, improved fingerprint recognition sensor, and LTE Advanced support. The iPhone 6S also introduces a new hardware feature known as '3D Touch', which enables pressure-sensitive touch inputs.",
            "specLink": "http://gadgets.ndtv.com/apple-iphone-6s-2952",
            "askingPrice": 830
        },
        {
            "_id": "BlackberryDTEK50",
            "name": "BlackberryDTEK50",
            "title": "Blackberry DTEK50",
            "image": "bb_DTEK50.jpg",
            "description": "DTEK50™ ensures that how you share the private details of your life — your location, your pictures, your texts — is your decision.  Not all smartphones are equally secure.  With the DTEK series of smartphones, you have built in armor protecting your personal information.",
            "specLink": "http://gadgets.ndtv.com/blackberry-dtek50-3663",
            "askingPrice": 500
        },
        {
            "_id": "SamsungGalaxyNote5",
            "name": "SamsungGalaxyNote5",
            "title": "Samsung Galaxy Note 5",
            "image": "GALAXY_Note_5.jpeg",
            "description": "The Galaxy Note 5 carries over hardware and software features from the Galaxy S6, including a refreshed design with a glass backing, improved camera, and fingerprint scanner. The device also includes built in livestreaming functionality as well as features meant for use with the device\'s bundled, spring-loaded stylus. The device was released together with the Samsung Galaxy S6 Edge+.",
            "specLink": "http://gadgets.ndtv.com/samsung-galaxy-note-5-2866",
            "askingPrice": 300
        },
        {
            "_id": "HTCOneA9",
            "name": "HTCOneA9",
            "title": "HTC One A9",
            "image": "htc_one_a9.jpg",
            "description": "The HTC One A9 is an Android smartphone manufactured and marketed by HTC. It was officially announced on October 20, 2015.[2][3] It is the successor to the HTC One Mini 2 in the Worldwide; but in global markets, it was sold alongside the One M9 as a mid-range offering.[4] It was launched as an effort to improve the revenue of HTC's smartphone business after the failure of the One M9",
            "specLink": "http://gadgets.ndtv.com/htc-one-a9-3051",
            "askingPrice": 400
        },
        {
            "_id": "HuaweiAscendMate7",
            "name": "HuaweiAscendMate7",
            "title": "Huawei Ascend Mate 7",
            "image": "huawei_ascend_mate_7.jpg",
            "description": "The Huawei_Ascend Mate 7 is powered by 1.3GHz octa-core processor and it comes with 2GB of RAM. The phone packs 16GB of internal storage that can be expanded up to 32GB via a microSD card. As far as the cameras are concerned, the Huawei Ascend Mate 7 packs a 13-megapixel primary camera on the rear and a 5-megapixel front shooter for selfies.",
            "specLink": "http://gadgets.ndtv.com/huawei-ascend-mate-7-1956",
            "askingPrice": 480
        },
        {
            "_id": "AppleiPhone5s",
            "name": "AppleiPhone5s",
            "title": "Apple iPhone 5s",
            "image": "iphone_5s.jpg",
            "description": "The iPhone 5S maintains almost the same external design as its predecessor, the iPhone 5, although the 5S received a new white/gold color scheme in addition to white/silver and space gray/black, however the 5S has vastly upgraded internal hardware. The 5S introduced the A7 64-bit dual-core system-on-chip, the first 64-bit processor to be used on a smartphone, accompanied by the M7 'motion co-processor'.",
            "specLink": "http://gadgets.ndtv.com/apple-iphone-5s-1028",
            "askingPrice": 400
        },
        {
            "_id": "AppleiPhoneSE",
            "name": "AppleiPhoneSE",
            "title": "Apple iPhone SE",
            "image": "iphone_SE.jpeg",
            "description": "The iPhone SE serves as a successor of the iPhone 5S. It maintains the 4-inch screen size and largely identical design to the 5S, but includes selected hardware upgrades from the larger iPhone 6S model, including its updated processor, rear camera, and support for iOS 10 and iOS 11 software features, such as Apple Pay, always-on Siri activation, and Live Photos.",
            "specLink": "http://gadgets.ndtv.com/apple-iphone-se-3393",
            "askingPrice": 400
        },
        {
            "_id": "LeEcoLe1s",
            "name": "LeEcoLe1s",
            "title": "LeEco Le 1s",
            "image": "LeEco_Le_1s.jpeg",
            "description": "The LeEco Le 1s is powered by 2.2GHz octa-core MediaTek Helio X10 processor and it comes with 3GB of RAM. The phone packs 32GB of internal storage that cannot be expanded. As far as the cameras are concerned, the LeEco Le 1s packs a 13-megapixel primary camera on the rear and a 5-megapixel front shooter for selfies.",
            "specLink": "http://gadgets.ndtv.com/leeco-le-1s-3070",
            "askingPrice": 250
        },
        {
            "_id": "LenovoZukZ1",
            "name": "LenovoZukZ1",
            "title": "Lenovo Zuk Z1",
            "image": "Lenovo_Zuk_Z1.jpg",
            "description": "The Lenovo Zuk Z1 is powered by 2.5GHz quad-core Qualcomm Snapdragon 801 processor and it comes with 3GB of RAM. The phone packs 64GB of internal storage that cannot be expanded. As far as the cameras are concerned, the Lenovo Zuk Z1 packs a 13-megapixel primary camera on the rear and a 8-megapixel front shooter for selfies.",
            "specLink": "http://gadgets.ndtv.com/lenovo-zuk-z1-3473",
            "askingPrice": 500
        },
        {
            "_id": "Nokia6",
            "name": "Nokia6",
            "title": "Nokia 6",
            "image": "nokia_6.jpg",
            "description": "The Nokia 6 is powered by 1.4GHz octa-core Qualcomm Snapdragon 430 processor processor and it comes with 3GB of RAM. The phone packs 32GB of internal storage that can be expanded up to 128GB via a microSD card. As far as the cameras are concerned, the Nokia 6 packs a 16-megapixel primary camera on the rear and a 8-megapixel front shooter for selfies.",
            "specLink": "http://gadgets.ndtv.com/nokia-6-3957",
            "askingPrice": 300
        },
        {
            "_id": "OppoF1s",
            "name": "OppoF1s",
            "title": "Oppo F1s",
            "image": "OPPO_F1s.jpg",
            "description": "The Oppo F1s is powered by octa-core MediaTek MT6750 processor and it comes with 3GB of RAM. The phone packs 32GB of internal storage that can be expanded up to 128GB via a microSD card. As far as the cameras are concerned, the Oppo F1s packs a 13-megapixel primary camera on the rear and a 16-megapixel front shooter for selfies.",
            "specLink": "http://gadgets.ndtv.com/oppo-f1s-3678",
            "askingPrice": 355
        },
        {
            "_id": "SamsungGalaxyJ5",
            "name": "SamsungGalaxyJ5",
            "title": "Samsung Galaxy J5 (2016)",
            "image": "Samsung_Galaxy_J5_(2016).png",
            "description": "The Samsung Galaxy J5 (2016) is powered by 1.2GHz quad-core processor and it comes with 2GB of RAM. The phone packs 16GB of internal storage that can be expanded up to 128GB via a microSD card. As far as the cameras are concerned, the Samsung Galaxy J5 (2016) packs a 13-megapixel primary camera on the rear and a 5-megapixel front shooter for selfies.",
            "specLink": "http://gadgets.ndtv.com/samsung-galaxy-j5-2016-3398",
            "askingPrice": 280
        },
        {
            "_id": "SamsungGalaxyA3",
            "name": "SamsungGalaxyA3",
            "title": "Samsung Galaxy A3 (2016)",
            "image": "samsung_galaxy_a3_2016.jpg",
            "description": "The Samsung Galaxy A3 (2016) is powered by 1.5GHz quad-core processor and it comes with 1.5GB of RAM. The phone packs 16GB of internal storage that can be expanded up to 128GB via a microSD card. As far as the cameras are concerned, the Samsung Galaxy A3 (2016) packs a 13-megapixel primary camera on the rear and a 5-megapixel front shooter for selfies.",
            "specLink": "http://gadgets.ndtv.com/samsung-galaxy-a3-2016-3151",
            "askingPrice": 264
        },
        {
            "_id": "VivoY51L",
            "name": "VivoY51L",
            "title": "Vivo Y51L",
            "image": "Vivo_Y51L.jpg",
            "description": "The Vivo Y51L is powered by 1.2GHz quad-core Qualcomm Snapdragon 410 processor and it comes with 2GB of RAM. The phone packs 16GB of internal storage that can be expanded up to 128GB via a microSD card. As far as the cameras are concerned, the Vivo Y51L packs a 8-megapixel primary camera on the rear and a 5-megapixel front shooter for selfies.",
            "specLink": "http://gadgets.ndtv.com/vivo-y51l-3265",
            "askingPrice": 266
        },
        {
            "_id": "ZTEBladeV7",
            "name": "ZTEBladeV7",
            "title": "ZTE Blade V7",
            "image": "ZTE_Blade_V7.jpg",
            "description": "The ZTE Blade V7 is powered by 1.3GHz octa-core MediaTek MT6753 processor and it comes with 2GB of RAM. The phone packs 16GB of internal storage that can be expanded. As far as the cameras are concerned, the ZTE Blade V7 packs a 13-megapixel primary camera on the rear and a 5-megapixel front shooter for selfies.",
            "specLink": "http://gadgets.ndtv.com/mobiles/news/zte-blade-v7-blade-v7-lite-first-look-808197",
            "askingPrice": 270
        },
        {
            "_id": "ZTEZmax2",
            "name": "ZTEZmax2",
            "title": "ZTE Zmax 2",
            "image": "ZTE_Zmax_2.jpg",
            "description": "The ZTE Zmax 2 is powered by 1.2GHz quad-core Qualcomm Snapdragon 410 processor and it comes with 2GB of RAM. The phone packs 16GB of internal storage that can be expanded. As far as the cameras are concerned, the ZTE Zmax 2 packs a 8-megapixel primary camera on the rear and a 2-megapixel front shooter for selfies.",
            "specLink": "http://gadgets.ndtv.com/zte-zmax-2-2982",
            "askingPrice": 150
        }
    ]


text:
package se.lu.bos.misgen.factory;

import se.lu.bos.misgen.model.Plane;
import se.lu.bos.misgen.model.PlaneType;

/**
 * Created with IntelliJ IDEA.
 * User: Erik
 * Date: 2015-01-02
 * Time: 20:46
 * To change this template use File | Settings | File Templates.
 */
public class PlaneFactory {
    public static Plane buildPlane(boolean playerGroup, PlaneType planeType, int numInGroup, int aiLevel, float x, float y, float z, float yOri, Integer payloadId, String baseName, int playerIndex) {
        Plane p = new Plane(x, y, z, yOri);
        p.setName(baseName + " " + (numInGroup+1) + " (" + planeType.name() + ")");
        p.getMCU_TR_Entity().setName(p.getName());
        p.setScript(planeType.getScript());
        p.setModel(planeType.getModel());
        p.setAILevel(aiLevel);
        p.setNumberInFormation(numInGroup);
        p.setCountry(planeType.getCountry());
        p.setPayloadId(payloadId);

        // Handle player index in flight if applicable.
        if(playerGroup) {
            if(numInGroup == (playerIndex-1)) {
                p.setAILevel(0);
            } else {
                p.setAILevel(3);
            }
        }
        p.setStartInAir(y == 0 ? 1 : 0);
        return p;
    }
}


text:
package send;

import com.google.gson.Gson;
import entity.User;
import entity.webhook.facebook.FbUserProfile;
import entity.webhook.facebook.MessageEntry;
import entity.webhook.facebook.WebhookPushData;
import send.components.ButtonPayload;
import send.components.ResponsePayload;
import send.template.ButtonTemplate;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;

/**
 * Created by vku131 on 2/15/17.
 */
public class ConversationMessage {
    private static Gson gson = new Gson();

    @Deprecated
    public static String newUserInfoTOAdmin(WebhookPushData webhookPushData, FbUserProfile fbUserProfile) {
        String adminId = "1405055952852003";
        //{"message":{"text":"What is JS?","quick_replies":[{"content_type":"text","title":"Language",
        // "payload":"QUESTION NUMEBR"},{"content_type":"text","title":"Framework","payload":"QUESTION NUMEBR"},
        // {"content_type":"text","title":"Library","payload":"QUESTION NUMEBR"}]},
        // "recipient":{"id":"1405055952852003"}}
        TextMessage textMessage = new TextMessage();
        MessageEntry messageEntry = webhookPushData.getEntry().get(0).getMessaging().get(0);
        Map<String, Object> message = new HashMap<>();
        ResponsePayload payload;
        List<QuickReply> quickReplies = new ArrayList<>();
        QuickReply doneQuickReply = new QuickReply("text", "Done");
        payload = new ResponsePayload("REGISTRATION", "SEND_WELCOME_MESSAGE", messageEntry.getSender().get("id"));
        payload.setMessengerId(messageEntry.getSender().get("id"));
        doneQuickReply.setPayload(gson.toJson(payload));

        QuickReply wrongInfoQuickReply = new QuickReply("text", "WrongInfo");
        payload = new ResponsePayload("NONE", "NONE", messageEntry.getSender().get("id"));
        payload.setMessengerId(messageEntry.getSender().get("id"));
        wrongInfoQuickReply.setPayload(gson.toJson(payload));

        quickReplies.add(doneQuickReply);
        quickReplies.add(wrongInfoQuickReply);

        message.put("quick_replies", quickReplies);
        message.put("text", "NEW_USER|Name - " + fbUserProfile.getFirst_name() + " " + fbUserProfile.getLast_name() +
                " |Facebook Id - " + webhookPushData.getEntry().get(0)
                .getMessaging().get(0).getMessage().getText());
        textMessage.setMessage(message);
        textMessage.setRecipient(adminId);
        return gson.toJson(textMessage);
    }

    public static String newUserInfoToAdminButtonTemplate(WebhookPushData webhookPushData, FbUserProfile
            fbUserProfile) {
        String adminId = "1405055952852003";
        ResponsePayload payload;
        String text = "NEW_USER|Name - " + fbUserProfile.getFirst_name() + " " + fbUserProfile.getLast_name() +
                "| Facebook Id - " + webhookPushData.getEntry().get(0)
                .getMessaging().get(0).getMessage().getText();
        MessageEntry messageEntry = webhookPushData.getEntry().get(0).getMessaging().get(0);
        List<ButtonPayload> buttonPayloads = new ArrayList<>();
        payload = new ResponsePayload("REGISTRATION", "SEND_WELCOME_MESSAGE", messageEntry.getSender().get("id"));
        payload.setMessengerId(messageEntry.getSender().get("id"));
        buttonPayloads.add(new ButtonPayload("Done", gson.toJson(payload)));
        payload = new ResponsePayload("NONE", "NONE", messageEntry.getSender().get("id"));
        payload.setMessengerId(messageEntry.getSender().get("id"));
        buttonPayloads.add(new ButtonPayload("WrongInfo", gson.toJson(payload)));
        ButtonTemplate buttonTemplate = new ButtonTemplate(adminId, text, buttonPayloads);
        return gson.toJson(buttonTemplate);
    }

    public static String welcomeMessage(User user, String senderId) {
        TextMessage textMessage = new TextMessage();
        Map<String, Object> message = new HashMap<>();
        String welcomeStr;

        message.put("text", "Hey " + user.getFirstName() + "," +
                "you have been registered successfully. Thank you for registration :)");
        textMessage.setRecipient(senderId);
        textMessage.setMessage(message);

        welcomeStr = gson.toJson(textMessage);
        return welcomeStr;
    }
}


text:
package org.epctagcoder.option.SGTIN;

import java.util.LinkedHashMap;
import java.util.Map;

public enum SGTINTagSize {
	BITS_96(96) {
		public Integer getHeader() {
			return 48;
		}
		public Integer getSerialBitCount() {
			return 38;
		}
		public Integer getSerialMaxLenght() {
			return 11;
		}
		public Long getSerialMaxValue() {
			return 274_877_906_943L;
		}
	},
	BITS_198(198) {
		public Integer getHeader() {
			return 54;
		}
		public Integer getSerialBitCount() {
			return 140;
		}
		public Integer getSerialMaxLenght() {
			return 20;
		}
		public Long getSerialMaxValue() {
			return null;  // not used
		}
	};

	private int value;
	public abstract Integer getHeader();
	public abstract Integer getSerialBitCount();
	public abstract Integer getSerialMaxLenght();
	public abstract Long getSerialMaxValue();

	private SGTINTagSize(int value) {
		this.value = value;
	}

	public int getValue() {
		return value;
	}

    private static final Map<Integer, SGTINTagSize> BY_CODE_MAP = new LinkedHashMap<>();
    static {
        for (SGTINTagSize rae : SGTINTagSize.values()) {
            BY_CODE_MAP.put(rae.value, rae);
        }
    }

    public static SGTINTagSize forCode(int code) {
    	SGTINTagSize bits = BY_CODE_MAP.get(code);

    	if (bits==null) {
    		throw new IllegalArgumentException(String.format("SGTIN tag size %d is invalid. Only 96 bits or 198 bits supported.", code));
    	}

        return bits;
    }

}


text:
<?php

	/**
	 * provides filtering for channels for better visibility within EPG
	 */
	interface ChannelFilter {

		/** return only the entries of the provided array, that match the filter-criteria */
		public function getFiltered(array $entries);

		/** check if one specific entry matches the filter */
		public function matches($entry);

	}

?>


text:
import os

def handle_headers(frame, request, response):
    resource_url = request.GET.first(b"resource-url").decode()
    link_header_value = "<{}>; rel=preload".format(resource_url)
    early_hints = [
        (b":status", b"103"),
        (b"link", link_header_value),
    ]
    response.writer.write_raw_header_frame(headers=early_hints,
                                           end_headers=True)

    response.status = 200
    response.headers[b"content-type"] = "text/html"
    response.write_status_headers()

def main(request, response):
    current_dir = os.path.dirname(os.path.realpath(__file__))
    file_path = os.path.join(current_dir, "preload-without-as.html")
    with open(file_path, "r") as f:
        test_content = f.read()
    response.writer.write_data(item=test_content, last=True)


text:
jgebhardt.github.io
===================


text:
Create Sender

Create a new sender

Senders

{{thisSender.name}}

		ADMIN - Can't be disabled by user.

{{thisSender.description}}


text:
import os, json
import flannelfox.tools
from collections import OrderedDict

if os.environ.get('FF_ROOT', False):
	HOME_DIR = os.environ.get('FF_ROOT')
else:
	HOME_DIR = os.path.expanduser('~')

# #############################################################################
# Special variables to handle formatting names
# #############################################################################

# These are torrentTitle prefixes that should be ignored when creating torrent
# objects. This is mainly to fix rss feeds that have bad file entries in front.
BAD_PREFIXES = [
	'autofill fail',
	'TvHD \d+ \d+',
	'TvSD \d+ \d+'
]

# These are keywords such as sources that come in multiple forms, but need to
# be reconciled into one to make it easier to grab them
# ORDER IS IMPORTANT
KEYWORD_SYNONYMS = OrderedDict([
	('blu\-ray','bluray'),
	('bdrip','bluray'),
	('brrip','bluray'),
	('hd\-dvd','hddvd'),
	('web\-dl','webdl'),
	('web\-rip','webrip'),
	('x264','h264'),
	('h.264','h264'),
	('h264.?hi10p','h264hi10p'),
	('vc\-1','vc1'),
	('v0 ?\(?vbr\)?','v0vbr'),
	('v1 ?\(?vbr\)?','v1vbr'),
	('v2 ?\(?vbr\)?','v2vbr'),
	('v8 ?\(?vbr\)?','v8vbr'),
	('aps ?\(?vbr\)?','apsvbr'),
	('apx ?\(?vbr\)?','apxvbr')
])

# This is a list of properties that are ignored during torrent comparison
FUZZY_PROPERTIES = [

# Properties ignored in a comparison, in order to achieve a preference
# of certain quality then you need to make the source feed "upgradable"
	'quality',
	'source',
	'container',
	'codec',

# Properties ignored due to being related to RSS
	'torrentTitle',
	'url',

# Properties ignored due to being related to storage
	'feedDestination',

# Properties ignored due to being based on ratio/timing
	'addedOn',
	'added',
	'queuedOn',
	'minTime',
	'minRatio',
	'comparison',
	'hashString',

# Properties ignored due to being based on transmission responses
	'id',
	'error',
	'errorString',
	'uploadRatio',
	'percentDone',
	'doneDate',
	'activityDate',
	'rateUpload',
	'downloadDir',
	'seedTime',
	'status'
]

# #############################################################################

settings = {
	'files':{
		'defaultTorrentLocation': os.path.join(HOME_DIR, 'files'),
		'maxUsedSpaceDir': os.path.join(HOME_DIR, 'files'),
		'privateDir': os.path.join(HOME_DIR, '.flannelfox'),
		'configDir': os.path.join(HOME_DIR, '.flannelfox/config'),
		'logDir': os.path.join(HOME_DIR, '.flannelfox/logs'),
		'toolsDir': os.path.join(HOME_DIR, 'tools'),
		'settingsConfigFile': os.path.join(HOME_DIR, '.flannelfox/config/settings.json'),
		'feedConfigDir': os.path.join(HOME_DIR, '.flannelfox/config/feeds'),
		'rssConfigDir': os.path.join(HOME_DIR, '.flannelfox/config/feeds/rssfeeds'),
		'lastfmConfigDir': os.path.join(HOME_DIR, '.flannelfox/config/feeds/lastfmfeeds'),
		'lastfmCacheDir': os.path.join(HOME_DIR, '.flannelfox/cache/LastfmArtistsConfigCache'),
		'traktConfigDir': os.path.join(HOME_DIR, '.flannelfox/config/feeds/traktfeeds'),
		'traktCacheDir': os.path.join(HOME_DIR, '.flannelfox/cache/TraktConfigCache'),
		'goodreadsConfigDir': os.path.join(HOME_DIR, '.flannelfox/config/feeds/goodreadsfeeds'),
		'goodreadsCacheDir': os.path.join(HOME_DIR, '.flannelfox/cache/GoodreadsConfigCache')
	},
	'apis':{
		'lastfm':'https://ws.audioscrobbler.com/2.0',
		'trakt':'https://api-v2launch.trakt.tv',
		'goodreads':'https://www.goodreads.com'
	},
	'database':{
		'defaultDatabaseEngine': 'SQLITE3'
	},
	'queueManagement':{
		'maxTorrents': 300,
		'maxDownloadingTorrents': 5,
		'strictQueueManagement': False
	},
	'client':{
		'name': 'transmission-server1',
		'type': 'transmission',
		'host': '127.0.0.1',
		'https': False,
		'port': '9091',
		'rpcLocation': 'transmission/rpc',
		'user': '',
		'password': ''
	},
	'tvTitleMappings': {
		'teen titans go':'teen titans go!',
		'uncle buck':'uncle buck 2016',
		'chicago p d':'chicago p.d.',
		'chicago pd':'chicago p.d.',
		'guardians of the galaxy':'marvels guardians of the galaxy',
		'ultimate spider man vs the sinister 6':'ultimate spider man',
		'marvels ultimate spider man vs the sinister 6':'ultimate spider man',
		'scandal us':'scandal',
		'scandal 2012':'scandal',
		'doctor who':'doctor who 2005',
		'house of cards 2013':'house of cards us',
		'the flash':'the flash 2014',
		'dcs legends of tomorrow':'dc\'s legends of tomorrow',
		'dc s legends of tomorrow':'dc\'s legends of tomorrow',
		'the magicians 2016':'the magicians 2015',
		'the magicians us':'the magicians 2015',
		'law and order special victims unit':'law and order: svu'
	},
	'debugLevel': 'info',
	'minimumFreeSpace': 0,
	'maxUsedSpace': 600,
	'queueDaemonThreadSleep': 60,
	'rssDaemonThreadSleep': 60,
	'maxRssThreads': 8
}

def getSettings():
	return settings

def readSettingsFile(settingsFile=settings['files']['settingsConfigFile']):
	try:
		with open(settingsFile,'r') as importedSettings:
			return importedSettings.read()

	except Exception:
		return '{}'

def updateSettings(settingsFile=settings['files']['settingsConfigFile']):
		importedSettings = readSettingsFile(settingsFile)
		settings = flannelfox.tools.dictMerge(getSettings(), json.loads(importedSettings))

updateSettings()


text:
${CommonNls.add}

${Nls.displayAs}

${Nls.aDrowdownList}

${Nls.aExpandedList}

Load more data


text:
use warnings;
#use LWP::Simple;
use LWP 5.64;

#
# Copyright (c) 2005 Richard Cameron, CiteULike.org
# All rights reserved.
#
# 05/oct/2006 Marcus Granado <mrc.gran(@)gmail.com>
#   - added support for cookies,required by new springerlink.com portal
#
# This code is derived from software contributed to CiteULike.org
# 	Fergus Gallagher <fergus.gallagher@citeulike.org>
#
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
# 3. All advertising materials mentioning features or use of this software
#    must display the following acknowledgement:
#        This product includes software developed by
#		 CiteULike <http://www.citeulike.org> and its
#		 contributors.
# 4. Neither the name of CiteULike nor the names of its
#    contributors may be used to endorse or promote products derived
#    from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY CITEULIKE.ORG AND CONTRIBUTORS
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

binmode STDOUT, ":utf8";

my $browser = LWP::UserAgent->new;
$browser->cookie_jar({}); #springerlink.com expects we store cookies

$url = <>;
chomp($url);

#let's emulate better some browser headers
my @ns_headers = (
   'User-Agent' => 'Mozilla/4.76 [en] (Win98; U)',
   'Accept' => 'image/gif, image/x-xbitmap, image/jpeg,
        image/pjpeg, image/png, */*',
   'Accept-Charset' => 'iso-8859-1,*,utf-8',
   'Accept-Language' => 'en-US',
  );

# strip query part
$url =~ s/\?.*$//;

$url =~ m{^http://www\.cell\.com/(?:([^/]+)(?:/))*?abstract/(.*)$};

my ($journal, $pii) = ($1 || "", $2 || "" );

if (!$pii) {
	print "status\terr\tUnable to recognise this URL as a valid CELL abstract\n";
	exit;
}

# sometime the () are url-encoded
$pii = urldecode($pii);

# print "$journal :: $pii\n";

my $pii_enc = urlencode($pii);

my $url_ris = "http://www.cell.com/citationexport?format=cite-abs&citation-type=RIS&pii=$pii_enc&action=download&Submit=Export";

my $response = $browser->get("$url_ris",@ns_headers) || (print "status\terr\tCould not retrieve information from the specified page. Try posting the article from the abstract page.\n" and exit);

my $ris = $response->content;

print "begin_tsv\n";
print "linkout\tCELL\t\t$journal\t\t$pii\n";
if ($ris =~ m{DOI\s+-\s+([^\r\n]+)}) {
	print "linkout\tDOI\t\t$1\t\t\n";
}
print "end_tsv\n";
print "begin_ris\n";
print "$ris\n";
print "end_ris\n";
print "status\tok\n";

exit 0;

#<urlencode>####################################################################
sub urlencode {
	use URI::Escape qw( uri_escape_utf8 );
	return uri_escape_utf8( $_[0] );
}
sub urldecode {
	use URI::Escape qw( uri_unescape );
	return uri_unescape( $_[0] );
}


text:
module RuboCop
  module Cop
    module Style
      # This cop looks for uses of Perl-style regexp match
      # backreferences like $1, $2, etc.
      class PerlBackrefs < Cop
        MSG = 'Avoid the use of Perl-style backrefs.'

        def on_nth_ref(node)
          add_offense(node, :expression)
        end

        def autocorrect(node)
          @corrections << lambda do |corrector|
            backref, = *node
            parent_type = node.parent ? node.parent.type : nil
            if [:dstr, :xstr, :regexp].include?(parent_type)
              corrector.replace(node.loc.expression,
                                "{Regexp.last_match[#{backref}]}")
            else
              corrector.replace(node.loc.expression,
                                "Regexp.last_match[#{backref}]")
            end
          end
        end
      end
    end
  end
end


text:
using OrchardCore.Deployment;
using OrchardCore.DisplayManagement.Handlers;
using OrchardCore.DisplayManagement.Views;

namespace OrchardCore.Lucene.Deployment
{
    public class LuceneSettingsDeploymentStepDriver : DisplayDriver<DeploymentStep, LuceneSettingsDeploymentStep>
    {
        public override IDisplayResult Display(LuceneSettingsDeploymentStep step)
        {
            return
                Combine(
                    View("LuceneSettingsDeploymentStep_Fields_Summary", step).Location("Summary", "Content"),
                    View("LuceneSettingsDeploymentStep_Fields_Thumbnail", step).Location("Thumbnail", "Content")
                );
        }

        public override IDisplayResult Edit(LuceneSettingsDeploymentStep step)
        {
            return View("LuceneSettingsDeploymentStep_Fields_Edit", step).Location("Content");
        }
    }
}


text:
<?php
namespace UpCloo\Controller;

trait ServiceManager
{
    private $services;

    public function services()
    {
        return $this->services;
    }

    public function setServiceManager($serviceManager)
    {
        $this->services = $serviceManager;
    }

    public function get($key)
    {
        return $this->services()->get($key);
    }
}


text:
package com.yuntongxun.ecdemo.ui;

import java.util.ArrayList;
import java.util.List;

import android.app.Dialog;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.media.AudioManager;
import android.os.IBinder;
import android.support.v4.app.FragmentActivity;
import android.text.SpannableString;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.FrameLayout;
import android.widget.LinearLayout;

import com.patr.radix.R;
import com.yuntongxun.ecdemo.common.AudioManagerTools;
import com.yuntongxun.ecdemo.common.base.CCPLayoutListenerView;
import com.yuntongxun.ecdemo.common.utils.EmoticonUtil;
import com.yuntongxun.ecdemo.common.utils.LogUtil;
import com.yuntongxun.ecdemo.common.view.TopBarView;
import com.yuntongxun.ecdemo.common.view.VerticalImageSpan;

/**
 * 界面处理
 * Created by Jorstin on 2015/3/17.
 */
public abstract class CCPActivityBase {

    private FragmentActivity mActionBarActivity;

    private AudioManager mAudioManager ;

    /**
     * CCPActivity root view
     */
    private View mContentView;

    private LayoutInflater mLayoutInflater;

    /**
     * CCPActivity root View container
     */
    private FrameLayout mContentFrameLayout;

    /**
     * Manager dialog.
     */
    private List<Dialog> mAppDialogCache ;

    /**
     * The volume of music
     */
    private int mMusicMaxVolume;
    public View mBaseLayoutView;
    private View mTransLayerView;

    public CharSequence mTitleText;
    /**
     * The client mute, do not accept message Notification
     */
    private VerticalImageSpan mMuteIcon;

    /**
     * 标题
     */
    private View mTopBarView;
    /**
     * Whether the mute of receive new message
     */
    private boolean isMute = false;

    public void init(Context context , FragmentActivity activity)  {
        mActionBarActivity = activity;
        onInit();

        mAudioManager = AudioManagerTools.getInstance().getAudioManager();
        mMusicMaxVolume = mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);

        int layoutId = getLayoutId();
        mLayoutInflater = LayoutInflater.from(mActionBarActivity);
        mBaseLayoutView = mLayoutInflater.inflate(R.layout.ccp_activity, null);
        mTransLayerView = mBaseLayoutView.findViewById(R.id.ccp_trans_layer);
        LinearLayout mRootView = (LinearLayout) mBaseLayoutView.findViewById(R.id.ccp_root_view);
        mContentFrameLayout = (FrameLayout) mBaseLayoutView.findViewById(R.id.ccp_content_fl);

        if(getTitleLayout() != -1) {
            mTopBarView = mLayoutInflater.inflate(getTitleLayout() , null);
            mRootView.addView(mTopBarView,
                    LinearLayout.LayoutParams.MATCH_PARENT,
                    LinearLayout.LayoutParams.WRAP_CONTENT);
        }

        if (layoutId != -1) {

            mContentView = getContentLayoutView();
            if(mContentView == null) {
                mContentView = mLayoutInflater.inflate(getLayoutId(), null);
            }
            mRootView.addView(mContentView, LinearLayout.LayoutParams.MATCH_PARENT,
                    LinearLayout.LayoutParams.MATCH_PARENT);
        }

        dealContentView(mBaseLayoutView);

        CCPLayoutListenerView listenerView = (CCPLayoutListenerView) mActionBarActivity.findViewById(R.id.ccp_content_fl);
        if (listenerView != null && mActionBarActivity.getWindow().getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE) {
            listenerView.setOnSizeChangedListener(new CCPLayoutListenerView.OnCCPViewSizeChangedListener() {

                @Override
                public void onSizeChanged(int w, int h, int oldw, int oldh) {
                    LogUtil.d(LogUtil.getLogUtilsTag(getClass()), "oldh - h = " + (oldh - h));
                }
            });

        }
    }

    /**
     * hideTitleView
     */
    public final void hideTitleView() {
        LogUtil.d(LogUtil.getLogUtilsTag(ECSuperActivity.class), "hideTitleView hasTitle :" + (mTopBarView != null? true: false));
        if(mTopBarView != null) {
            mTopBarView.setVisibility(View.GONE);
        }
    }

    /**
     * showTitleView
     */
    public final void showTitleView() {
        LogUtil.d(LogUtil.getLogUtilsTag(ECSuperActivity.class), "showTitleView hasTitle :" + (mTopBarView != null? true: false));
        if(mTopBarView != null) {
            mTopBarView.setVisibility(View.VISIBLE);
        }
    }

    /**
     * isTitleShowing
     * @return
     */
    public final boolean isTitleShowing() {
        LogUtil.d(LogUtil.getLogUtilsTag(ECSuperActivity.class), "isTitleShowing hasTitle :" + (mTopBarView != null? true: false));
        if(mTopBarView == null) {
            return  false;
        }

        return mTopBarView.getVisibility() == View.VISIBLE;
    }

    /**
     * The height of acitonBar
     * @return
     */
    public final int getActionBarHeight() {
        if(mTopBarView == null) {
            return 0;
        }

        return mTopBarView.getHeight();
    }

    /**
     *
     * @return
     */
    public View getActivityLayoutView() {
        return mContentView;
    }

    public View getContentView() {
        return mBaseLayoutView;
    }

    /**
     *
     * @param visiable
     */
    public void setActionBarVisiable(int visiable) {
        if(mTopBarView == null) {
            return ;
        }
        if(visiable == View.VISIBLE) {
            showTitleView();
            return ;
        }
        hideTitleView();
    }

    /**
     *
     * @return
     */
    public FragmentActivity getFragmentActivity() {
        return mActionBarActivity;
    }

    /**
     *
     * @param contentDescription
     */
    public final void setActionContentDescription(CharSequence contentDescription) {
        if(TextUtils.isEmpty(contentDescription)) {
            return;
        }
        String description = mActionBarActivity.getString(R.string.common_enter_activity) + contentDescription;
        mActionBarActivity.getWindow().getDecorView().setContentDescription(description);
    }

    /**
     *
     */
    public void toggleSoftInput() {
        final FragmentActivity activity = mActionBarActivity;
        // Display the soft keyboard
        InputMethodManager inputMethodManager = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
        if (inputMethodManager != null) {
            View localView = activity.getCurrentFocus();
            if (localView != null && localView.getWindowToken() != null) {
                inputMethodManager.toggleSoftInput(0,InputMethodManager.HIDE_NOT_ALWAYS);
            }
        }
    }

    /**
     * hide input method.
     */
    public void hideSoftKeyboard(View view) {
        if (view == null) {
            return;
        }

        InputMethodManager inputMethodManager = (InputMethodManager) mActionBarActivity.getSystemService(Context.INPUT_METHOD_SERVICE);
        if (inputMethodManager != null) {
            IBinder localIBinder = view.getWindowToken();
            if (localIBinder != null)
                inputMethodManager.hideSoftInputFromWindow(localIBinder, 0);
        }
    }

    /**
     * hide inputMethod
     */
    public void hideSoftKeyboard() {
        InputMethodManager inputMethodManager = (InputMethodManager) mActionBarActivity.getSystemService(Context.INPUT_METHOD_SERVICE);
        if(inputMethodManager != null ) {
            View localView = mActionBarActivity.getCurrentFocus();
            if(localView != null && localView.getWindowToken() != null ) {
                IBinder windowToken = localView.getWindowToken();
                inputMethodManager.hideSoftInputFromWindow(windowToken, 0);
            }
        }
    }

    public final void setRootConsumeWatcher(CCPLayoutListenerView layoutListenerView) {
        if (!(this.mContentFrameLayout instanceof CCPLayoutListenerView)) {
            return;
        }
        ((CCPLayoutListenerView) this.mContentFrameLayout).setRootConsumeWatcher();
    }

    /**
     *
     * @return
     */
    public int getStreamMaxVolume() {
        return mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
    }

    /**
     *
     * @return
     */
    public int getStreamVolume() {
        return mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
    }

    /**
     * 设置ActionBar标题
     * @param title
     */
    public final void setActionBarTitle(CharSequence title) {
        if(mTopBarView == null) {
            return;
        }

        mTitleText = title;
        if(mTopBarView instanceof TopBarView) {
            ((TopBarView) mTopBarView ).setTitle(title!= null ?title.toString():"");
        }
        setActionContentDescription(title);
    }

    /**
     *
     * @return
     */
    public final CharSequence getActionBarTitle() {
        return mTitleText;
    }

    /**
     *
     * @return
     */
    public final TopBarView getTitleBar() {
        return (TopBarView)mTopBarView;
    }

    /**
     *
     * @param keyCode
     * @param event
     * @return
     */
    public boolean onKeyDown(int keyCode, KeyEvent event) {

        if((event.getKeyCode() == KeyEvent.KEYCODE_VOLUME_UP)
                && mAudioManager != null) {
            int streamVolume = mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC);

            if(streamVolume >= mMusicMaxVolume) {
                LogUtil.d(LogUtil.getLogUtilsTag(BaseFragment.class), "has set the max volume");
                return true;
            }

            int mean = mMusicMaxVolume / 7;
            if(mean == 0) {
                mean = 1;
            }

            mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC,
                    streamVolume + mean, AudioManager.FLAG_PLAY_SOUND
                            | AudioManager.FLAG_SHOW_UI);
        }
        if((event.getKeyCode() == KeyEvent.KEYCODE_VOLUME_DOWN)
                && mAudioManager != null) {
            int streamVolume = mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
            int mean = mMusicMaxVolume / 7;
            if(mean == 0) {
                mean = 1;
            }

            mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC,
                    streamVolume - mean, AudioManager.FLAG_PLAY_SOUND
                            | AudioManager.FLAG_SHOW_UI);
            return true;
        }
        return false;
    }

    /**
     *
     * @param keyCode
     * @param event
     * @return
     */
    public boolean onKeyUp(int keyCode, KeyEvent event) {

        if(keyCode == KeyEvent.KEYCODE_MENU && event.getAction() == KeyEvent.ACTION_UP) {
			/*if(mOverFlowAction != null && mOverFlowAction.isEnabled()) {
				callMenuCallback(mOverFlowMenuItem, mOverFlowAction);
				return true;
			}*/
        }
        return false;
    }

    public void onResume(){

    }

    public void onPause(){

    }

    /**
     *
     */
    public void onDestroy() {
        releaseDialogList();
        mAudioManager = null;
        mTopBarView = null;
    }

    /**
     *
     */
    private void releaseDialogList() {
        if(mAppDialogCache == null) {
            return;
        }

        for(Dialog dialog : mAppDialogCache) {
            if(dialog == null || !dialog.isShowing()) {
                continue;
            }
            dialog.dismiss();
        }
        mAppDialogCache.clear();
        mAppDialogCache = null;
    }

    /**
     * 子类重载该方法自定义标题布局文件
     * @return
     */
    public int getTitleLayout() {
        return R.layout.ec_title_view_base;
    }

    public TopBarView getTopBarView() {
        if(mTopBarView instanceof TopBarView) {
            return (TopBarView) mTopBarView;
        }
        return null;
    }

    protected abstract void onInit();

    /**
     * The sub Activity implement, set the Ui Layout
     * @return
     */
    protected abstract int getLayoutId();
    protected abstract View getContentLayoutView();
    protected abstract String getClassName();

    /**
     *
     */
    protected abstract void dealContentView(View contentView);

    public void addDialog(Dialog dialog) {
        if(dialog == null) {
            return;
        }

        if(mAppDialogCache == null) {
            mAppDialogCache = new ArrayList<Dialog>();
        }
        mAppDialogCache.add(dialog);
    }

    /**
     *
     */
    protected SpannableString buildActionTitle() {
        int dimensionPixelSize = mActionBarActivity.getResources().getDimensionPixelSize(R.dimen.BigTextSize);

        int mutIndex = 0;
        String format = "%s";
        if(isMute) {
            format = format + " #";
            mutIndex += 2;
        }

        SpannableString spannableString = EmoticonUtil.getTextFormat(mActionBarActivity, String.format(format, new Object[]{mTitleText}), dimensionPixelSize);
        if(isMute) {
            if(mMuteIcon == null) {
                mMuteIcon = getTitleIconTips(dimensionPixelSize, R.drawable.chat_mute_notify_title_icon);
            }
            int length = spannableString.length() - mutIndex + 1;
            spannableString.setSpan(mMuteIcon, length, length + 1, SpannableStringBuilder.SPAN_POINT_MARK);
        }
        return spannableString;
    }

    /**
     *
     * @param padding
     * @param iconRes
     * @return
     */
    private VerticalImageSpan getTitleIconTips(int padding , int iconRes) {
        Drawable drawable = mActionBarActivity.getResources().getDrawable(iconRes);
        drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
        VerticalImageSpan imageSpan = new VerticalImageSpan(drawable);
        imageSpan.setPadding((drawable.getIntrinsicHeight() - padding) / 2);
        return imageSpan;
    }

    /**
     *
     * @param mute
     */
    public CharSequence setMute(boolean mute) {
        isMute = mute;
        return buildActionTitle();
    }

    /**
     *
     */
    public final void invalidateActionMenu() {
        mActionBarActivity.supportInvalidateOptionsMenu();
    }

    public void setScreenEnable(boolean screenEnable) {

    }

    public void onStart() {

    }
}


text:
EpubForge::Utils::HtmlTranslator.new do
  name       :fallback_html
  format     :html
  group      :fallback
  executable "false"
  cmd        "cat {{f}}"
end


text:
export class QuantumLog {
    public static spinStart(text: string) {
        //log.bold().startSpinner('loading...')
    }

    public static spinStop() {
        //log.stopSpinner();
    }
}


text:
<!DOCTYPE html>

	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=500" />
	<meta name="keywords" content="ScrollMagic, example, scrolling, attaching, scrollbar, mobile, support, scroll, event" />
	<meta name="author"	content="Jan Paepke (www.janpaepke.de)" />
	<title>Mobile Support (Basic) - ScrollMagic</title>

	<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700,400italic|Josefin+Slab:400,700italic' rel='stylesheet' type='text/css'>
	<link rel="stylesheet" href="../../css/normalize.css" type="text/css">
	<link rel="stylesheet" href="../../css/style.css" type="text/css">
	<link rel="stylesheet" href="../../css/examples.css" type="text/css">
	<link rel="shortcut icon" href="../../img/favicon.ico" type="image/x-icon">

Mobile Support (Basic)

Try this page on your mobile device!

							Note: This does not concern iOS  8+, as it finally supports real scroll events.

							ScrollMagic works just as well on mobile devices.

							One big drawback is that mobile devices dispatch the scroll event AFTER the scroll is complete and not DURING.

							To get support for on-the-fly updates the easiest way is to wrap all your content into a big container with the size of the viewport and scroll within it instead (like shown in this example).

							Unfortunately this also results in loosing the scroll momentum. To see how you can preserve it check "Mobile Support (advanced)".


text:
layout: page
title: Snow Aerospace Party
date: 2016-05-24
author: Grace Hogan
tags: weekly links, java
status: published
summary: Phasellus non ornare enim. Sed fringilla vestibulum.
banner: images/banner/office-01.jpg
booking:
  startDate: 01/01/2018
  endDate: 01/02/2018
  ctyhocn: SUXOCHX
  groupCode: SAP
published: true
---
Phasellus vitae mi cursus, consectetur est in, consequat turpis. Vivamus a vehicula est, vitae elementum odio. Maecenas tempor faucibus metus ac auctor. Nunc ullamcorper magna dictum, consectetur augue accumsan, convallis tortor. Sed sed est dui. Praesent ultricies erat sed lorem scelerisque, eget commodo est sagittis. Vestibulum sollicitudin purus pretium, aliquet augue non, consequat orci.
Donec varius augue ac porttitor scelerisque. Suspendisse consequat ex mi, at dapibus nisl semper in. Aenean euismod dui lectus, non maximus turpis efficitur in. Integer at turpis eros. Donec urna mi, porta ut iaculis ac, eleifend et dui. Duis et iaculis erat, vel finibus felis. Morbi at neque luctus, imperdiet turpis vitae, efficitur sem. Sed gravida augue vitae ipsum luctus facilisis. Vivamus ornare et velit at euismod. Quisque auctor egestas facilisis. Sed nec fringilla lacus.

* Aliquam a leo et metus laoreet semper
* Nam consequat diam ut metus rutrum laoreet
* Donec vitae mi quis ex hendrerit consequat.

Aliquam ante urna, congue nec est sollicitudin, varius condimentum purus. Donec congue elementum lorem at tincidunt. Nunc condimentum porta elit non euismod. Etiam ultrices aliquet ornare. Sed sit amet neque vitae enim porttitor lobortis sed id metus. Mauris volutpat tincidunt metus et scelerisque. Donec semper neque tellus, finibus posuere leo porta eget. Integer aliquet tellus vitae purus convallis tristique. Nunc a lacinia tortor, non tempus ante. Duis dictum vitae lorem id semper. Sed dui orci, interdum eu enim nec, aliquam ultricies ipsum. In eu pulvinar lectus, id efficitur nunc.