Dataset Preview
The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
The dataset generation failed
Error code: DatasetGenerationError
Exception: TypeError
Message: Couldn't cast array of type
struct<content_hash: string, timestamp: string, source: string, line_count: int64, max_line_length: int64, avg_line_length: double, alnum_prop: double, repo_name: string, id: string, size: string, binary: bool, copies: string, ref: string, path: string, mode: string, license: string, language: list<item: struct<name: string, bytes: string>>, symlink_target: string>
to
{'content_hash': Value(dtype='string', id=None), 'timestamp': Value(dtype='string', id=None), 'source': Value(dtype='string', id=None), 'line_count': Value(dtype='int64', id=None), 'max_line_length': Value(dtype='int64', id=None), 'avg_line_length': Value(dtype='float64', id=None), 'alnum_prop': Value(dtype='float64', id=None), 'repo_name': Value(dtype='string', id=None), 'id': Value(dtype='string', id=None), 'size': Value(dtype='string', id=None), 'binary': Value(dtype='bool', id=None), 'copies': Value(dtype='string', id=None), 'ref': Value(dtype='string', id=None), 'path': Value(dtype='string', id=None), 'mode': Value(dtype='string', id=None), 'license': Value(dtype='string', id=None), 'language': [{'name': Value(dtype='string', id=None), 'bytes': Value(dtype='string', id=None)}]}
Traceback: Traceback (most recent call last):
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 2011, in _prepare_split_single
writer.write_table(table)
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/arrow_writer.py", line 585, in write_table
pa_table = table_cast(pa_table, self._schema)
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 2302, in table_cast
return cast_table_to_schema(table, schema)
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 2261, in cast_table_to_schema
arrays = [cast_array_to_feature(table[name], feature) for name, feature in features.items()]
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 2261, in <listcomp>
arrays = [cast_array_to_feature(table[name], feature) for name, feature in features.items()]
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 1802, in wrapper
return pa.chunked_array([func(chunk, *args, **kwargs) for chunk in array.chunks])
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 1802, in <listcomp>
return pa.chunked_array([func(chunk, *args, **kwargs) for chunk in array.chunks])
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 2122, in cast_array_to_feature
raise TypeError(f"Couldn't cast array of type\n{_short_str(array.type)}\nto\n{_short_str(feature)}")
TypeError: Couldn't cast array of type
struct<content_hash: string, timestamp: string, source: string, line_count: int64, max_line_length: int64, avg_line_length: double, alnum_prop: double, repo_name: string, id: string, size: string, binary: bool, copies: string, ref: string, path: string, mode: string, license: string, language: list<item: struct<name: string, bytes: string>>, symlink_target: string>
to
{'content_hash': Value(dtype='string', id=None), 'timestamp': Value(dtype='string', id=None), 'source': Value(dtype='string', id=None), 'line_count': Value(dtype='int64', id=None), 'max_line_length': Value(dtype='int64', id=None), 'avg_line_length': Value(dtype='float64', id=None), 'alnum_prop': Value(dtype='float64', id=None), 'repo_name': Value(dtype='string', id=None), 'id': Value(dtype='string', id=None), 'size': Value(dtype='string', id=None), 'binary': Value(dtype='bool', id=None), 'copies': Value(dtype='string', id=None), 'ref': Value(dtype='string', id=None), 'path': Value(dtype='string', id=None), 'mode': Value(dtype='string', id=None), 'license': Value(dtype='string', id=None), 'language': [{'name': Value(dtype='string', id=None), 'bytes': Value(dtype='string', id=None)}]}
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1529, in compute_config_parquet_and_info_response
parquet_operations = convert_to_parquet(builder)
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1154, in convert_to_parquet
builder.download_and_prepare(
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1027, in download_and_prepare
self._download_and_prepare(
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1122, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1882, in _prepare_split
for job_id, done, content in self._prepare_split_single(
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 2038, in _prepare_split_single
raise DatasetGenerationError("An error occurred while generating the dataset") from e
datasets.exceptions.DatasetGenerationError: An error occurred while generating the datasetNeed help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
text
string | meta
dict |
|---|---|
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JianShuCore.Model
{
public class FollowResult : BaseResult
{
[JsonProperty("following_count")]
private int FollowingCount
{
get;
set;
}
[JsonProperty("followers_count")]
private int FollowersCount
{
get;
set;
}
}
}
|
{
"content_hash": "325ddafe77e6680501f7bc94d9b2f344",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 42,
"avg_line_length": 18.884615384615383,
"alnum_prop": 0.5784114052953157,
"repo_name": "youngytj/uwp_AiJianShu",
"id": "3f6eab89b98acda4973625da24b02dd3b23f86e4",
"size": "493",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "JianShuCore/Model/FollowResult.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "397383"
}
]
}
|
/**
* vishnucss toggleeee - v1.3.3
* https://vishnucss.github.io/vishnu#toggle
*/
/*
* Variables
*/
:root {
/* Typography */
--base-font-family: -apple-system, BlinkMacSystemFont, Avenir, "Avenir Next",
"Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans",
"Droid Sans", "Helvetica Neue", sans-serif;
--base-font-size: 1.6rem;
--base-line-height: 1.5;
--base-space-size: 16px;
/* Colours */
--primary-color: #8549b9;
--secondary-color: #a460e8;
--base-color: #fff;
--base-dark-color: #282828;
--base-info-color: #2c80ff;
--base-error-color: #f93838;
--base-success-color: #0dc222;
--base-warning-color: #f2ad00;
--base-light-color: #f0f0f0;
--base-border-color: #cfcfcf;
--base-text-color: #4c4c4c;
--base-label-color: #6f6f6f;
/* Transitions */
--transition: all 0.2s ease-in-out;
/* Shadows */
--base-box-shadow: 0 0 5px 3px rgba(0, 0, 0, 0.0325);
/* Utils */
--base-radius: 4px;
--base-rounded-radius: 50%;
/* Toogle */
--toggle-transition-duration: 0.25s;
--toggle-transition-timing-function: ease;
--toggle-label-width: 48px;
--toggle-label-height: 24px;
--toggle-rail-width: 100%;
--toggle-rail-height: 100%;
--toggle-rail-background-color: var(--base-light-color);
--toggle-rail-border-radius: 9999em;
--toggle-rail-checked-background-color: var(--base-success-color);
--toggle-width: 24px;
--toggle-height: 24px;
--toggle-border-radius: 50%;
--toggle-background-color: #fff;
--toggle-box-shadow: 1px 1px 4px 2px rgba(0, 0, 0, 0.0525);
--toggle-checked-left: 25px;
/* Spacing */
--spacing-xxs: calc(16px / 6);
--spacing-xs: calc(16px / 4);
--spacing-sm: calc(16px / 2);
--spacing-md: 16px;
--spacing-lg: calc(16px + 8);
--spacing-xl: calc(16px * 2);
--spacing-xxl: calc(16px * 2 + 8);
--spacing-xxxl: calc(16px * 4);
/* Responsive breakpoints */
--responsive-sm: 25em;
--responsive-md: 48em;
--responsive-lg: 62em;
--responsive-xl: 75em;
}
/*
* Toggle
*/
/*
* Toggle
*/
/*
*
* @ custom-properties
* :--toggle .toggle;
* :--toggle-small .toggle.small;
* :--toggle-label .toggle-label;
* :--toggle-activated .toggle.activated;
* :--toggle-disabled .toggle.disabled;
* :--toggle-checked .toggle-input:checked + .toggle-label;
* :--toggle-input .toggle-input;
*
*/
.toggle {
position: relative;
display: inline-block;
}
/*
* Hide input
*/
.toggle-input {
display: none;
}
/*
* Toggle Label
*/
.toggle-label {
display: block;
width: var(--toggle-label-width);
height: var(--toggle-label-height);
text-indent: -9999px;
clip: rect(0 0 0 0);
color: transparent;
user-select: none
}
.toggle-label:before,
.toggle-label:after {
content: "";
display: block;
position: absolute;
cursor: pointer;
}
.toggle-label:before {
width: var(--toggle-rail-width);
height: var(--toggle-rail-height);
background-color: var(--toggle-rail-background-color);
border-radius: var(--toggle-rail-border-radius);
transition: background-color var(--toggle-transition-duration)
var(--toggle-transition-timing-function);
}
.toggle-label:after {
top: 0;
left: 0;
width: var(--toggle-width);
height: var(--toggle-height);
border-radius: var(--toggle-border-radius);
background-color: var(--toggle-background-color);
transition: left var(--toggle-transition-duration)
var(--toggle-transition-timing-function);
box-shadow: var(--toggle-box-shadow);
}
/*
* Toggle checked
*/
.toggle-input:checked + .toggle-label:before {
background-color: var(--toggle-rail-checked-background-color);
}
.toggle-input:checked + .toggle-label:after {
left: var(--toggle-checked-left);
}
/*
* Toggle activated
*/
.toggle.activated .toggle-label {
opacity: 1
}
.toggle.activated .toggle-label:before {
background-color: var(--base-success-color);
}
.toggle.activated .toggle-label:after {
left: 24px;
}
.toggle.activated .toggle-input:checked + .toggle-label:before {
background-color: var(--toggle-rail-background-color);
}
.toggle.activated .toggle-input:checked + .toggle-label:after {
left: 0 !important;
}
/*
* Toggle disabled
*/
.toggle.disabled {
cursor: default
}
.toggle.disabled .toggle-input:checked + .toggle-label {
opacity: 0.7
}
.toggle.disabled .toggle-input:checked + .toggle-label:before {
background-color: var(--toggle-rail-background-color);
}
.toggle.disabled .toggle-input:checked + .toggle-label:after {
left: var(--toggle-checked-left);
}
.toggle.disabled .toggle-label {
opacity: 0.7;
cursor: default
}
.toggle.disabled .toggle-label:before {
background-color: var(--toggle-rail-background-color);
cursor: default;
}
.toggle.disabled .toggle-label:after {
top: 0;
left: 0 !important;
box-shadow: var(--toggle-box-shadow);
}
/*# sourceMappingURL=vishnu.toggle.css.map */
|
{
"content_hash": "9393496646403fb7304bf57d3bb3bfbe",
"timestamp": "",
"source": "github",
"line_count": 221,
"max_line_length": 79,
"avg_line_length": 22.402714932126695,
"alnum_prop": 0.6433043829529388,
"repo_name": "vishnucss/vishnu",
"id": "0f95a45db5a81c44315ab53071bb87d917384cf5",
"size": "4951",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "packages/vishnucss-toggle/dist/vishnu.toggle.css",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "143104"
},
{
"name": "JavaScript",
"bytes": "28647"
}
]
}
|
FactoryGirl.define do
factory :post, class: Pulitzer::Post do
sequence(:title) { |n| "Winterfell news #{n}" }
association :post_type_version
after(:create) do |post_type|
post_type.create_preview_version
end
end
end
|
{
"content_hash": "fdf769ff29098c28652d3213538b48e5",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 51,
"avg_line_length": 26.88888888888889,
"alnum_prop": 0.6694214876033058,
"repo_name": "edraut/pulitzer",
"id": "ef86f22436e1e0a5d32aeae037c50438b6d41826",
"size": "242",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spec/factories/post.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "6923"
},
{
"name": "HTML",
"bytes": "77618"
},
{
"name": "JavaScript",
"bytes": "4091"
},
{
"name": "Ruby",
"bytes": "213473"
}
]
}
|
#ifndef CODA_DB_SELECT_QUERY_H
#define CODA_DB_SELECT_QUERY_H
#include "join_clause.h"
#include "query.h"
#include "resultset.h"
#include "where_clause.h"
namespace coda {
namespace db {
struct union_operator;
namespace union_op {
typedef enum {
none, all
} type;
}
/*!
* a query to select values from a table
*/
class select_query : public query, public whereable<select_query> {
private:
where_builder where_;
std::vector<join_clause> join_;
std::string limit_;
std::string orderBy_;
std::string groupBy_;
std::vector<std::string> columns_;
std::string tableName_;
std::shared_ptr<union_operator> union_;
/*!
* selects a column
* @param value the name of the column to find
* @return a reference to this
*/
select_query &column(const std::string &value) {
if (!value.empty()) {
columns_.push_back(value);
set_modified();
}
return *this;
}
/*!
* generates the sql for this query
*/
std::string generate_sql() const;
public:
/*!
* defaults to 'select *'
* @param db the database in use
*/
select_query(const std::shared_ptr<coda::db::session> &session);
/*!
* @param db the database in use
* @param tableName the table name to query
* @param columns the columns to query
*/
select_query(const std::shared_ptr<coda::db::session> &session, const std::vector<std::string> &columns);
/*!
* @param schema the schema to query
*/
select_query(const std::shared_ptr<schema> &schema);
/*!
* @param db the database in use
* @param columns the columns to query
* @param tableName the table to query from
*/
select_query(const std::shared_ptr<coda::db::session> &session, const std::vector<std::string> &columns,
const std::string &tableName);
/* boilerplate */
select_query(const select_query &other);
select_query(select_query &&other);
virtual ~select_query();
select_query &operator=(const select_query &other);
select_query &operator=(select_query &&other);
/*!
* sets which table to select from
* @param tableName the table name
* @return a reference to this instance
*/
select_query &from(const std::string &tableName);
/*!
* sets the table to select from
* @param tableName the table name to select from
* @param alias the alias for the table name
* @return a reference to this
*/
select_query &from(const std::string &tableName, const std::string &alias);
/*!
* gets the select from table name for this query
* @return the table name
*/
std::string from() const;
/*!
* sets the columns to select
* @param other a vector of column names
* @return a reference to this
*/
select_query &columns(const std::vector<std::string> &other);
/*!
* sets the columns to select
* @param value the initial column name
* @param args the remaining column names
* @return a reference to this
*/
template<typename... List>
select_query &columns(const std::string &value, const List &... args) {
column(value);
columns(args...);
return *this;
}
/*!
* @return the columns being queried
*/
std::vector<std::string> columns() const;
/*!
* gets the limit clause for the query
* @return the limit sql string
*/
std::string limit() const;
/*!
* gets the order by clause for the query
* @return the order by sql string
*/
std::string order_by() const;
/*!
* gets the group by clause for the query
* @return the group by sql string
*/
std::string group_by() const;
/*!
* gets the where builder for the query
* @return a writeable reference to the where builder
*/
where_builder &where();
/*!
* gets the where clause for this query
* @return the where clause
*/
where_builder &where(const sql_operator &value);
#ifdef ENABLE_PARAMETER_MAPPING
/*!
* adds a where clause to this query
* @param value the where clause
* @return a reference to this
*/
select_query &where(const where_clause &value);
/*!
* builds a where clause from a SQL string
* @return a reference to this
*/
where_builder &where(const std::string &sql);
/*!
* adds a where clause to this query and binds parameters to it
* @param value the sql where string
* @param args the variadic list of bind values
* @return a reference to this instance
*/
template <typename... List>
select_query &where(const std::string &value, const List &... args)
{
where(value);
bind_all(args...);
return *this;
}
/*!
* adds a where clause and binds parameters to it
* @param value the where clause
* @param args a variadic list of bind values
* @return a reference to this instance
*/
template <typename... List>
select_query &where(const where_clause &value, const List &... args)
{
where(value);
bind_all(args...);
return *this;
}
#endif
/*!
* sets the limit by clause for this query
* @param value the limit sql string
* @return a reference to this
*/
select_query &limit(const std::string &value);
/*!
* sets the order by clause for this query
* @param value the order by sql string
* @return a reference to this
*/
select_query &order_by(const std::string &value);
/*!
* sets the group by clause for this query
* @param value the group by sql string
* @return a reference to this
*/
select_query &group_by(const std::string &value);
/*!
* sets the join clause for this query
* @param tableName the table name to join
* @param type the type of join
* @return a join clause to perform additional modification
*/
join_clause &join(const std::string &tableName, join::type type = join::inner);
/*!
* sets the join clause for this query
* @param tableName the table name to join
* @param alias the alias of the table name
* @param type the type of join
* @return a reference to this
*/
join_clause &join(const std::string &tableName, const std::string &alias, join::type type = join::inner);
/*!
* sets the join clause for this query
* @param value the join clause to set
* @return a reference to this
*/
select_query &join(const join_clause &value);
/*!
* sets a union query
* @param query the query to union with
* @param type the type of union
* @return a reference to this instance
*/
select_query &union_with(const select_query &query, union_op::type type = union_op::none);
/*!
* executes this query
* @return a resultset object
*/
resultset execute();
/*!
* executes this query
* @param funk a callback to perform on the resultset
*/
void execute(const std::function<void(const resultset &)> &funk);
/*!
* executes this query
* @return a count of the number of rows
*/
long long count();
/*!
* resets this query for re-execution
*/
void reset();
/*!
* return the first column in the first row of the result set
*/
template<typename T, typename = std::enable_if<is_sql_value<T>::value || is_sql_number<T>::value>>
T execute_scalar() {
auto rs = execute();
if (!rs.is_valid()) {
return T();
}
auto row = rs.begin();
if (row == rs.end() || !row->is_valid()) {
return T();
}
auto col = row->begin();
if (col == row->end() || !col->is_valid()) {
return T();
}
return col->value();
}
};
/*!
* union's one select query with another
*/
struct union_operator {
select_query query;
union_op::type type;
/*!
* @param query the query to find
* @param type the type of union
*/
union_operator(const select_query &query, union_op::type type = union_op::none) : query(query), type(type) {
}
};
/*!
* output stream operator for a select query
*/
std::ostream &operator<<(std::ostream &out, const select_query &other);
}
}
#endif
|
{
"content_hash": "86b3611f92a93576bd6129f8b42b8217",
"timestamp": "",
"source": "github",
"line_count": 335,
"max_line_length": 120,
"avg_line_length": 31.97313432835821,
"alnum_prop": 0.47007749043039865,
"repo_name": "ryjen/arg3db",
"id": "183583276999c966848190e13e15b240607202fa",
"size": "10788",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "src/select_query.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "502493"
},
{
"name": "CMake",
"bytes": "7772"
}
]
}
|
import json
import scrapy
import pandas as pd
from DataHouse.items import Anjuke
anjuke_list = []
class QuotesSpider(scrapy.Spider):
name = "anjuke"
def start_requests(self):
urls = ['https://m.anjuke.com/wh/community/?from=trendency_rec_more&p=%d' % i for i in range(10)]
for url in urls:
yield scrapy.Request(url=url, callback=self.parse)
def parse(self, response):
for each_item in json.loads(response.text)['data']:
anjuke = Anjuke(address=each_item['address'], area=each_item['area'], block=each_item['block'],
build_year=each_item['build_year'], image=each_item['image'],
mid_price=each_item['mid_price'], name=each_item['name'],
sale_num=each_item['sale_num'], url=each_item['url'])
anjuke_list.append(anjuke)
def close(spider, reason):
df = pd.DataFrame(anjuke_list)
df.to_excel('./DataSet/anjuke_house.xlsx', sheet_name='Community')
|
{
"content_hash": "c5f29ae57a098446869306bfd8e1ed47",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 107,
"avg_line_length": 35.37931034482759,
"alnum_prop": 0.6003898635477583,
"repo_name": "EclipseXuLu/DataHouse",
"id": "72be3d5930718608ce4b9e6defbc98ec03ab0fb5",
"size": "1026",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "DataHouse/spiders/anjuke_spider.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "190631"
},
{
"name": "Shell",
"bytes": "136"
}
]
}
|
// flow-typed signature: 341b01e9a1dc136b72cdd2240f417dde
// flow-typed version: <<STUB>>/errorhandler_v1.5.0/flow_v0.43.0
/**
* This is an autogenerated libdef stub for:
*
* 'errorhandler'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'errorhandler' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
// Filename aliases
declare module 'errorhandler/index' {
declare module.exports: $Exports<'errorhandler'>;
}
declare module 'errorhandler/index.js' {
declare module.exports: $Exports<'errorhandler'>;
}
|
{
"content_hash": "8aea487db713b5f1f6baa2c35f154d09",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 77,
"avg_line_length": 26.90625,
"alnum_prop": 0.7200929152148664,
"repo_name": "InsidersByte/honeymoon-gift-list",
"id": "c0508abb07fd12c11607d1509b1b0fbfcea8c23a",
"size": "861",
"binary": false,
"copies": "2",
"ref": "refs/heads/upgrade_react_router",
"path": "flow-typed/npm/errorhandler_vx.x.x.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "4579"
},
{
"name": "HTML",
"bytes": "1131"
},
{
"name": "JavaScript",
"bytes": "154087"
}
]
}
|
using System;
namespace MeasureMap
{
/// <summary>
/// Extension methods for BenchmarkRunner
/// </summary>
public static class BenchmarkRunnerTask
{
/// <summary>
/// Sets the Task that will be benchmarked
/// </summary>
/// <param name="runner">The BenchmarkRunner</param>
/// <param name="name">The name that defines the execution</param>
/// <param name="task">The Task to benchmark</param>
/// <returns></returns>
public static ProfilerSession Task(this BenchmarkRunner runner, string name, Action task)
{
var session = ProfilerSession.StartSession()
.AppendSettings(runner.Settings)
.Task(task);
runner.AddSession(name, session);
return session;
}
/// <summary>
/// Sets the Task that will be benchmarked
/// </summary>
/// <param name="runner">The BenchmarkRunner</param>
/// <param name="name">The name that defines the execution</param>
/// <param name="task">The Task to benchmark</param>
/// <returns></returns>
public static ProfilerSession Task<T>(this BenchmarkRunner runner, string name, Func<T, T> task)
{
var session = ProfilerSession.StartSession()
.AppendSettings(runner.Settings)
.Task(task);
runner.AddSession(name, session);
return session;
}
/// <summary>
/// Sets the Task that will be benchmarked
/// </summary>
/// <param name="runner">The BenchmarkRunner</param>
/// <param name="name">The name that defines the execution</param>
/// <param name="task">The Task to benchmark</param>
/// <param name="parameter">The parameter that is passed to the tasks</param>
/// <returns></returns>
public static ProfilerSession Task<T>(this BenchmarkRunner runner, string name, Func<T, T> task, T parameter)
{
var session = ProfilerSession.StartSession()
.AppendSettings(runner.Settings)
.Task(task, parameter);
runner.AddSession(name, session);
return session;
}
/// <summary>
/// Sets the Task that will be benchmarked
/// </summary>
/// <param name="runner">The BenchmarkRunner</param>
/// <param name="name">The name that defines the execution</param>
/// <param name="task">The Task to benchmark</param>
/// <returns></returns>
public static ProfilerSession Task(this BenchmarkRunner runner, string name, Action<IExecutionContext> task)
{
var session = ProfilerSession.StartSession()
.AppendSettings(runner.Settings)
.Task(task);
runner.AddSession(name, session);
return session;
}
/// <summary>
/// Sets the Task that will be benchmarked
/// </summary>
/// <param name="runner">The BenchmarkRunner</param>
/// <param name="name">The name that defines the execution</param>
/// <param name="task">The Task to benchmark</param>
/// <returns></returns>
public static ProfilerSession Task<T>(this BenchmarkRunner runner, string name, Func<IExecutionContext, T> task)
{
var session = ProfilerSession.StartSession()
.AppendSettings(runner.Settings)
.Task(task);
runner.AddSession(name, session);
return session;
}
}
}
|
{
"content_hash": "e48e2a50c0858e0c280cdbf2b7718643",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 120,
"avg_line_length": 35.84158415841584,
"alnum_prop": 0.5748618784530387,
"repo_name": "WickedFlame/MeasureMap",
"id": "fadb00c9bd6330ef6da19b59fa0635f9012cf11c",
"size": "3622",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/MeasureMap/BenchmarkRunnerTask.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "207"
},
{
"name": "C#",
"bytes": "316739"
},
{
"name": "PowerShell",
"bytes": "2958"
},
{
"name": "Shell",
"bytes": "2280"
}
]
}
|
package org.elasticsearch.xpack.sql.expression.function.scalar.datetime;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.xpack.ql.expression.Expression;
import org.elasticsearch.xpack.ql.expression.function.scalar.FunctionTestUtils;
import org.elasticsearch.xpack.ql.expression.gen.pipeline.BinaryPipe;
import org.elasticsearch.xpack.ql.expression.gen.pipeline.Pipe;
import org.elasticsearch.xpack.ql.tree.AbstractNodeTestCase;
import org.elasticsearch.xpack.ql.tree.Source;
import org.elasticsearch.xpack.ql.tree.SourceTests;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.function.Function;
import static org.elasticsearch.xpack.ql.expression.Expressions.pipe;
import static org.elasticsearch.xpack.ql.expression.function.scalar.FunctionTestUtils.randomStringLiteral;
import static org.elasticsearch.xpack.ql.tree.SourceTests.randomSource;
import static org.elasticsearch.xpack.sql.expression.function.scalar.datetime.DateTimeParseProcessor.Parser;
public class DateTimeParsePipeTests extends AbstractNodeTestCase<DateTimeParsePipe, Pipe> {
public static DateTimeParsePipe randomDateTimeParsePipe() {
List<Pipe> functions = new ArrayList<>();
functions.add(new DateTimeParse(
randomSource(),
randomStringLiteral(),
randomStringLiteral(),
randomZone()
).makePipe());
functions.add(new TimeParse(
randomSource(),
randomStringLiteral(),
randomStringLiteral(),
randomZone()
).makePipe());
return (DateTimeParsePipe) randomFrom(functions);
}
@Override
protected DateTimeParsePipe randomInstance() {
return randomDateTimeParsePipe();
}
private Expression randomDateTimeParsePipeExpression() {
return randomDateTimeParsePipe().expression();
}
@Override
public void testTransform() {
// test transforming only the properties (source, expression),
// skipping the children (the two parameters of the binary function) which are tested separately
DateTimeParsePipe b1 = randomInstance();
Expression newExpression = randomValueOtherThan(b1.expression(), this::randomDateTimeParsePipeExpression);
DateTimeParsePipe newB = new DateTimeParsePipe(
b1.source(),
newExpression,
b1.left(),
b1.right(),
b1.zoneId(),
b1.parser());
assertEquals(newB, b1.transformPropertiesOnly(v -> Objects.equals(v, b1.expression()) ? newExpression : v, Expression.class));
DateTimeParsePipe b2 = randomInstance();
Source newLoc = randomValueOtherThan(b2.source(), SourceTests::randomSource);
newB = new DateTimeParsePipe(newLoc, b2.expression(), b2.left(), b2.right(), b2.zoneId(), b2.parser());
assertEquals(newB, b2.transformPropertiesOnly(v -> Objects.equals(v, b2.source()) ? newLoc : v, Source.class));
DateTimeParsePipe b3 = randomInstance();
Parser newPr = randomValueOtherThan(b3.parser(), () -> randomFrom(Parser.values()));
newB = new DateTimeParsePipe(b3.source(), b3.expression(), b3.left(), b3.right(), b3.zoneId(), newPr);
assertEquals(newB, b3.transformPropertiesOnly(v -> Objects.equals(v, b3.parser()) ? newPr : v, Parser.class));
DateTimeParsePipe b4 = randomInstance();
ZoneId newZI = randomValueOtherThan(b4.zoneId(), ESTestCase::randomZone);
newB = new DateTimeParsePipe(b3.source(), b4.expression(), b4.left(), b4.right(), newZI, b4.parser());
assertEquals(newB, b4.transformPropertiesOnly(v -> Objects.equals(v, b4.zoneId()) ? newZI : v, ZoneId.class));
}
@Override
public void testReplaceChildren() {
DateTimeParsePipe b = randomInstance();
Pipe newLeft = pipe(((Expression) randomValueOtherThan(b.left(), FunctionTestUtils::randomDatetimeLiteral)));
Pipe newRight = pipe(((Expression) randomValueOtherThan(b.right(), FunctionTestUtils::randomStringLiteral)));
DateTimeParsePipe newB = new DateTimeParsePipe(
b.source(),
b.expression(),
b.left(),
b.right(),
b.zoneId(),
b.parser());
BinaryPipe transformed = newB.replaceChildren(newLeft, b.right());
assertEquals(transformed.left(), newLeft);
assertEquals(transformed.source(), b.source());
assertEquals(transformed.expression(), b.expression());
assertEquals(transformed.right(), b.right());
transformed = newB.replaceChildren(b.left(), newRight);
assertEquals(transformed.left(), b.left());
assertEquals(transformed.source(), b.source());
assertEquals(transformed.expression(), b.expression());
assertEquals(transformed.right(), newRight);
transformed = newB.replaceChildren(newLeft, newRight);
assertEquals(transformed.left(), newLeft);
assertEquals(transformed.source(), b.source());
assertEquals(transformed.expression(), b.expression());
assertEquals(transformed.right(), newRight);
}
@Override
protected DateTimeParsePipe mutate(DateTimeParsePipe instance) {
List<Function<DateTimeParsePipe, DateTimeParsePipe>> randoms = new ArrayList<>();
randoms.add(
f -> new DateTimeParsePipe(
f.source(),
f.expression(),
pipe(((Expression) randomValueOtherThan(f.left(), FunctionTestUtils::randomDatetimeLiteral))),
f.right(),
f.zoneId(),
f.parser()
)
);
randoms.add(
f -> new DateTimeParsePipe(
f.source(),
f.expression(),
f.left(),
pipe(((Expression) randomValueOtherThan(f.right(), FunctionTestUtils::randomStringLiteral))),
f.zoneId(),
f.parser()
)
);
randoms.add(
f -> new DateTimeParsePipe(
f.source(),
f.expression(),
f.left(),
f.right(),
randomValueOtherThan(f.zoneId(), ESTestCase::randomZone),
f.parser()
)
);
randoms.add(
f -> new DateTimeParsePipe(
f.source(),
f.expression(),
pipe(((Expression) randomValueOtherThan(f.left(), FunctionTestUtils::randomDatetimeLiteral))),
pipe(((Expression) randomValueOtherThan(f.right(), FunctionTestUtils::randomStringLiteral))),
randomValueOtherThan(f.zoneId(), ESTestCase::randomZone),
f.parser()
)
);
randoms.add(
f -> new DateTimeParsePipe(
f.source(),
f.expression(),
f.left(),
f.right(),
f.zoneId(),
randomValueOtherThan(f.parser(), () -> randomFrom(Parser.values()))
)
);
return randomFrom(randoms).apply(instance);
}
@Override
protected DateTimeParsePipe copy(DateTimeParsePipe instance) {
return new DateTimeParsePipe(
instance.source(),
instance.expression(),
instance.left(),
instance.right(),
instance.zoneId(),
instance.parser());
}
}
|
{
"content_hash": "943bc3813e626d5c4f58d062a9534a6d",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 134,
"avg_line_length": 41.3027027027027,
"alnum_prop": 0.6139248789425468,
"repo_name": "uschindler/elasticsearch",
"id": "d6ada03b11421caf156a7961feb0986477d956fd",
"size": "7882",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/expression/function/scalar/datetime/DateTimeParsePipeTests.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "11082"
},
{
"name": "Batchfile",
"bytes": "11226"
},
{
"name": "Emacs Lisp",
"bytes": "3341"
},
{
"name": "FreeMarker",
"bytes": "45"
},
{
"name": "Groovy",
"bytes": "399054"
},
{
"name": "HTML",
"bytes": "2186"
},
{
"name": "Java",
"bytes": "46161265"
},
{
"name": "Perl",
"bytes": "12007"
},
{
"name": "Python",
"bytes": "19852"
},
{
"name": "Shell",
"bytes": "105144"
}
]
}
|
/**
* TaltioniAPI_GetApplicationInfo_SenderFault_FaultMessage.java
*
* This file was auto-generated from WSDL
* by the Apache Axis2 version: 1.6.2 Built on : Apr 17, 2012 (05:33:49 IST)
*/
package fi.taltioni._0._1.taltioniapi;
public class TaltioniAPI_GetApplicationInfo_SenderFault_FaultMessage extends java.lang.Exception{
private static final long serialVersionUID = 1375440886806L;
private fi.taltioni._0._1.taltioniapi.TaltioniServiceStub.SenderFault0 faultMessage;
public TaltioniAPI_GetApplicationInfo_SenderFault_FaultMessage() {
super("TaltioniAPI_GetApplicationInfo_SenderFault_FaultMessage");
}
public TaltioniAPI_GetApplicationInfo_SenderFault_FaultMessage(java.lang.String s) {
super(s);
}
public TaltioniAPI_GetApplicationInfo_SenderFault_FaultMessage(java.lang.String s, java.lang.Throwable ex) {
super(s, ex);
}
public TaltioniAPI_GetApplicationInfo_SenderFault_FaultMessage(java.lang.Throwable cause) {
super(cause);
}
public void setFaultMessage(fi.taltioni._0._1.taltioniapi.TaltioniServiceStub.SenderFault0 msg){
faultMessage = msg;
}
public fi.taltioni._0._1.taltioniapi.TaltioniServiceStub.SenderFault0 getFaultMessage(){
return faultMessage;
}
}
|
{
"content_hash": "2ded7eafc144c7fa99632f213d97200e",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 116,
"avg_line_length": 31.53488372093023,
"alnum_prop": 0.7042772861356932,
"repo_name": "Sensotrend/moves2taltioni",
"id": "ac6be31bf4f75d5a4fd78978ea953b4e3af686f7",
"size": "1356",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/fi/taltioni/_0/_1/taltioniapi/TaltioniAPI_GetApplicationInfo_SenderFault_FaultMessage.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "6075369"
}
]
}
|
/*global jQuery */
;(function( $ ){
"use strict";
/**
* Initialize the lifestream plug-in
* @param {Object} config Configuration object
*/
$.fn.lifestream = function( config ) {
// Make the plug-in chainable
return this.each(function() {
// The element where the lifestream is linked to
var outputElement = $(this),
// Extend the default settings with the values passed
settings = jQuery.extend({
// The name of the main lifestream class
// We use this for the main ul class e.g. lifestream
// and for the specific feeds e.g. lifestream-twitter
classname: "lifestream",
// Callback function which will be triggered when a feed is loaded
feedloaded: null,
// The amount of feed items you want to show
limit: 10,
// An array of feed items which you want to use
list: []
}, config),
// The data object contains all the feed items
data = {
count: settings.list.length,
items: []
},
// We use the item settings to pass the global settings variable to
// every feed
itemsettings = jQuery.extend( true, {}, settings ),
/**
* This method will be called every time a feed is loaded. This means
* that several DOM changes will occur. We did this because otherwise it
* takes to look before anything shows up.
* We allow 1 request per feed - so 1 DOM change per feed
* @private
* @param {Array} inputdata an array containing all the feeditems for a
* specific feed.
*/
finished = function( inputdata ) {
// Merge the feed items we have from other feeds, with the feeditems
// from the new feed
$.merge( data.items, inputdata );
// Sort the feeditems by date - we want the most recent one first
data.items.sort( function( a, b ) {
return ( b.date - a.date );
});
var items = data.items,
// We need to check whether the amount of current feed items is
// smaller than the main limit. This parameter will be used in the
// for loop
length = ( items.length < settings.limit ) ?
items.length :
settings.limit,
i = 0, item,
// We create an unordered list which will create all the feed
// items
ul = $('<ul class="' + settings.classname + '"/>');
// Run over all the feed items + add them as list items to the
// unordered list
for ( ; i < length; i++ ) {
item = items[i];
if ( item.html ) {
$('<li class="'+ settings.classname + '-' +
item.config.service + '">').data( "name", item.config.service )
.data( "url", item.url || "#" )
.data( "time", item.date )
.append( item.html )
.appendTo( ul );
}
}
// Change the innerHTML with a list of all the feeditems in
// chronological order
outputElement.html( ul );
// Trigger the feedloaded callback, if it is a function
if ( $.isFunction( settings.feedloaded ) ) {
settings.feedloaded();
}
},
/**
* Fire up all the feeds and pass them the right arugments.
* @private
*/
load = function() {
var i = 0, j = settings.list.length;
// We don't pass the list array to each feed because this will create
// a recursive JavaScript object
delete itemsettings.list;
// Run over all the items in the list
for( ; i < j; i++ ) {
var config = settings.list[i];
// Check whether the feed exists, if the feed is a function and if a
// user has been filled in
if ( $.fn.lifestream.feeds[config.service] &&
$.isFunction( $.fn.lifestream.feeds[config.service] ) &&
config.user) {
// You'll be able to get the global settings by using
// config._settings in your feed
config._settings = itemsettings;
// Call the feed with a config object and finished callback
$.fn.lifestream.feeds[config.service]( config, finished );
}
}
};
// Load the jQuery templates plug-in if it wasn't included in the page.
// At then end we call the load method.
if( !jQuery.tmpl ) {
jQuery.getScript(
'//ajax.aspnetcdn.com/ajax/jquery.templates/beta1/' +
'jquery.tmpl.min.js',
load);
} else {
load();
}
});
};
/**
* Create a valid YQL URL by passing in a query
* @param {String} query The query you want to convert into a valid yql url
* @return {String} A valid YQL URL
*/
$.fn.lifestream.createYqlUrl = function( query ) {
return ( ('https:' === document.location.protocol ? 'https' : 'http') +
'://query.yahooapis.com/v1/public/yql?q=__QUERY__' +
'&env=' + 'store://datatables.org/alltableswithkeys&format=json')
.replace( "__QUERY__" , encodeURIComponent( query ) );
};
/**
* A big container which contains all available feeds
*/
$.fn.lifestream.feeds = $.fn.lifestream.feeds || {};
/**
* Add compatible Object.keys support in older environments that do not natively support it
* https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object/keys#section_6
*/
if(!Object.keys) {
Object.keys = function(o){
if (o !== Object(o)) {
throw new TypeError('Object.keys called on non-object');
}
var ret=[],p;
for(p in o) {
if(Object.prototype.hasOwnProperty.call(o,p)) {
ret.push(p);
}
}
return ret;
};
}
}( jQuery ));
(function($) {
$.fn.lifestream.feeds.atom = function( config, callback ) {
var template = $.extend({},
{
posted: 'posted <a href="${link.href}">${title.content}</a>'
},
config.template),
/**
* Parse the input from atom feed
*/
parseAtom = function( input ) {
var output = [], list = [], i = 0, j = 0;
if(input.query && input.query.count && input.query.count > 0) {
list = input.query.results.feed.entry;
j = list.length;
for( ; i<j; i++) {
var item = list[i];
output.push({
url: item.link.href,
date: new Date( item.updated ),
config: config,
html: $.tmpl( template.posted, item )
});
}
}
return output;
};
$.ajax({
url: $.fn.lifestream.createYqlUrl('select * from xml where url="' +
config.user + '"'),
dataType: 'jsonp',
success: function( data ) {
callback(parseAtom(data));
}
});
// Expose the template.
// We use this to check which templates are available
return {
"template" : template
};
};
})(jQuery);
(function($) {
$.fn.lifestream.feeds.bitbucket = function( config, callback ) {
var template = $.extend({},
{
commit: '<a href="http://bitbucket.org/${owner}/${name}/changeset/${node}/">committed</a> at <a href="http://bitbucket.org/${owner}/${name}/">${owner}/${name}</a>',
pullrequest_fulfilled: 'fulfilled a pull request at <a href="http://bitbucket.org/${owner}/${name}/">${owner}/${name}</a>',
pullrequest_rejected: 'rejected a pull request at <a href="http://bitbucket.org/${owner}/${name}/">${owner}/${name}</a>',
pullrequest_created: 'created a pull request at <a href="http://bitbucket.org/${owner}/${name}/">${owner}/${name}</a>',
create: 'created a new project at <a href="http://bitbucket.org/${owner}/${name}/">${owner}/${name}</a>',
fork: 'forked <a href="http://bitbucket.org/${owner}/${name}/">${owner}/${name}</a>'
},
config.template),
supported_events = [
"commit",
"pullrequest_fulfilled",
"pullrequest_rejected",
"pullrequest_created",
"create",
"fork"
],
parseBitbucketStatus = function( status ) {
if ($.inArray(status.event, supported_events) !== -1) {
//bb generates some weird create events, check for repository
if (status.repository) {
if (status.event === "commit") {
return $.tmpl( template.commit, {
owner: status.repository.owner,
name: status.repository.name,
node: status.node
});
} else {
return $.tmpl( template[status.event], {
owner: status.repository.owner,
name: status.repository.name
});
}
}
}
},
parseBitbucket = function( input ) {
var output = [];
if (input.query && input.query.count && input.query.count > 0) {
$.each(input.query.results.json, function () {
output.push({
date: new Date(this.events.created_on.replace(/-/g, '/')),
config: config,
html: parseBitbucketStatus(this.events)
});
});
}
return output;
};
$.ajax({
url: $.fn.lifestream.createYqlUrl('select events.event,' +
'events.node, events.created_on,' +
'events.repository.name, events.repository.owner ' +
'from json where url = "https://api.bitbucket.org/1.0/users/' +
config.user + '/events/"'),
dataType: 'jsonp',
success: function( data ) {
callback(parseBitbucket(data));
}
});
return {
'template' : template
};
};
})(jQuery);(function($) {
$.fn.lifestream.feeds.bitly = function( config, callback ) {
var template = $.extend({},
{
created: 'created URL <a href="${short_url}" title="${title}">' +
'${short_url}</a>'
},
config.template);
$.ajax({
url: $.fn.lifestream.createYqlUrl('select data.short_url, data.created, '+
'data.title from json where url="' +
'http://bitly.com/u/' + config.user + '.json"'),
dataType: "jsonp",
success: function( input ) {
var output = [], i = 0, j, list;
if ( input.query && input.query.count && input.query.results.json ) {
list = input.query.results.json;
j = list.length;
for( ; i < j; i++) {
var item = list[i].data;
output.push({
date: new Date(item.created * 1000),
config: config,
html: $.tmpl( template.created, item )
});
}
}
callback(output);
}
});
// Expose the template.
// We use this to check which templates are available
return {
"template" : template
};
};
})(jQuery);(function($) {
$.fn.lifestream.feeds.blogger = function( config, callback ) {
var template = $.extend({},
{
posted: 'posted <a href="${origLink}">${title}</a>'
},
config.template),
parseBlogger = function ( input ) {
var output = [], list, i = 0, j, item, k, l;
if ( input.query && input.query.count && input.query.count > 0 &&
input.query.results.feed.entry ) {
list = input.query.results.feed.entry;
j = list.length;
for ( ; i < j; i++) {
item = list[i];
if( !item.origLink ) {
k = 0;
l = item.link.length;
for ( ; k < l ; k++ ) {
if( item.link[k].rel === 'alternate' ) {
item.origLink = item.link[k].href;
}
}
}
// ignore items that have no link.
if ( item.origLink ){
if( item.title.content ) {
item.title = item.title.content;
}
output.push({
date: new Date( item.published ),
config: config,
html: $.tmpl( template.posted, item )
});
}
}
}
return output;
};
$.ajax({
url: $.fn.lifestream.createYqlUrl('select * from xml where url="http://' +
config.user + '.blogspot.com/feeds/posts/default"'),
dataType: "jsonp",
success: function ( data ) {
callback(parseBlogger(data));
}
});
// Expose the template.
// We use this to check which templates are available
return {
"template" : template
};
};
})(jQuery);(function($) {
$.fn.lifestream.feeds.citeulike = function( config, callback ) {
var template = $.extend({},
{
saved: 'saved <a href="${href}">${title}</a> by ${authors}'
},
config.template),
parseCiteulike = function( data ) {
var output = [], i = 0, j;
if(data && data.length && data.length > 0) {
j = data.length;
for( ; i<j; i++) {
var item = data[i];
output.push({
date: new Date(item.date),
config: config,
url: 'https://www.citeulike.org/user/' + config.user,
html: $.tmpl( template.saved, item )
});
}
}
return output;
};
$.ajax({
url: 'https://www.citeulike.org/json/user/' + config.user,
dataType: 'jsonp',
success: function( data ) {
callback(parseCiteulike(data));
}
});
// Expose the template.
// We use this to check which templates are available
return {
"template" : template
};
};
})(jQuery);
(function($) {
$.fn.lifestream.feeds.dailymotion = function( config, callback ) {
var template = $.extend({},
{
uploaded: 'uploaded a video <a href="${link}">${title[0]}</a>'
},
config.template),
parseDailymotion = function( input ) {
var output = [], list, i = 0, j, item;
if ( input.query && input.query.count && input.query.count > 0 &&
input.query.results.rss.channel.item ) {
list = input.query.results.rss.channel.item;
j = list.length;
for ( ; i < j; i++) {
item = list[i];
output.push({
date: new Date ( item.pubDate ),
config: config,
html: $.tmpl( template.uploaded, item )
});
}
}
return output;
};
$.ajax({
url: $.fn.lifestream.createYqlUrl('select * from xml where ' +
'url="http://www.dailymotion.com/rss/user/' + config.user + '"'),
dataType: "jsonp",
success: function( data ) {
callback(parseDailymotion(data));
}
});
// Expose the template.
// We use this to check which templates are available
return {
"template" : template
};
};
})(jQuery);(function($) {
$.fn.lifestream.feeds.delicious = function( config, callback ) {
var template = $.extend({},
{
bookmarked: 'bookmarked <a href="${u}">${d}</a>'
},
config.template);
$.ajax({
url: "https://api.del.icio.us/v2/json/" + config.user,
dataType: "jsonp",
success: function( data ) {
var output = [], i = 0, j;
if (data && data.length && data.length > 0) {
j = data.length;
for( ; i < j; i++) {
var item = data[i];
output.push({
date: new Date(item.dt),
config: config,
html: $.tmpl( template.bookmarked, item )
});
}
}
callback(output);
}
});
// Expose the template.
// We use this to check which templates are available
return {
"template" : template
};
};
})(jQuery);
(function($) {
$.fn.lifestream.feeds.deviantart = function( config, callback ) {
var template = $.extend({},
{
posted: 'posted <a href="${link}">${title}</a>'
},
config.template);
$.ajax({
url: $.fn.lifestream.createYqlUrl(
'select title,link,pubDate from rss where ' +
'url="http://backend.deviantart.com/rss.xml?q=gallery%3A' +
encodeURIComponent(config.user) +
'&type=deviation' +
'" | unique(field="title")'
),
dataType: 'jsonp',
success: function( resp ) {
var output = [],
items, item,
i = 0, j;
if (resp.query && resp.query.count > 0) {
items = resp.query.results.item;
j = items.length;
for ( ; i < j; i++) {
item = items[i];
output.push({
date: new Date(item.pubDate),
config: config,
html: $.tmpl( template.posted, item )
});
}
}
callback(output);
}
});
// Expose the template.
// We use this to check which templates are available
return {
"template" : template
};
};
})(jQuery);(function($) {
$.fn.lifestream.feeds.disqus = function( config, callback ) {
var template = $.extend({},
{
post: 'commented on <a href="${url}">${thread.title}</a>',
thread_like: 'liked <a href="${url}">${thread.title}</a>'
},
config.template),
parseDisqus = function( input ) {
var output = [], i = 0, j, item;
if(input) {
j = input.length;
for( ; i<j; i++) {
item = input[i];
// replies to your comments are included by default
if (item.type !== 'reply') {
output.push({
date: new Date( item.createdAt ),
config: config,
html: $.tmpl( template[item.type], item.object )
});
}
}
}
return output;
};
$.ajax({
url: "https://disqus.com/api/3.0/users/listActivity.json",
data: {
user: config.user,
api_key: config.key
},
dataType: 'jsonp',
success: function( data ) {
if (data.code === 2) {
callback([]);
// log error to console if not on IE
if (console && console.error) {
console.error('Error loading Disqus stream.', data.response);
}
return;
} else {
callback(parseDisqus(data.response));
}
}
});
// Expose the template.
// We use this to check which templates are available
return {
"template" : template
};
};
})(jQuery);
(function($) {
$.fn.lifestream.feeds.dribbble = function( config, callback ) {
var template = $.extend({},
{
posted: 'posted a shot <a href="${url}">${title}</a>'
},
config.template);
$.ajax({
url: "https://api.dribbble.com/players/" + config.user + "/shots",
dataType: "jsonp",
success: function( data ) {
var output = [], i = 0, j;
if(data && data.total) {
j = data.shots.length;
for( ; i<j; i++) {
var item = data.shots[i];
output.push({
date: new Date(item.created_at),
config: config,
html: $.tmpl( template.posted, item )
});
}
}
callback(output);
}
});
// Expose the template.
// We use this to check which templates are available
return {
"template" : template
};
};
})(jQuery);
(function($) {
"use strict";
$.fn.lifestream.feeds.facebook_page = function( config, callback ) {
var template = $.extend({},
{
wall_post: 'posted <a href="${url}">${text}</a>'
},
config.template);
/**
* Parse the input from facebook
*/
var parseFacebooky = function(response) {
var output = [];
if (!response.posts || !response.posts.length) {
return output;
}
for (var i = 0 ;i < response.posts.length; i++){
var post = response.posts[i];
output.push({
"date": new Date(post.time * 1000),
"config": config,
"html": $.tmpl(template.wall_post, post)
});
}
callback(output);
};
$.ajax({
url: 'https://facebooky.herokuapp.com/page/' + config.user,
success: parseFacebooky
});
// Expose the template.
// We use this to check which templates are available
return {
"template" : template
};
};
})(jQuery);
(function($) {
'use strict';
$.fn.lifestream.feeds.fancy = function( config, callback ) {
var template = $.extend({},
{
fancied: 'fancy\'d <a href="${link}">${title}</a>'
},
config.template),
parseFancy = function( input ) {
var output = [], i = 0, j;
if(input.query && input.query.count && input.query.count > 0) {
j = input.query.count;
for( ; i<j; i++) {
var item = input.query.results.item[i];
output.push({
date: new Date(item.pubDate),
config: config,
html: $.tmpl( template.fancied, item )
});
}
}
return output;
};
$.ajax({
url: $.fn.lifestream.createYqlUrl('SELECT * FROM xml ' +
'WHERE url="http://www.fancy.com/rss/' + config.user +
'" AND itemPath="/rss/channel/item"'),
dataType: 'jsonp',
success: function( data ) {
callback(parseFancy(data));
}
});
// Expose the template.
// We use this to check which templates are available
return {
"template" : template
};
};
})(jQuery);
(function($) {
$.fn.lifestream.feeds.flickr = function( config, callback ) {
var template = $.extend({},
{
posted: 'posted a photo <a href="${link}">${title}</a>'
},
config.template);
$.ajax({
url: "https://api.flickr.com/services/feeds/photos_public.gne?id=" +
config.user + "&lang=en-us&format=json",
dataType: "jsonp",
jsonp: 'jsoncallback',
success: function( data ) {
var output = [], i = 0, j;
if(data && data.items && data.items.length > 0) {
j = data.items.length;
for( ; i<j; i++) {
var item = data.items[i];
output.push({
date: new Date( item.published ),
config: config,
html: $.tmpl( template.posted, item )
});
}
}
callback(output);
}
});
// Expose the template.
// We use this to check which templates are available
return {
"template" : template
};
};
})(jQuery);
(function($) {
$.fn.lifestream.feeds.foomark = function( config, callback ) {
var template = $.extend({},
{
bookmarked: 'bookmarked <a href="${url}">${url}</a>'
},
config.template);
$.ajax({
url: "http://api.foomark.com/urls/list/",
data: {
format: "jsonp",
username: config.user
},
dataType: "jsonp",
success: function( data ) {
var output = [], i=0, j;
if( data && data.length && data.length > 0 ) {
j = data.length;
for( ; i < j; i++ ) {
var item = data[i];
output.push({
date: new Date( item.created_at.replace(/-/g, '/') ),
config: config,
html: $.tmpl( template.bookmarked, item )
});
}
}
callback( output );
}
});
// Expose the template.
// We use this to check which templates are available
return {
"template" : template
};
};
})(jQuery);
(function($) {
$.fn.lifestream.feeds.formspring = function( config, callback ) {
var template = $.extend({},
{
answered: 'answered a question <a href="${link}">${title}</a>'
},
config.template);
var parseFormspring = function ( input ) {
var output = [], list, i = 0, j, item;
if ( input.query && input.query.count && input.query.count > 0 &&
input.query.results.rss.channel.item ) {
list = input.query.results.rss.channel.item;
j = list.length;
for ( ; i < j; i++) {
item = list[i];
output.push({
date: new Date( item.pubDate ),
config: config,
html: $.tmpl( template.answered, item )
});
}
}
return output;
};
$.ajax({
url: $.fn.lifestream.createYqlUrl('select * from xml where ' +
'url="http://www.formspring.me/profile/' + config.user + '.rss"'),
dataType: "jsonp",
success: function ( data ) {
callback(parseFormspring(data));
}
});
// Expose the template.
// We use this to check which templates are available
return {
"template" : template
};
};
})(jQuery);(function($) {
$.fn.lifestream.feeds.forrst = function( config, callback ) {
var template = $.extend({},
{
posted: 'posted a ${post_type} <a href="${post_url}">${title}</a>'
},
config.template);
$.ajax({
url: "https://forrst.com/api/v2/users/posts?username=" + config.user,
dataType: "jsonp",
success: function( data ) {
var output = [], i=0, j;
if( data && data.resp.length && data.resp.length > 0 ) {
j = data.resp.length;
for( ; i < j; i++ ) {
var item = data.resp[i];
output.push({
date: new Date( item.created_at.replace(' ', 'T') ),
config: config,
html: $.tmpl( template.posted, item )
});
}
}
callback( output );
}
});
// Expose the template.
// We use this to check which templates are available
return {
"template" : template
};
};
})(jQuery);
(function($) {
$.fn.lifestream.feeds.foursquare = function( config, callback ) {
var template = $.extend({},
{
checkedin: 'checked in @ <a href="${link}">${title}</a>'
},
config.template),
parseFoursquare = function( input ) {
var output = [], i = 0, j;
if(input.query && input.query.count && input.query.count >0) {
j = input.query.count;
for( ; i<j; i++) {
var item = input.query.results.item[i];
output.push({
date: new Date(item.pubDate),
config: config,
html: $.tmpl( template.checkedin, item )
});
}
}
return output;
};
$.ajax({
url: $.fn.lifestream.createYqlUrl('select * from rss where url=' +
'"https://feeds.foursquare.com/history/' +
config.user + '.rss"'),
dataType: 'jsonp',
success: function( data ) {
callback(parseFoursquare(data));
}
});
// Expose the template.
// We use this to check which templates are available
return {
"template" : template
};
};
})(jQuery);(function($) {
$.fn.lifestream.feeds.gimmebar = function( config, callback ) {
var template = $.extend({},
{
bookmarked: 'bookmarked <a href="${short_url}">${title}</a>'
},
config.template);
$.ajax({
url: "https://gimmebar.com/api/v0/public/assets/" + config.user + ".json?jsonp_callback=?",
dataType: "json",
success: function( data ) {
data = data.records;
var output = [], i = 0, j;
if (data && data.length && data.length > 0) {
j = data.length;
for( ; i < j; i++) {
var item = data[i];
output.push({
date: new Date(item.date * 1000),
config: config,
html: $.tmpl( template.bookmarked, item )
});
}
}
callback(output);
}
});
// Expose the template.
// We use this to check which templates are available
return {
"template" : template
};
};
})(jQuery);
(function($) {
$.fn.lifestream.feeds.github = function( config, callback ) {
var template = $.extend({},
{
commitCommentEvent: 'commented on <a href="http://github.com/' +
'${status.repo.name}">${status.repo.name}</a>',
createBranchEvent: 'created branch <a href="http://github.com/' +
'${status.repo.name}/tree/${status.payload.ref}">' +
'${status.payload.ref}</a> at <a href="http://github.com/' +
'${status.repo.name}">${status.repo.name}</a>',
createRepositoryEvent: 'created repository ' +
'<a href="http://github.com/' +
'${status.repo.name}">${status.repo.name}</a>',
createTagEvent: 'created tag <a href="http://github.com/' +
'${status.repo.name}/tree/${status.payload.ref}">' +
'${status.payload.ref}</a> at <a href="http://github.com/' +
'${status.repo.name}">${status.repo.name}</a>',
deleteBranchEvent: 'deleted branch ${status.payload.ref} at ' +
'<a href="http://github.com/${status.repo.name}">' +
'${status.repo.name}</a>',
deleteTagEvent: 'deleted tag ${status.payload.ref} at ' +
'<a href="http://github.com/${status.repo.name}">' +
'${status.repo.name}</a>',
followEvent: 'started following <a href="http://github.com/' +
'${status.payload.target.login}">${status.payload.target.login}</a>',
forkEvent: 'forked <a href="http://github.com/${status.repo.name}">' +
'${status.repo.name}</a>',
gistEvent: '${status.payload.action} gist ' +
'<a href="http://gist.github.com/${status.payload.gist.id}">' +
'${status.payload.gist.id}</a>',
issueCommentEvent: 'commented on issue <a href="http://github.com/' +
'${status.repo.name}/issues/${status.payload.issue.number}">' +
'${status.payload.issue.number}</a> on <a href="http://github.com/' +
'${status.repo.name}">${status.repo.name}</a>',
issuesEvent: '${status.payload.action} issue ' +
'<a href="http://github.com/${status.repo.name}/issues/' +
'${status.payload.issue.number}">${status.payload.issue.number}</a> '+
'on <a href="http://github.com/${status.repo.name}">' +
'${status.repo.name}</a>',
pullRequestEvent: '${status.payload.action} pull request ' +
'<a href="http://github.com/${status.repo.name}/pull/' +
'${status.payload.number}">${status.payload.number}</a> on ' +
'<a href="http://github.com/${status.repo.name}">' +
'${status.repo.name}</a>',
pushEvent: 'pushed to <a href="http://github.com/${status.repo.name}' +
'/tree/${status.payload.ref}">${status.payload.ref}</a> at ' +
'<a href="http://github.com/${status.repo.name}">' +
'${status.repo.name}</a>',
watchEvent: 'started watching <a href="http://github.com/' +
'${status.repo.name}">${status.repo.name}</a>'
},
config.template),
parseGithubStatus = function( status ) {
if (status.type === 'CommitCommentEvent' ) {
return $.tmpl( template.commitCommentEvent, {status: status} );
}
else if (status.type === 'CreateEvent' &&
status.payload.ref_type === 'branch') {
return $.tmpl( template.createBranchEvent, {status: status} );
}
else if (status.type === 'CreateEvent' &&
status.payload.ref_type === 'repository') {
return $.tmpl( template.createRepositoryEvent, {status: status} );
}
else if (status.type === 'CreateEvent' &&
status.payload.ref_type === 'tag') {
return $.tmpl( template.createTagEvent, {status: status} );
}
else if (status.type === 'DeleteEvent' &&
status.payload.ref_type === 'branch') {
return $.tmpl( template.deleteBranchEvent, {status: status} );
}
else if (status.type === 'DeleteEvent' &&
status.payload.ref_type === 'tag') {
return $.tmpl( template.deleteTagEvent, {status: status} );
}
else if (status.type === 'FollowEvent' ) {
return $.tmpl( template.followEvent, {status: status} );
}
else if (status.type === 'ForkEvent' ) {
return $.tmpl( template.forkEvent, {status: status} );
}
else if (status.type === 'GistEvent' ) {
if (status.payload.action === 'create') {
status.payload.action = 'created';
} else if (status.payload.action === 'update') {
status.payload.action = 'updated';
}
return $.tmpl( template.gistEvent, {status: status} );
}
else if (status.type === 'IssueCommentEvent' ) {
return $.tmpl( template.issueCommentEvent, {status: status} );
}
else if (status.type === 'IssuesEvent' ) {
return $.tmpl( template.issuesEvent, {status: status} );
}
else if (status.type === 'PullRequestEvent' ) {
return $.tmpl( template.pullRequestEvent, {status: status} );
}
else if (status.type === 'PushEvent' ) {
status.payload.ref = status.payload.ref.split('/')[2];
return $.tmpl( template.pushEvent, {status: status} );
}
else if (status.type === 'WatchEvent' ) {
return $.tmpl( template.watchEvent, {status: status} );
}
},
parseGithub = function( input ) {
var output = [], i = 0, j;
if (input.query && input.query.count && input.query.count >0) {
j = input.query.count;
for ( ; i<j; i++) {
var status = input.query.results.json[i].json;
output.push({
date: new Date(status.created_at),
config: config,
html: parseGithubStatus(status),
url: 'https://github.com/' + config.user
});
}
}
return output;
};
$.ajax({
url: $.fn.lifestream.createYqlUrl('select ' +
'json.type, json.actor, json.repo, json.payload, json.created_at ' +
'from json where url="https://api.github.com/users/' + config.user +
'/events/public?per_page=100"'),
dataType: 'jsonp',
success: function( data ) {
callback(parseGithub(data));
}
});
// Expose the template.
// We use this to check which templates are available
return {
"template" : template
};
};
})(jQuery);
(function($) {
$.fn.lifestream.feeds.googleplus = function( config, callback ) {
var template = $.extend({},
{
posted: '<a href="${actor.url}">${actor.displayName}</a>' +
' has posted a new entry <a href="${url}" ' +
'title="${id}">${title}</a> <!--With--> ' +
'${object.replies.totalItems} replies, ' +
'${object.plusoners.totalItems} +1s, ' +
'${object.resharers.totalItems} Reshares'
},
config.template),
parseGooglePlus = function( input ) {
var output = [], i = 0, j, item;
if(input && input.items) {
j = input.items.length;
for( ; i<j; i++) {
item = input.items[i];
output.push({
date: new Date( item.published ),
config: config,
html: $.tmpl( template.posted, item )
});
}
}
return output;
};
$.ajax({
url: "https://www.googleapis.com/plus/v1/people/" + config.user +
"/activities/public",
data: {
key: config.key
},
dataType: 'jsonp',
success: function( data ) {
if (data.error) {
callback([]);
if (console && console.error) {
console.error('Error loading Google+ stream.', data.error);
}
return;
} else {
callback(parseGooglePlus(data));
}
}
});
// Expose the template.
// We use this to check which templates are available
return {
"template" : template
};
};
})(jQuery);
(function($) {
$.fn.lifestream.feeds.hypem = function( config, callback ) {
if( !config.type || config.type !== "history" || config.type !== "loved" ) { config.type = "loved"; }
var template = $.extend({},
{
loved: 'loved <a href="http://hypem.com/item/${mediaid}">${title}</a> by <a href="http://hypem.com/artist/${artist}">${artist}</a>',
history: 'listened to <a href="http://hypem.com/item/${mediaid}">${title}</a> by <a href="http://hypem.com/artist/${artist}">${artist}</a>'
},
config.template);
$.ajax({
url: "http://hypem.com/playlist/" + config.type + "/" + config.user + "/json/1/data.js",
dataType: "json",
success: function( data ) {
var output = [], i = 0, j = -1;
for (var k in data) {
if (data.hasOwnProperty(k)) {
j++;
}
}
if (data && j > 0) {
for( ; i < j; i++) {
var item = data[i];
output.push({
date: new Date( (config.type === "history" ? item.dateplayed : item.dateloved) * 1000 ),
config: config,
html: $.tmpl( (config.type === "history" ? template.history : template.loved) , item )
});
}
}
callback(output);
}
});
// Expose the template.
// We use this to check which templates are available
return {
"template" : template
};
};
})(jQuery);(function($) {
$.fn.lifestream.feeds.instapaper = function( config, callback ) {
var template = $.extend({},
{
loved: 'loved <a href="${link}">${title}</a>'
},
config.template),
parseInstapaper = function( input ) {
var output = [], list, i = 0, j, item;
if(input.query && input.query.count && input.query.count > 0 &&
input.query.results.rss.channel.item) {
list = input.query.results.rss.channel.item;
j = list.length;
for( ; i<j; i++) {
item = list[i];
output.push({
date: new Date( item.pubDate ),
config: config,
html: $.tmpl( template.loved, item )
});
}
}
return output;
};
$.ajax({
url: $.fn.lifestream.createYqlUrl('select * from xml where url=' +
'"http://www.instapaper.com/starred/rss/' +
config.user + '"'),
dataType: 'jsonp',
success: function( data ) {
callback(parseInstapaper(data));
}
});
// Expose the template.
// We use this to check which templates are available
return {
"template" : template
};
};
})(jQuery);(function($) {
$.fn.lifestream.feeds.iusethis = function( config, callback ) {
var template = $.extend({},
{
global: '${action} <a href="${link}">${what}</a> on (${os})'
},
config.template);
var parseIusethis = function( input ) {
var output = [], list, i, j, k, l, m = 0, n, item, title, actions,
action, what, os, oss = ["iPhone", "OS X", "Windows"];
if (input.query && input.query.count && input.query.count > 0 &&
input.query.results.rss) {
n = input.query.results.rss.length;
actions = ['started using', 'stopped using', 'stopped loving',
'Downloaded', 'commented on', 'updated entry for',
'started loving', 'registered'];
l = actions.length;
for( ; m < n; m++) {
os = oss[m];
list = input.query.results.rss[m].channel.item;
i = 0;
j = list.length;
for ( ; i < j; i++) {
item = list[i];
title = item.title.replace(config.user + ' ', '');
k = 0;
for( ; k < l; k++) {
if(title.indexOf(actions[k]) > -1) {
action = actions[k];
break;
}
}
what = title.split(action);
output.push({
date: new Date(item.pubDate),
config: config,
html: $.tmpl( template.global, {
action: action.toLowerCase(),
link: item.link,
what: what[1],
os: os
} )
});
}
}
}
return output;
};
$.ajax({
url: $.fn.lifestream.createYqlUrl('select * from xml where ' +
'url="http://iphone.iusethis.com/user/feed.rss/' + config.user +
'" or ' +
'url="http://osx.iusethis.com/user/feed.rss/' + config.user +
'" or ' +
'url="http://win.iusethis.com/user/feed.rss/' + config.user + '"'),
dataType: "jsonp",
success: function( data ) {
callback(parseIusethis(data));
}
});
// Expose the template.
// We use this to check which templates are available
return {
"template" : template
};
};
})(jQuery);(function($) {
$.fn.lifestream.feeds.lastfm = function( config, callback ) {
var template = $.extend({},
{
loved: 'loved <a href="${url}">${name}</a> by ' +
'<a href="${artist.url}">${artist.name}</a>'
},
config.template),
parseLastfm = function( input ) {
var output = [], list, i = 0, j;
if(input.query && input.query.count && input.query.count > 0 &&
input.query.results.lovedtracks &&
input.query.results.lovedtracks.track) {
list = input.query.results.lovedtracks.track;
j = list.length;
for( ; i<j; i++) {
var item = list[i],
itemDate = item.nowplaying ? new Date() : item.date.uts;
output.push({
date: new Date(parseInt((itemDate * 1000), 10)),
config: config,
html: $.tmpl( template.loved, item )
});
}
}
return output;
};
$.ajax({
url: $.fn.lifestream.createYqlUrl('select * from xml where url=' +
'"http://ws.audioscrobbler.com/2.0/user/' +
config.user + '/lovedtracks.xml"'),
dataType: 'jsonp',
success: function( data ) {
callback(parseLastfm(data));
}
});
// Expose the template.
// We use this to check which templates are available
return {
"template" : template
};
};
})(jQuery);
(function($) {
$.fn.lifestream.feeds.librarything = function( config, callback ) {
var template = $.extend({},
{
book: 'added <a href="http://www.librarything.com/work/book/${book.book_id}"' +
' title="${book.title} by ${book.author_fl}">' +
'${book.title} by ${book.author_fl}</a> to my library'
},
config.template),
parseLibraryThing = function( input ) {
var output = [], i = "";
if(input.books) {
// LibraryThing returns a hash that maps id to Book objects
// which leads to the following slightly weird for loop.
for (i in input.books) {
if (input.books.hasOwnProperty(i)) {
var book = input.books[i];
output.push({
date : new Date(book.entry_stamp * 1000),
config : config,
html : $.tmpl(template.book, {book : book}),
url : 'http://www.librarything.com/profile/' + config.user
});
}
}
}
return output;
};
$.ajax({
url: 'https://www.librarything.com/api_getdata.php?booksort=entry_REV&userid=' + config.user,
dataType: 'jsonp',
success: function( data ) {
callback(parseLibraryThing(data));
}
});
return {
"template" : template
};
};
})(jQuery);
(function($) {
'use strict';
$.fn.lifestream.feeds.linkedin = function( config, callback ) {
var template = $.extend({},
{
'posted': '<a href="${link}">${title}</a>'
}, config.template),
jsonpCallbackName = 'jlsLinkedinCallback' + config.user,
createYql = function(){
var query = 'SELECT * FROM feed WHERE url="' + config.url + '"';
// I bet some will not read the instructions
if(config.user) {
query += ' AND link LIKE "%' + config.user + '%"';
}
return query;
},
parseLinkedinItem = function(item) {
return {
'date': new Date(item.pubDate),
'config': config,
'html': $.tmpl(template.posted, item)
};
};
// !!! Global function for jsonp callback
window[jsonpCallbackName] = function(input) {
var output = [], i = 0;
if(input.query && input.query.count && input.query.count > 0) {
if (input.query.count === 1) {
output.push(parseLinkedinItem(input.query.results.item));
} else {
for(i; i < input.query.count; i++) {
var item = input.query.results.item[i];
output.push(parseLinkedinItem(item));
}
}
}
callback(output);
};
$.ajax({
'url': $.fn.lifestream.createYqlUrl(createYql()),
'cache': true,
'data': {
// YQL will cache this for 5 minutes
'_maxage': 300
},
'dataType': 'jsonp',
// let YQL cache
'jsonpCallback': jsonpCallbackName
});
// Expose the template.
// We use this to check which templates are available
return {
'template': template
};
};
})(jQuery);
(function($) {
$.fn.lifestream.feeds.mendeley = function( config, callback ) {
var template = $.extend({},
{
flagged1: 'flagged <a href="http://www.mendeley.com${link}">${title}</a>',
flagged2: 'flagged <a href="${link}">${title}</a>'
},
config.template),
parseMendeley = function( input ) {
var output = [], list, i = 0, j;
if(input.query && input.query.count && input.query.count > 0) {
list = input.query.results.rss.channel.item;
j = list.length;
for( ; i<j; i++) {
var item = list[i];
var tmplt = ( (item.link.charAt(0) === '/') ? template.flagged1 : template.flagged2 );
output.push({
date: new Date(item.pubDate),
config: config,
url: 'http://mendeley.com/groups/' + config.user,
html: $.tmpl( tmplt, item )
});
}
}
return output;
};
$.ajax({
url: $.fn.lifestream.createYqlUrl('select * from xml where url=' +
'"http://www.mendeley.com/groups/' + config.user + '/feed/rss/"'),
dataType: 'jsonp',
success: function( data ) {
callback(parseMendeley(data));
}
});
// Expose the template.
// We use this to check which templates are available
return {
"template" : template
};
};
})(jQuery);
(function($) {
$.fn.lifestream.feeds.miso = function( config, callback ) {
var template = $.extend({},
{
watched: 'checked in to <a href="${link}">${title}</a>'
},
config.template),
/**
* Parse the input from rss feed
*/
parseMiso = function( input ) {
var output = [], list, i = 0, j;
if(input.query && input.query.count && input.query.count > 0) {
list = input.query.results.rss.channel.item;
j = list.length;
for( ; i<j; i++) {
var item = list[i];
output.push({
url: 'http://www.gomiso.com/feeds/user/' + config.user +
'/checkins.rss',
date: new Date( item.pubDate ),
config: config,
html: $.tmpl( template.watched, item )
});
}
}
return output;
};
$.ajax({
url: $.fn.lifestream.createYqlUrl('select * from xml where url="' +
'http://www.gomiso.com/feeds/user/' + config.user + '/checkins.rss"'),
dataType: 'jsonp',
success: function( data ) {
callback(parseMiso(data));
}
});
// Expose the template.
// We use this to check which templates are available
return {
"template" : template
};
};
})(jQuery);
(function($) {
$.fn.lifestream.feeds.mlkshk = function( config, callback ) {
var template = $.extend({},
{
posted: 'posted <a href="${link}">${title}</a>'
},
config.template);
var parseMlkshk = function ( input ) {
var output = [], list, i = 0, j, item;
if ( input.query && input.query.count && input.query.count > 0 &&
input.query.results.rss.channel.item ) {
list = input.query.results.rss.channel.item;
j = list.length;
for ( ; i < j; i++) {
item = list[i];
output.push({
date: new Date( item.pubDate ),
config: config,
html: $.tmpl( template.posted, item )
});
}
}
return output;
};
$.ajax({
url: $.fn.lifestream.createYqlUrl('select * from xml where ' +
'url="http://mlkshk.com/user/' + config.user + '/rss"'),
dataType: "jsonp",
success: function ( data ) {
callback(parseMlkshk(data));
}
});
// Expose the template.
// We use this to check which templates are available
return {
"template" : template
};
};
})(jQuery);(function($) {
$.fn.lifestream.feeds.pinboard = function( config, callback ) {
var template = $.extend({},
{
bookmarked: 'bookmarked <a href="${link}">${title}</a>'
},
config.template);
var parsePinboard = function( input ) {
var output = [], list, i = 0, j, item;
if (input.query && input.query.count && input.query.count > 0) {
list = input.query.results.RDF.item;
j = list.length;
for ( ; i < j; i++) {
item = list[i];
output.push({
date: new Date(item.date),
config: config,
html: $.tmpl( template.bookmarked, item )
});
}
}
return output;
};
$.ajax({
url: $.fn.lifestream.createYqlUrl('select * from xml where ' +
'url="http://feeds.pinboard.in/rss/u:' + config.user + '"'),
dataType: "jsonp",
success: function( data ) {
callback(parsePinboard(data));
}
});
// Expose the template.
// We use this to check which templates are available
return {
"template" : template
};
};
})(jQuery);(function($) {
$.fn.lifestream.feeds.pocket = function( config, callback ) {
var template = $.extend({},
{
pocketed: 'pocketed <a href="${link}">${title}</a>'
},
config.template),
parsePocket = function( input ) {
var output = [], list, i = 0, j;
if(input.query && input.query.results) {
list = input.query.results.rss.channel.item;
j = list.length;
for( ; i<j; i++) {
var item = list[i];
var tmplt = template.pocketed;
output.push({
date: new Date(item.pubDate),
config: config,
url: 'http://getpocket.com',
html: $.tmpl( tmplt, item ),
});
}
}
return output;
};
$.ajax({
url: $.fn.lifestream.createYqlUrl('select * from xml where url='
+ '"http://www.getpocket.com/users/'
+ config.user + '/feed/all/"'),
dataType: 'json',
success: function( data ) {
callback(parsePocket(data));
}
});
// Expose the template.
// We use this to check which templates are available
return {
"template" : template
};
};
})(jQuery);
(function($) {
$.fn.lifestream.feeds.posterous = function( config, callback ) {
var template = $.extend({},
{
posted: 'posted <a href="${link}">${title}</a>'
},
config.template);
var parsePosterous = function ( input ) {
var output = [], list, i = 0, j, item;
if ( input.query && input.query.count && input.query.count > 0 &&
input.query.results.rss.channel.item ) {
list = input.query.results.rss.channel.item;
j = list.length;
for ( ; i < j; i++) {
item = list[i];
output.push({
date: new Date( item.pubDate ),
config: config,
html: $.tmpl( template.posted, item )
});
}
}
return output;
};
$.ajax({
url: $.fn.lifestream.createYqlUrl('select * from xml where ' +
'url="http://' + config.user + '.posterous.com/rss.xml"'),
dataType: "jsonp",
success: function ( data ) {
callback(parsePosterous(data));
}
});
// Expose the template.
// We use this to check which templates are available
return {
"template" : template
};
};
})(jQuery);(function($) {
$.fn.lifestream.feeds.quora = function( config, callback ) {
var template = $.extend({},
{
posted: '<a href="${link}">${title}</a>'
},
config.template),
/**
* Get the link
* Straigth copy from RSS
*
* @param {Object} channel
* @return {String}
*/
getChannelUrl = function(channel){
var i = 0, j = channel.link.length;
for( ; i < j; i++) {
var link = channel.link[i];
if( typeof link === 'string' ) {
return link;
}
}
return '';
},
/**
* Parse the input from quora feed
*/
parseRSS = function( input ) {
var output = [], list = [], i = 0, j = 0, url = '';
if(input.query && input.query.count && input.query.count > 0) {
list = input.query.results.rss.channel.item;
j = list.length;
url = getChannelUrl(input.query.results.rss.channel);
for( ; i<j; i++) {
var item = list[i];
output.push({
url: url,
date: new Date( item.pubDate ),
config: config,
html: $.tmpl( template.posted, item )
});
}
}
return output;
};
$.ajax({
url: $.fn.lifestream.createYqlUrl('select * from xml where ' +
'url="http://www.quora.com/' + config.user + '/rss"'),
dataType: 'jsonp',
success: function( data ) {
callback(parseRSS(data));
}
});
// Expose the template.
// We use this to check which templates are available
return {
"template" : template
};
};
})(jQuery);
(function($) {
$.fn.lifestream.feeds.reddit = function( config, callback ) {
var template = $.extend({},
{
commented: '<a href="http://www.reddit.com/r/${item.data.subreddit}' +
'/comments/${item.data.link_id.substring(3)}/u/' +
'${item.data.name.substring(3)}?context=3">commented ' +
'(${score})</a> in <a href="http://www.reddit.com/r/' +
'${item.data.subreddit}">${item.data.subreddit}</a>',
created: '<a href="http://www.reddit.com${item.data.permalink}">' +
'created new thread (${score})</a> in ' +
'<a href="http://www.reddit.com/r/${item.data.subreddit}">' +
'${item.data.subreddit}</a>'
},
config.template);
/**
* Parsed one item from the Reddit API.
* item.kind == t1 is a reply, t2 is a new thread
*/
var parseRedditItem = function( item ) {
var score = item.data.ups - item.data.downs,
pass = {
item: item,
score: (score > 0) ? "+" + score : score
};
// t1 = reply, t3 = new thread
if (item.kind === "t1") {
return $.tmpl( template.commented, pass );
}
else if (item.kind === "t3") {
return $.tmpl( template.created, pass );
}
},
/**
* Reddit date's are simple epochs.
* seconds*1000 = milliseconds
*/
convertDate = function( date ) {
return new Date(date * 1000);
};
$.ajax({
url: "https://pay.reddit.com/user/" + config.user + ".json",
dataType: "jsonp",
jsonp:"jsonp",
success: function( data ) {
var output = [], i = 0, j;
if(data && data.data && data.data.children &&
data.data.children.length > 0) {
j = data.data.children.length;
for( ; i<j; i++) {
var item = data.data.children[i];
output.push({
date: convertDate(item.data.created_utc),
config: config,
html: parseRedditItem(item),
url: 'http://reddit.com/user/' + config.user
});
}
}
callback(output);
}
});
// Expose the template.
// We use this to check which templates are available
return {
"template" : template
};
};
})(jQuery);
(function($) {
$.fn.lifestream.feeds.rss = function( config, callback ) {
var template = $.extend({},
{
posted: 'posted <a href="${link}">${title}</a>'
},
config.template),
/**
* Get the link
* @param {Object} channel
* @return {String}
*/
getChannelUrl = function(channel){
var i = 0, j = channel.link.length;
for( ; i < j; i++) {
var link = channel.link[i];
if( typeof link === 'string' ) {
return link;
}
}
return '';
},
/**
* Parse the input from rss feed
*/
parseRSS = function( input ) {
var output = [], list = [], i = 0, j = 0, url = '';
if(input.query && input.query.count && input.query.count > 0) {
list = input.query.results.rss.channel.item;
j = list.length;
url = getChannelUrl(input.query.results.rss.channel);
for( ; i<j; i++) {
var item = list[i];
output.push({
url: url,
date: new Date( item.pubDate ),
config: config,
html: $.tmpl( template.posted, item )
});
}
}
return output;
};
$.ajax({
url: $.fn.lifestream.createYqlUrl('select * from xml where url="' +
config.user + '"'),
dataType: 'jsonp',
success: function( data ) {
callback(parseRSS(data));
}
});
// Expose the template.
// We use this to check which templates are available
return {
"template" : template
};
};
})(jQuery);
(function($) {
$.fn.lifestream.feeds.slideshare = function( config, callback ) {
var template = $.extend({},
{
uploaded: 'uploaded a presentation <a href="${link}">${title}</a>'
},
config.template);
var parseSlideshare = function( input ) {
var output = [], list, i = 0, j, item;
if (input.query && input.query.count && input.query.count > 0) {
list = input.query.results.rss.channel.item;
j = list.length;
for ( ; i < j; i++) {
item = list[i];
output.push({
date: new Date(item.pubDate),
config: config,
html: $.tmpl( template.uploaded, item )
});
}
}
return output;
};
$.ajax({
url: $.fn.lifestream.createYqlUrl('select * from xml where ' +
'url="http://www.slideshare.net/rss/user/' + config.user + '"'),
dataType: "jsonp",
success: function( data ) {
callback(parseSlideshare(data));
}
});
// Expose the template.
// We use this to check which templates are available
return {
"template" : template
};
};
})(jQuery);(function($) {
$.fn.lifestream.feeds.snipplr = function( config, callback ) {
var template = $.extend({},
{
posted: 'posted a snippet <a href="${link}">${title}</a>'
},
config.template);
var parseSnipplr = function ( input ) {
var output = [], list, i = 0, j, item;
if ( input.query && input.query.count && input.query.count > 0 &&
input.query.results.rss.channel.item ) {
list = input.query.results.rss.channel.item;
j = list.length;
for ( ; i < j; i++) {
item = list[i];
output.push({
date: new Date( item.pubDate ),
config: config,
html: $.tmpl( template.posted, item )
});
}
}
return output;
};
$.ajax({
url: $.fn.lifestream.createYqlUrl('select * from xml where ' +
'url="http://snipplr.com/rss/users/' + config.user + '"'),
dataType: "jsonp",
success: function ( data ) {
callback(parseSnipplr(data));
}
});
};
})(jQuery);(function($) {
$.fn.lifestream.feeds.stackoverflow = function( config, callback ) {
var template = $.extend({},
{
global: '<a href="${link}">${text}</a> - ${title}'
},
config.template);
var parseStackoverflowItem = function( item ) {
var text="", title="", link="",
stackoverflow_link = "http://stackoverflow.com/users/" + config.user,
question_link = "http://stackoverflow.com/questions/";
if(item.timeline_type === "badge") {
link = stackoverflow_link + "?tab=reputation";
}
text = item.timeline_type;
title = item.title || item.detail || "";
link = link || question_link + item.post_id;
return {
link: link,
title: title,
text: text
};
},
convertDate = function( date ) {
return new Date(date * 1000);
};
$.ajax({
url: "https://api.stackexchange.com/2.1/users/" + config.user +
"/timeline?site=stackoverflow",
dataType: "jsonp",
jsonp: 'jsonp',
success: function( data ) {
var output = [];
if(data && data.items) {
for(var i = 0 ; i < data.items.length; i++) {
var item = data.items[i];
output.push({
date: convertDate(item.creation_date),
config: config,
html: $.tmpl( template.global, parseStackoverflowItem(item) )
});
}
}
callback(output);
}
});
// Expose the template.
// We use this to check which templates are available
return {
"template" : template
};
};
})(jQuery);
(function($) {
$.fn.lifestream.feeds.tumblr = function( config, callback ) {
var template = $.extend({},
{
posted: 'posted a ${type} <a href="${url}">${title}</a>'
},
config.template),
limit = config.limit || 20,
getImage = function( post ) {
switch(post.type) {
case 'photo':
var images = post['photo-url'];
return $('<img width="75" height="75"/>')
.attr({
src: images[images.length - 1].content,
title: getTitle(post),
alt: getTitle(post)
}).wrap('<div/>').parent().html(); // generate an HTML string
case 'video':
var videos = post['video-player'];
var video = videos[videos.length - 1].content;
// Videos hosted on Tumblr use JavaScript to render the
// video, but the JavaScript doesn't work when we call it
// from a lifestream - so don't try to embed these.
if (video.match(/<\s*script/)) { return null; }
return video;
case 'audio':
// Unlike photo and video, audio gives you no visual indication
// of what it contains, so we append the "title" text.
return post['audio-player'] + ' ' +
// HTML-escape the text.
$('<div/>').text(getTitle(post)).html();
default:
return null;
}
},
getFirstElementOfBody = function( post, bodyAttribute ) {
return $(post[bodyAttribute]).filter(':not(:empty):first').text();
},
getTitleForPostType = function( post ) {
var title;
switch(post.type) {
case 'regular':
return post['regular-title'] ||
getFirstElementOfBody(post, 'regular-body');
case 'link':
title = post['link-text'] ||
getFirstElementOfBody(post, 'link-description');
if (title === '') { title = post['link-url']; }
return title;
case 'video':
return getFirstElementOfBody(post, 'video-caption');
case 'audio':
return getFirstElementOfBody(post, 'audio-caption');
case 'photo':
return getFirstElementOfBody(post, 'photo-caption');
case 'quote':
return '"' + post['quote-text'].replace(/<.+?>/g, ' ').trim() + '"';
case 'conversation':
title = post['conversation-title'];
if (!title) {
title = post.conversation.line;
if (typeof(title) !== 'string') {
title = title[0].label + ' ' + title[0].content + ' ...';
}
}
return title;
case 'answer':
return post.question;
default:
return post.type;
}
},
/**
* get title text
*/
getTitle = function( post ) {
var title = getTitleForPostType(post) || '';
// remove tags
return title.replace( /<.+?>/gi, " ");
},
createTumblrOutput = function( config, post ) {
return {
date: new Date(post.date),
config: config,
html: $.tmpl( template.posted, {
type: post.type.replace('regular', 'blog entry'),
url: post.url,
image: getImage(post),
title: getTitle(post)
} )
};
},
parseTumblr = function( input ) {
var output = [], i = 0, j, post;
if(input.query && input.query.count && input.query.count > 0) {
// If a user only has one post, post is a plain object, otherwise it
// is an array
if ( $.isArray(input.query.results.posts.post) ) {
j = input.query.results.posts.post.length;
for( ; i < j; i++) {
post = input.query.results.posts.post[i];
output.push(createTumblrOutput(config, post));
}
}
else if ( $.isPlainObject(input.query.results.posts.post) ) {
output.push(
createTumblrOutput(config,input.query.results.posts.post)
);
}
}
return output;
};
$.ajax({
url: $.fn.lifestream.createYqlUrl('select *' +
' from tumblr.posts where username="' + config.user + '"' +
' and num="' + limit + '"'),
dataType: 'jsonp',
success: function( data ) {
callback(parseTumblr(data));
}
});
// Expose the template.
// We use this to check which templates are available
return {
"template" : template
};
};
})(jQuery);(function($) {
"use strict";
$.fn.lifestream.feeds.twitter = function(config, callback) {
var template = $.extend({},
{
"posted": '{{html tweet}}'
},
config.template);
/**
* Add links to the twitter feed.
* Hashes, @ and regular links are supported.
* @private
* @param {String} tweet A string of a tweet
* @return {String} A linkified tweet
*/
var linkify = function( tweet ) {
var link = function( t ) {
return t.replace(
/([a-z]+:\/\/)([-A-Z0-9+&@#\/%?=~_|(\)!:,.;]*[-A-Z0-9+&@#\/%=~_|(\)])/ig,
function( m, m1, m2 ) {
return $("<a></a>").attr("href", m).text(
( ( m2.length > 35 ) ? m2.substr( 0, 34 ) + '...' : m2 )
)[0].outerHTML;
}
);
},
at = function( t ) {
return t.replace(
/(^|[^\w]+)\@([a-zA-Z0-9_]{1,15})/g,
function( m, m1, m2 ) {
var elem = ($("<a></a>")
.attr("href", "https://twitter.com/" + m2)
.text("@" + m2))[0].outerHTML;
return m1 + elem;
}
);
},
hash = function( t ) {
return t.replace(
/<a.*?<\/a>|(^|\r?\n|\r|\n|)(#|\$)([a-zA-Z0-9ÅåÄäÖöØøÆæÉéÈèÜüÊêÛûÎî_]+)(\r?\n|\r|\n||$)/g,
function( m, m1, m2, m3, m4 ) {
if (typeof m3 == "undefined") return m;
var elem = "";
if (m2 == "#") {
elem = ($("<a></a>")
.attr("href",
"https://twitter.com/hashtag/" + m3 + "?src=hash")
.text("#" + m3))[0].outerHTML;
} else if (m2 == "$") {
elem = ($("<a></a>")
.attr("href",
"https://twitter.com/search?q=%24" + m3 + "&src=hash")
.text("$" + m3))[0].outerHTML;
}
return (m1 + elem + m4);
}
);
};
return hash(at(link(tweet)));
},
/**
* Parse the input from twitter
* @private
* @param {Object[]} items
* @return {Object[]} Array of Twitter status messages.
*/
parseTwitter = function(response) {
var output = [];
if (!response.tweets) {
return output;
}
for(var i = 0; i < response.tweets.length; i++ ) {
var status = response.tweets[i];
output.push({
"date": new Date(status.createdAt * 1000), // unix time
"config": config,
"html": $.tmpl( template.posted, {
"tweet": linkify($('<div/>').html(status.text).text()),
"complete_url": 'https://twitter.com/' + config.user +
"/status/" + status.id
} ),
"url": 'https://twitter.com/' + config.user
});
}
callback(output);
};
$.ajax({
"url": 'https://twittery.herokuapp.com/' + config.user,
"cache": false
}).success(parseTwitter);
// Expose the template.
// We use this to check which templates are available
return {
"template" : template
};
};
})(jQuery);
(function($) {
$.fn.lifestream.feeds.vimeo = function( config, callback ) {
var template = $.extend({},
{
liked: 'liked <a href="${url}" title="${description}">${title}</a>',
posted: 'posted <a href="${url}" title="${description}">${title}</a>'
},
config.template),
parseVimeo = function( input, item_type ) {
var output = [], i = 0, j, item, type = item_type || 'liked', date, description;
if (input) {
j = input.length;
for( ; i < j; i++) {
item = input[i];
if (type === 'posted') {
date = new Date( item.upload_date.replace(' ', 'T') );
} else {
date = new Date( item.liked_on.replace(' ', 'T') );
}
if (item.description) {
description = item.description.replace(/"/g, "'").replace( /<.+?>/gi, '');
} else {
description = '';
}
output.push({
date: date,
config: config,
html: $.tmpl( template[type], {
url: item.url,
description: item.description ? item.description
.replace(/"/g, "'")
.replace( /<.+?>/gi, '') : '',
title: item.title
})
});
}
}
return output;
};
$.ajax({
url: $.fn.lifestream.createYqlUrl('SELECT * FROM xml WHERE ' +
'url="http://vimeo.com/api/v2/' + config.user + '/likes.xml" OR ' +
'url="http://vimeo.com/api/v2/' + config.user + '/videos.xml"'),
dataType: 'jsonp',
success: function( response ) {
var output = [];
// check for likes & parse
if ( response.query.results.videos[0] != null &&
response.query.results.videos[0].video.length > 0 ) {
output = output.concat(parseVimeo(
response.query.results.videos[0].video
));
}
// check for uploads & parse
if ( response.query.results.videos[1] != null &&
response.query.results.videos[1].video.length > 0 ) {
output = output.concat(
parseVimeo(response.query.results.videos[1].video, 'posted')
);
}
callback(output);
}
});
// Expose the template.
// We use this to check which templates are available
return {
'template' : template
};
};
})(jQuery);(function($) {
$.fn.lifestream.feeds.wikipedia = function( config, callback ) {
// default to english if no language was set
var language = config.language || 'en',
template = $.extend({},
{
contribution: 'contributed to <a href="${url}">${title}</a>'
},
config.template);
$.ajax({
url: "https://" + language +
".wikipedia.org/w/api.php?action=query&ucuser=" +
config.user + "&list=usercontribs&ucdir=older&format=json",
dataType: "jsonp",
success: function( data ) {
var output = [], i = 0, j;
if(data && data.query.usercontribs) {
j = data.query.usercontribs.length;
for( ; i<j; i++) {
var item = data.query.usercontribs[i];
// Fastest way to get the URL.
// Alternatively, we'd have to poll wikipedia for the pageid's link
item.url = 'http://' + language + '.wikipedia.org/wiki/' +
item.title.replace(' ', '_');
output.push({
date: new Date( item.timestamp ),
config: config,
html: $.tmpl( template.contribution, item )
});
}
}
callback(output);
}
});
// Expose the template.
// We use this to check which templates are available
return {
"template" : template
};
};
})(jQuery);
(function($) {
$.fn.lifestream.feeds.wordpress = function( config, callback ) {
var template = $.extend({},
{
posted: 'posted <a href="${link}">${title}</a>'
},
config.template);
var parseWordpress = function ( input ) {
var output = [], list, i = 0, j, item;
if ( input.query && input.query.count && input.query.count > 0 &&
input.query.results.rss.channel.item ) {
list = input.query.results.rss.channel.item;
j = list.length;
for ( ; i < j; i++) {
item = list[i];
output.push({
date: new Date( item.pubDate ),
config: config,
html: $.tmpl( template.posted, item )
});
}
}
return output;
};
var url = "";
if ( config.user ){
// If the config.user property starts with http:// we assume that is the
// full url to the user his blog. We append the /feed to the url.
url = (config.user.indexOf('http://') === 0 ?
config.user + '/feed' :
'http://' + config.user + '.wordpress.com/feed');
$.ajax({
url: $.fn.lifestream.createYqlUrl('select * from xml where ' +
'url="' + url + '"'),
dataType: "jsonp",
success: function ( data ) {
callback(parseWordpress(data));
}
});
}
// Expose the template.
// We use this to check which templates are available
return {
"template" : template
};
};
})(jQuery);(function($) {
"use strict";
$.fn.lifestream.feeds.youtube = function( config, callback ) {
var template = $.extend({},
{
"uploaded": 'uploaded <a href="https://www.youtube.com/watch?v=${id}">${title}</a>'
},
config.template);
var parseYoutube = function(response) {
var output = [];
if(!response.videos) {return output;}
for (var i=0; i<response.videos.length;i++){
var video = response.videos[i];
output.push({
"date": new Date(video.datePublished),
"config": config,
"html": $.tmpl(template.uploaded, video)
});
}
callback(output);
};
$.ajax({
"url": "https://youtuby-1.herokuapp.com/" + config.user,
"cache": false
}).success(parseYoutube);
// Expose the template.
// We use this to check which templates are available
return {
"template" : template
};
};
})(jQuery);
(function($) {
$.fn.lifestream.feeds.zotero = function( config, callback ) {
var template = $.extend({},
{
flagged: 'flagged <a href="${id}">${title}</a> by ${creatorSummary}'
},
config.template),
parseZotero = function( input ) {
var output = [], list, i = 0, j;
if(input.query && input.query.count && input.query.count > 0) {
list = input.query.results.feed.entry;
j = list.length;
for( ; i<j; i++) {
var item = list[i];
output.push({
date: new Date(item.updated),
config: config,
url: 'http://zotero.com/users/' + config.user,
html: $.tmpl( template.flagged, item )
});
}
}
return output;
};
$.ajax({
url: $.fn.lifestream.createYqlUrl('select * from xml where url=' +
'"https://api.zotero.org/users/' +
config.user + '/items"'),
dataType: 'jsonp',
success: function( data ) {
callback(parseZotero(data));
}
});
// Expose the template.
// We use this to check which templates are available
return {
"template" : template
};
};
})(jQuery);
|
{
"content_hash": "84974794c9e8131e8f0d77a6a57eed92",
"timestamp": "",
"source": "github",
"line_count": 2731,
"max_line_length": 170,
"avg_line_length": 26.840717685829368,
"alnum_prop": 0.5342146189735615,
"repo_name": "christianv/jquery-lifestream",
"id": "fd1f2290e53c6d17bbb54a10c3df8e9afb0500e3",
"size": "73625",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "jquery.lifestream.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1993"
},
{
"name": "HTML",
"bytes": "33351"
},
{
"name": "JavaScript",
"bytes": "425465"
},
{
"name": "Makefile",
"bytes": "1525"
}
]
}
|
cask "chromedriver" do
version "86.0.4240.22"
sha256 "351ae30e9feab7ca6ccb94a549afcd62d6355561b78b8386cd4271d480a2fdc6"
# chromedriver.storage.googleapis.com/ was verified as official when first introduced to the cask
url "https://chromedriver.storage.googleapis.com/#{version}/chromedriver_mac64.zip"
appcast "https://chromedriver.storage.googleapis.com/LATEST_RELEASE"
name "ChromeDriver"
homepage "https://sites.google.com/a/chromium.org/chromedriver/home"
conflicts_with cask: "homebrew/cask-versions/chromedriver-beta"
binary "chromedriver"
end
|
{
"content_hash": "57701058cb0a635ab79c4c19f65a8dd1",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 99,
"avg_line_length": 40.785714285714285,
"alnum_prop": 0.7950963222416813,
"repo_name": "jgarber623/homebrew-cask",
"id": "6f35edcd45acb89c4116b57a4dbecf6033b499de",
"size": "571",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Casks/chromedriver.rb",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Dockerfile",
"bytes": "249"
},
{
"name": "Python",
"bytes": "3630"
},
{
"name": "Ruby",
"bytes": "2281486"
},
{
"name": "Shell",
"bytes": "32035"
}
]
}
|
"""empty message
Revision ID: 0067_service_contact_block
Revises: 0066_add_dvla_provider
Create Date: 2017-02-28 11:23:40.299110
"""
# revision identifiers, used by Alembic.
revision = "0067_service_contact_block"
down_revision = "0066_add_dvla_provider"
import sqlalchemy as sa
from alembic import op
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column("services", sa.Column("letter_contact_block", sa.Text(), nullable=True))
op.add_column("services_history", sa.Column("letter_contact_block", sa.Text(), nullable=True))
### end Alembic commands ###
def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_column("services_history", "letter_contact_block")
op.drop_column("services", "letter_contact_block")
### end Alembic commands ###
|
{
"content_hash": "b3019cca350747180567d5622c912e6e",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 98,
"avg_line_length": 30.142857142857142,
"alnum_prop": 0.7014218009478673,
"repo_name": "alphagov/notifications-api",
"id": "b98873ee518b8b95d52605379adb5504e231afc7",
"size": "844",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "migrations/versions/0067_service_contact_block.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Dockerfile",
"bytes": "719"
},
{
"name": "Jinja",
"bytes": "5543"
},
{
"name": "Makefile",
"bytes": "6627"
},
{
"name": "Mako",
"bytes": "361"
},
{
"name": "Procfile",
"bytes": "35"
},
{
"name": "Python",
"bytes": "3506225"
},
{
"name": "Shell",
"bytes": "13179"
}
]
}
|
<section data-ng-controller="SongsController">
<h1>New Song</h1>
<form data-ng-submit="create()" novalidate>
<div>
<label for="index">Index</label>
<div>
<input type="text" data-ng-model="index" id="index"
placeholder="Index" required>
</div>
</div>
<div>
<label for="author">Author</label>
<div>
<input type="text" data-ng-model="author" id="author"
placeholder="Author" required>
</div>
</div>
<div>
<label for="title">Title</label>
<div>
<input type="text" data-ng-model="title" id="title"
placeholder="Title" required>
</div>
</div>
<div>
<input type="submit">
</div>
<div data-ng-show="error">
<strong data-ng-bind="error"></strong>
</div>
</form>
</section>
|
{
"content_hash": "242050ed912eb55883260498212eda66",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 61,
"avg_line_length": 25.285714285714285,
"alnum_prop": 0.5096045197740113,
"repo_name": "valentin7/shazam-datascience",
"id": "89a3c193a609e35c48ab21d3526207bcc2670ead",
"size": "885",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "webapp/public/songs/views/create-song.client.view.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1141"
},
{
"name": "HTML",
"bytes": "1160"
},
{
"name": "JavaScript",
"bytes": "7510"
},
{
"name": "Python",
"bytes": "19210"
}
]
}
|
package io.quarkus.hibernate.orm.panache.deployment.test.multiple_pu.repository;
import javax.enterprise.context.ApplicationScoped;
import io.quarkus.hibernate.orm.panache.PanacheRepositoryBase;
@ApplicationScoped
public class Issue11842Repository implements PanacheRepositoryBase<Issue11842Entity, Integer> {
}
|
{
"content_hash": "37ca99c2000ec04031f0e9981f09d9b2",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 95,
"avg_line_length": 35,
"alnum_prop": 0.8603174603174604,
"repo_name": "quarkusio/quarkus",
"id": "1d5718c9c85c419f39c8dbc33bd4a8d179bd16c4",
"size": "315",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "extensions/panache/hibernate-orm-panache/deployment/src/test/java/io/quarkus/hibernate/orm/panache/deployment/test/multiple_pu/repository/Issue11842Repository.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "23342"
},
{
"name": "Batchfile",
"bytes": "13096"
},
{
"name": "CSS",
"bytes": "6685"
},
{
"name": "Dockerfile",
"bytes": "459"
},
{
"name": "FreeMarker",
"bytes": "8106"
},
{
"name": "Groovy",
"bytes": "16133"
},
{
"name": "HTML",
"bytes": "1418749"
},
{
"name": "Java",
"bytes": "38584810"
},
{
"name": "JavaScript",
"bytes": "90960"
},
{
"name": "Kotlin",
"bytes": "704351"
},
{
"name": "Mustache",
"bytes": "13191"
},
{
"name": "Scala",
"bytes": "9756"
},
{
"name": "Shell",
"bytes": "71729"
}
]
}
|
#pragma checksum "C:\Users\John Best\Documents\FIBOTICS\InfoGateway\FIBotics\WinEcho\WinEcho\Views\EchoPage.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "09F9D5A717635F4A9A854E79B512EECA"
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WinEcho.Views
{
partial class EchoPage :
global::Windows.UI.Xaml.Controls.Page,
global::Windows.UI.Xaml.Markup.IComponentConnector,
global::Windows.UI.Xaml.Markup.IComponentConnector2
{
/// <summary>
/// Connect()
/// </summary>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Windows.UI.Xaml.Build.Tasks"," 14.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public void Connect(int connectionId, object target)
{
switch(connectionId)
{
case 1:
{
this.LayoutRoot = (global::Windows.UI.Xaml.Controls.RelativePanel)(target);
}
break;
case 2:
{
this.Echo_Tap_image = (global::Windows.UI.Xaml.Controls.Image)(target);
}
break;
case 3:
{
this.listenButton = (global::Windows.UI.Xaml.Controls.Button)(target);
#line 15 "..\..\..\Views\EchoPage.xaml"
((global::Windows.UI.Xaml.Controls.Button)this.listenButton).Click += this.RecordButton_Click;
#line default
}
break;
case 4:
{
this.StopButton = (global::Windows.UI.Xaml.Controls.Button)(target);
#line 16 "..\..\..\Views\EchoPage.xaml"
((global::Windows.UI.Xaml.Controls.Button)this.StopButton).Click += this.StopButton_Click;
#line default
}
break;
case 5:
{
this.Duration = (global::Windows.UI.Xaml.Controls.TextBlock)(target);
}
break;
case 6:
{
this.image = (global::Windows.UI.Xaml.Controls.Image)(target);
}
break;
case 7:
{
this.results = (global::Windows.UI.Xaml.Controls.TextBlock)(target);
}
break;
default:
break;
}
this._contentLoaded = true;
}
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Windows.UI.Xaml.Build.Tasks"," 14.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public global::Windows.UI.Xaml.Markup.IComponentConnector GetBindingConnector(int connectionId, object target)
{
global::Windows.UI.Xaml.Markup.IComponentConnector returnValue = null;
return returnValue;
}
}
}
|
{
"content_hash": "905d734b5dcaa2fa248f7bd54e6e620c",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 190,
"avg_line_length": 39.81927710843374,
"alnum_prop": 0.5059001512859304,
"repo_name": "github-big-cu/WinEcho",
"id": "f363e378f1d6f458ce7e0a714364ad98e9c1e9b4",
"size": "3307",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "WinEcho/obj/x64/Debug/Views/EchoPage.g.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "236234"
},
{
"name": "HTML",
"bytes": "1330"
}
]
}
|
#ifndef _IGNITE_ODBC_UTILITY
#define _IGNITE_ODBC_UTILITY
#ifdef min
# undef min
#endif //min
#include <stdint.h>
#include <ctime>
#include <string>
#include <algorithm>
#include <ignite/common/utils.h>
#include "ignite/impl/binary/binary_reader_impl.h"
#include "ignite/impl/binary/binary_writer_impl.h"
#include "ignite/odbc/decimal.h"
#ifdef ODBC_DEBUG
extern FILE* log_file;
void logInit(const char*);
# define LOG_MSG(fmt, ...) \
do { \
logInit(ODBC_LOG_PATH); \
fprintf(log_file, "%s: " fmt, __FUNCTION__, __VA_ARGS__); \
fflush(log_file); \
} while (false)
#else
# define LOG_MSG(...)
#endif
namespace ignite
{
namespace utility
{
/** Using common version of the util. */
using ignite::common::IntoLower;
/**
* Skip leading spaces.
*
* @param begin Iterator to the beginning of the character sequence.
* @param end Iterator to the end of the character sequence.
* @return Iterator to first non-blanc character.
*/
template<typename Iterator>
Iterator SkipLeadingSpaces(Iterator begin, Iterator end)
{
Iterator res = begin;
while (isspace(*res) && res != end)
++res;
return res;
}
/**
* Skip trailing spaces.
*
* @param begin Iterator to the beginning of the character sequence.
* @param end Iterator to the end of the character sequence.
* @return Iterator to last non-blanc character.
*/
template<typename Iterator>
Iterator SkipTrailingSpaces(Iterator begin, Iterator end)
{
Iterator res = end - 1;
while (isspace(*res) && res != begin - 1)
--res;
return res + 1;
}
/**
* Remove leading and trailing spaces.
*
* @param begin Iterator to the beginning of the character sequence.
* @param end Iterator to the end of the character sequence.
* @return String without leading and trailing spaces.
*/
template<typename Iterator>
std::string RemoveSurroundingSpaces(Iterator begin, Iterator end)
{
std::string res;
if (begin >= end)
return res;
Iterator skipped_leading = SkipLeadingSpaces(begin, end);
Iterator skipped_trailing = SkipTrailingSpaces(skipped_leading, end);
res.reserve(skipped_trailing - skipped_leading);
std::copy(skipped_leading, skipped_trailing, std::back_insert_iterator<std::string>(res));
return res;
}
template<typename T>
T* GetPointerWithOffset(T* ptr, size_t offset)
{
uint8_t* ptrBytes = (uint8_t*)ptr;
return (T*)(ptrBytes + offset);
}
/**
* Copy string to buffer of the specific length.
* @param str String to copy data from.
* @param buf Buffer to copy data to.
* @param buflen Length of the buffer.
* @return Length of the resulting string in buffer.
*/
size_t CopyStringToBuffer(const std::string& str, char* buf, size_t buflen);
/**
* Read string from reader.
* @param reader Reader.
* @param str String.
*/
void ReadString(ignite::impl::binary::BinaryReaderImpl& reader, std::string& str);
/**
* Write string using writer.
* @param writer Writer.
* @param str String.
*/
void WriteString(ignite::impl::binary::BinaryWriterImpl& writer, const std::string& str);
/**
* Read decimal value using reader.
*
* @param reader Reader.
* @param decimal Decimal value.
*/
void ReadDecimal(ignite::impl::binary::BinaryReaderImpl& reader, Decimal& decimal);
/**
* Write decimal value using writer.
*
* @param writer Writer.
* @param decimal Decimal value.
*/
void WriteDecimal(ignite::impl::binary::BinaryWriterImpl& writer, const Decimal& decimal);
/**
* Convert SQL string buffer to std::string.
*
* @param sqlStr SQL string buffer.
* @param sqlStrLen SQL string length.
* @return Standard string containing the same data.
*/
std::string SqlStringToString(const unsigned char* sqlStr, int32_t sqlStrLen);
}
}
#endif //_IGNITE_ODBC_UTILITY
|
{
"content_hash": "09b553d39c9e90e2f7d27679013efd00",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 102,
"avg_line_length": 28.812121212121212,
"alnum_prop": 0.5488010096760623,
"repo_name": "f7753/ignite",
"id": "b2a1639f4e84bf30ad9646fc5cb7080ca45926e0",
"size": "5556",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "modules/platforms/cpp/odbc/include/ignite/odbc/utility.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "41060"
},
{
"name": "C",
"bytes": "7524"
},
{
"name": "C#",
"bytes": "3783198"
},
{
"name": "C++",
"bytes": "1809756"
},
{
"name": "CSS",
"bytes": "98768"
},
{
"name": "Groovy",
"bytes": "15092"
},
{
"name": "HTML",
"bytes": "410211"
},
{
"name": "Java",
"bytes": "23816865"
},
{
"name": "JavaScript",
"bytes": "954966"
},
{
"name": "M4",
"bytes": "5528"
},
{
"name": "Makefile",
"bytes": "98282"
},
{
"name": "PHP",
"bytes": "11079"
},
{
"name": "PowerShell",
"bytes": "6281"
},
{
"name": "Scala",
"bytes": "673768"
},
{
"name": "Shell",
"bytes": "547076"
},
{
"name": "Smalltalk",
"bytes": "1908"
}
]
}
|
package ch.scaille.tcwriter.server.services;
import ch.scaille.tcwriter.server.dto.Context;
import ch.scaille.tcwriter.server.dto.Identity;
import ch.scaille.util.helpers.JavaExt.AutoCloseableNoException;
public interface ContextService {
AutoCloseableNoException set(Context context);
Context get();
Context merge(Context newContext);
AutoCloseableNoException load(Identity of);
}
|
{
"content_hash": "e8cc3de7f685f9a49610fe1cdde425f5",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 64,
"avg_line_length": 23.294117647058822,
"alnum_prop": 0.8106060606060606,
"repo_name": "sebastiencaille/sky-lib",
"id": "38193b72b09cb4eaf6569c44327fe7faf7c66ecf",
"size": "396",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "testcase-writer/webapp/server/src/main/java/ch/scaille/tcwriter/server/services/ContextService.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C++",
"bytes": "78806"
},
{
"name": "CSS",
"bytes": "1034"
},
{
"name": "HTML",
"bytes": "1984"
},
{
"name": "Java",
"bytes": "927160"
},
{
"name": "JavaScript",
"bytes": "1430"
},
{
"name": "Makefile",
"bytes": "8699"
},
{
"name": "Shell",
"bytes": "59"
},
{
"name": "TypeScript",
"bytes": "13601"
}
]
}
|
.class public abstract Lcom/google/android/gms/internal/bc$a;
.super Landroid/os/Binder;
# interfaces
.implements Lcom/google/android/gms/internal/bc;
# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
value = Lcom/google/android/gms/internal/bc;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x409
name = "a"
.end annotation
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lcom/google/android/gms/internal/bc$a$a;
}
.end annotation
# direct methods
.method public constructor <init>()V
.locals 1
invoke-direct {p0}, Landroid/os/Binder;-><init>()V
const-string v0, "com.google.android.gms.ads.internal.mediation.client.IMediationAdapter"
invoke-virtual {p0, p0, v0}, Lcom/google/android/gms/internal/bc$a;->attachInterface(Landroid/os/IInterface;Ljava/lang/String;)V
return-void
.end method
.method public static j(Landroid/os/IBinder;)Lcom/google/android/gms/internal/bc;
.locals 2
if-nez p0, :cond_0
const/4 v0, 0x0
return-object v0
:cond_0
const-string v0, "com.google.android.gms.ads.internal.mediation.client.IMediationAdapter"
invoke-interface {p0, v0}, Landroid/os/IBinder;->queryLocalInterface(Ljava/lang/String;)Landroid/os/IInterface;
move-result-object v0
move-object v1, v0
if-eqz v0, :cond_1
instance-of v0, v1, Lcom/google/android/gms/internal/bc;
if-eqz v0, :cond_1
move-object v0, v1
check-cast v0, Lcom/google/android/gms/internal/bc;
return-object v0
:cond_1
new-instance v0, Lcom/google/android/gms/internal/bc$a$a;
invoke-direct {v0, p0}, Lcom/google/android/gms/internal/bc$a$a;-><init>(Landroid/os/IBinder;)V
return-object v0
.end method
# virtual methods
.method public asBinder()Landroid/os/IBinder;
.locals 0
return-object p0
.end method
.method public onTransact(ILandroid/os/Parcel;Landroid/os/Parcel;I)Z
.locals 10
sparse-switch p1, :sswitch_data_0
goto/16 :goto_7
nop
:sswitch_data_0
.sparse-switch
0x1 -> :sswitch_1
0x2 -> :sswitch_2
0x3 -> :sswitch_3
0x4 -> :sswitch_4
0x5 -> :sswitch_5
0x6 -> :sswitch_6
0x7 -> :sswitch_7
0x5f4e5446 -> :sswitch_0
.end sparse-switch
:sswitch_0
const-string v0, "com.google.android.gms.ads.internal.mediation.client.IMediationAdapter"
invoke-virtual {p3, v0}, Landroid/os/Parcel;->writeString(Ljava/lang/String;)V
const/4 v0, 0x1
return v0
:sswitch_1
const-string v0, "com.google.android.gms.ads.internal.mediation.client.IMediationAdapter"
invoke-virtual {p2, v0}, Landroid/os/Parcel;->enforceInterface(Ljava/lang/String;)V
invoke-virtual {p2}, Landroid/os/Parcel;->readStrongBinder()Landroid/os/IBinder;
move-result-object v0
invoke-static {v0}, Lcom/google/android/gms/dynamic/b$a;->E(Landroid/os/IBinder;)Lcom/google/android/gms/dynamic/b;
move-result-object p1
invoke-virtual {p2}, Landroid/os/Parcel;->readInt()I
move-result v0
const/4 v1, 0x0
if-eq v1, v0, :cond_0
sget-object v0, Lcom/google/android/gms/internal/x;->CREATOR:Lcom/google/android/gms/internal/y;
invoke-virtual {v0, p2}, Lcom/google/android/gms/internal/y;->b(Landroid/os/Parcel;)Lcom/google/android/gms/internal/x;
move-result-object p4
goto :goto_0
:cond_0
const/4 p4, 0x0
:goto_0
invoke-virtual {p2}, Landroid/os/Parcel;->readInt()I
move-result v0
const/4 v1, 0x0
if-eq v1, v0, :cond_1
sget-object v0, Lcom/google/android/gms/internal/v;->CREATOR:Lcom/google/android/gms/internal/w;
invoke-virtual {v0, p2}, Lcom/google/android/gms/internal/w;->a(Landroid/os/Parcel;)Lcom/google/android/gms/internal/v;
move-result-object v7
goto :goto_1
:cond_1
const/4 v7, 0x0
:goto_1
invoke-virtual {p2}, Landroid/os/Parcel;->readString()Ljava/lang/String;
move-result-object v8
invoke-virtual {p2}, Landroid/os/Parcel;->readStrongBinder()Landroid/os/IBinder;
move-result-object v0
invoke-static {v0}, Lcom/google/android/gms/internal/bd$a;->k(Landroid/os/IBinder;)Lcom/google/android/gms/internal/bd;
move-result-object v9
move-object v0, p0
move-object v1, p1
move-object v2, p4
move-object v3, v7
move-object v4, v8
move-object v5, v9
invoke-virtual/range {v0 .. v5}, Lcom/google/android/gms/internal/bc$a;->a(Lcom/google/android/gms/dynamic/b;Lcom/google/android/gms/internal/x;Lcom/google/android/gms/internal/v;Ljava/lang/String;Lcom/google/android/gms/internal/bd;)V
invoke-virtual {p3}, Landroid/os/Parcel;->writeNoException()V
const/4 v0, 0x1
return v0
:sswitch_2
const-string v0, "com.google.android.gms.ads.internal.mediation.client.IMediationAdapter"
invoke-virtual {p2, v0}, Landroid/os/Parcel;->enforceInterface(Ljava/lang/String;)V
invoke-virtual {p0}, Lcom/google/android/gms/internal/bc$a;->getView()Lcom/google/android/gms/dynamic/b;
move-result-object p1
invoke-virtual {p3}, Landroid/os/Parcel;->writeNoException()V
if-eqz p1, :cond_2
invoke-interface {p1}, Lcom/google/android/gms/dynamic/b;->asBinder()Landroid/os/IBinder;
move-result-object v0
goto :goto_2
:cond_2
const/4 v0, 0x0
:goto_2
invoke-virtual {p3, v0}, Landroid/os/Parcel;->writeStrongBinder(Landroid/os/IBinder;)V
const/4 v0, 0x1
return v0
:sswitch_3
const-string v0, "com.google.android.gms.ads.internal.mediation.client.IMediationAdapter"
invoke-virtual {p2, v0}, Landroid/os/Parcel;->enforceInterface(Ljava/lang/String;)V
invoke-virtual {p2}, Landroid/os/Parcel;->readStrongBinder()Landroid/os/IBinder;
move-result-object v0
invoke-static {v0}, Lcom/google/android/gms/dynamic/b$a;->E(Landroid/os/IBinder;)Lcom/google/android/gms/dynamic/b;
move-result-object p1
invoke-virtual {p2}, Landroid/os/Parcel;->readInt()I
move-result v0
const/4 v1, 0x0
if-eq v1, v0, :cond_3
sget-object v0, Lcom/google/android/gms/internal/v;->CREATOR:Lcom/google/android/gms/internal/w;
invoke-virtual {v0, p2}, Lcom/google/android/gms/internal/w;->a(Landroid/os/Parcel;)Lcom/google/android/gms/internal/v;
move-result-object p4
goto :goto_3
:cond_3
const/4 p4, 0x0
:goto_3
invoke-virtual {p2}, Landroid/os/Parcel;->readString()Ljava/lang/String;
move-result-object v7
invoke-virtual {p2}, Landroid/os/Parcel;->readStrongBinder()Landroid/os/IBinder;
move-result-object v0
invoke-static {v0}, Lcom/google/android/gms/internal/bd$a;->k(Landroid/os/IBinder;)Lcom/google/android/gms/internal/bd;
move-result-object v8
invoke-virtual {p0, p1, p4, v7, v8}, Lcom/google/android/gms/internal/bc$a;->a(Lcom/google/android/gms/dynamic/b;Lcom/google/android/gms/internal/v;Ljava/lang/String;Lcom/google/android/gms/internal/bd;)V
invoke-virtual {p3}, Landroid/os/Parcel;->writeNoException()V
const/4 v0, 0x1
return v0
:sswitch_4
const-string v0, "com.google.android.gms.ads.internal.mediation.client.IMediationAdapter"
invoke-virtual {p2, v0}, Landroid/os/Parcel;->enforceInterface(Ljava/lang/String;)V
invoke-virtual {p0}, Lcom/google/android/gms/internal/bc$a;->showInterstitial()V
invoke-virtual {p3}, Landroid/os/Parcel;->writeNoException()V
const/4 v0, 0x1
return v0
:sswitch_5
const-string v0, "com.google.android.gms.ads.internal.mediation.client.IMediationAdapter"
invoke-virtual {p2, v0}, Landroid/os/Parcel;->enforceInterface(Ljava/lang/String;)V
invoke-virtual {p0}, Lcom/google/android/gms/internal/bc$a;->destroy()V
invoke-virtual {p3}, Landroid/os/Parcel;->writeNoException()V
const/4 v0, 0x1
return v0
:sswitch_6
const-string v0, "com.google.android.gms.ads.internal.mediation.client.IMediationAdapter"
invoke-virtual {p2, v0}, Landroid/os/Parcel;->enforceInterface(Ljava/lang/String;)V
invoke-virtual {p2}, Landroid/os/Parcel;->readStrongBinder()Landroid/os/IBinder;
move-result-object v0
invoke-static {v0}, Lcom/google/android/gms/dynamic/b$a;->E(Landroid/os/IBinder;)Lcom/google/android/gms/dynamic/b;
move-result-object p1
invoke-virtual {p2}, Landroid/os/Parcel;->readInt()I
move-result v0
const/4 v1, 0x0
if-eq v1, v0, :cond_4
sget-object v0, Lcom/google/android/gms/internal/x;->CREATOR:Lcom/google/android/gms/internal/y;
invoke-virtual {v0, p2}, Lcom/google/android/gms/internal/y;->b(Landroid/os/Parcel;)Lcom/google/android/gms/internal/x;
move-result-object p4
goto :goto_4
:cond_4
const/4 p4, 0x0
:goto_4
invoke-virtual {p2}, Landroid/os/Parcel;->readInt()I
move-result v0
const/4 v1, 0x0
if-eq v1, v0, :cond_5
sget-object v0, Lcom/google/android/gms/internal/v;->CREATOR:Lcom/google/android/gms/internal/w;
invoke-virtual {v0, p2}, Lcom/google/android/gms/internal/w;->a(Landroid/os/Parcel;)Lcom/google/android/gms/internal/v;
move-result-object v7
goto :goto_5
:cond_5
const/4 v7, 0x0
:goto_5
invoke-virtual {p2}, Landroid/os/Parcel;->readString()Ljava/lang/String;
move-result-object v8
invoke-virtual {p2}, Landroid/os/Parcel;->readString()Ljava/lang/String;
move-result-object v9
invoke-virtual {p2}, Landroid/os/Parcel;->readStrongBinder()Landroid/os/IBinder;
move-result-object v0
invoke-static {v0}, Lcom/google/android/gms/internal/bd$a;->k(Landroid/os/IBinder;)Lcom/google/android/gms/internal/bd;
move-result-object p2
move-object v0, p0
move-object v1, p1
move-object v2, p4
move-object v3, v7
move-object v4, v8
move-object v5, v9
move-object v6, p2
invoke-virtual/range {v0 .. v6}, Lcom/google/android/gms/internal/bc$a;->a(Lcom/google/android/gms/dynamic/b;Lcom/google/android/gms/internal/x;Lcom/google/android/gms/internal/v;Ljava/lang/String;Ljava/lang/String;Lcom/google/android/gms/internal/bd;)V
invoke-virtual {p3}, Landroid/os/Parcel;->writeNoException()V
const/4 v0, 0x1
return v0
:sswitch_7
const-string v0, "com.google.android.gms.ads.internal.mediation.client.IMediationAdapter"
invoke-virtual {p2, v0}, Landroid/os/Parcel;->enforceInterface(Ljava/lang/String;)V
invoke-virtual {p2}, Landroid/os/Parcel;->readStrongBinder()Landroid/os/IBinder;
move-result-object v0
invoke-static {v0}, Lcom/google/android/gms/dynamic/b$a;->E(Landroid/os/IBinder;)Lcom/google/android/gms/dynamic/b;
move-result-object p1
invoke-virtual {p2}, Landroid/os/Parcel;->readInt()I
move-result v0
const/4 v1, 0x0
if-eq v1, v0, :cond_6
sget-object v0, Lcom/google/android/gms/internal/v;->CREATOR:Lcom/google/android/gms/internal/w;
invoke-virtual {v0, p2}, Lcom/google/android/gms/internal/w;->a(Landroid/os/Parcel;)Lcom/google/android/gms/internal/v;
move-result-object p4
goto :goto_6
:cond_6
const/4 p4, 0x0
:goto_6
invoke-virtual {p2}, Landroid/os/Parcel;->readString()Ljava/lang/String;
move-result-object v7
invoke-virtual {p2}, Landroid/os/Parcel;->readString()Ljava/lang/String;
move-result-object v8
invoke-virtual {p2}, Landroid/os/Parcel;->readStrongBinder()Landroid/os/IBinder;
move-result-object v0
invoke-static {v0}, Lcom/google/android/gms/internal/bd$a;->k(Landroid/os/IBinder;)Lcom/google/android/gms/internal/bd;
move-result-object v9
move-object v0, p0
move-object v1, p1
move-object v2, p4
move-object v3, v7
move-object v4, v8
move-object v5, v9
invoke-virtual/range {v0 .. v5}, Lcom/google/android/gms/internal/bc$a;->a(Lcom/google/android/gms/dynamic/b;Lcom/google/android/gms/internal/v;Ljava/lang/String;Ljava/lang/String;Lcom/google/android/gms/internal/bd;)V
invoke-virtual {p3}, Landroid/os/Parcel;->writeNoException()V
const/4 v0, 0x1
return v0
:goto_7
invoke-super {p0, p1, p2, p3, p4}, Landroid/os/Binder;->onTransact(ILandroid/os/Parcel;Landroid/os/Parcel;I)Z
move-result v0
return v0
.end method
|
{
"content_hash": "f7955fee4128b55a1942282e7e71b652",
"timestamp": "",
"source": "github",
"line_count": 473,
"max_line_length": 257,
"avg_line_length": 25.84566596194503,
"alnum_prop": 0.6948057259713701,
"repo_name": "mmmsplay10/QuizUpWinner",
"id": "c6eea8d29d4cfa5bec52d43621db1f5a306fd487",
"size": "12225",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "com.quizup.core/smali/com/google/android/gms/internal/bc$a.smali",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "6075"
},
{
"name": "Java",
"bytes": "23608889"
},
{
"name": "JavaScript",
"bytes": "6345"
},
{
"name": "Python",
"bytes": "933916"
}
]
}
|
class UserDecorator < Draper::Decorator
decorates :user
include Draper::LazyHelpers
def contributions_text
if source.total_contributed_projects == 2
I18n.t('user.contributions_text.two')
elsif source.total_contributed_projects > 1
I18n.t('user.contributions_text.many', total: (source.total_contributed_projects-1))
else
I18n.t('user.contributions_text.one')
end
end
def twitter_link
"http://twitter.com/#{source.twitter}" unless source.twitter.blank?
end
def display_name
source.name.presence || I18n.t('user.no_name')
end
def display_image
# source.uploaded_image.thumb_avatar.url || '/assets/catarse_bootstrap/user.jpg'
'/assets/catarse_bootstrap/user.jpg'
end
def display_image_html
(%{<div class="avatar_wrapper">} +
h.image_tag(display_image, alt: "User", class: "thumb big u-round") +
%{</div>}).html_safe
end
def short_name
truncate display_name, length: 20
end
def medium_name
truncate display_name, length: 42
end
def display_credits
number_to_currency source.credits
end
# Return the total amount from pending refund payments
def display_pending_refund_payments_amount
number_to_currency(
source.pending_refund_payments.sum(&:value) + source.credits,
precision: 2)
end
# Return array with name of projects that user
# have pending refund payments
def display_pending_refund_payments_projects_name
source.pending_refund_payments_projects.map(&:name).uniq
end
def display_bank_account
if source.bank_account.present?
"#{source.bank_account.bank.code} - #{source.bank_account.bank.name} /
AG. #{source.bank_account.agency}-#{source.bank_account.agency_digit} /
CC. #{source.bank_account.account}-#{source.bank_account.account_digit}"
else
I18n.t('not_filled')
end
end
def display_bank_account_owner
if source.bank_account.present?
"#{source.bank_account.owner_name} / CPF: #{source.bank_account.owner_document}"
end
end
def display_total_of_contributions
number_to_currency source.payments.with_state('paid').sum(:value)
end
end
|
{
"content_hash": "95e1c149f6abb357a3d81159a90931fe",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 90,
"avg_line_length": 27.743589743589745,
"alnum_prop": 0.69362292051756,
"repo_name": "Nyxelio/crowdfunding-project",
"id": "1a9e7eb854e2244e20296c644af5361fb463ba51",
"size": "2164",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/decorators/user_decorator.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "149206"
},
{
"name": "CoffeeScript",
"bytes": "11495"
},
{
"name": "HTML",
"bytes": "280193"
},
{
"name": "JavaScript",
"bytes": "122392"
},
{
"name": "Ruby",
"bytes": "1239741"
}
]
}
|
redis-backup
============
a small ruby gem that allows automated redis RDB-file backups with support for compression and S3 uploading.
Installation
============
gem install redis-backup
Usage
=====
redis-backup [options]
Specific options:
-b, --backup-dir BACKUP_DIR Directory to write backups to
-c, --compress Compress backup as a zip file
-s, --redis-source REDIS_SOURCE Full path to redis dump.rdb file
-m REDIS_SAVE_METHOD, The method to call on redis for saving (save or bgsave or none)
--redis-save-method
-H, --redis-host REDIS_HOST Host for local redis
-p, --redis-port REDIS_PORT Port for local redis
-A S3_ACCESS_KEY_ID, Your access_key_id for AWS S3
--s3-access-key-id
-B, --s3-bucket S3_BUCKET Name of bucket to use on S3
-C, --s3-clean Cleanup intermediate backup files
-S S3_SECRET_ACCESS_KEY, Your secret_access_key for AWS S3
--s3-secret-access-key
Common options:
-h, --help Show this message
--version Show version
|
{
"content_hash": "fd314462ccee2983aae99858678f8bc9",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 108,
"avg_line_length": 38.21875,
"alnum_prop": 0.5633687653311529,
"repo_name": "josegonzalez/ruby-redis-backup",
"id": "5d56d95d70227dca7ceb56ef46b90f79a5746f95",
"size": "1223",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "9254"
}
]
}
|
import { expect } from 'chai'
import _unescape from '../../src/utility/_unescape'
describe('_unescape', function() {
it('is a function', function() {
expect(_unescape).to.be.a('function')
})
context('1 string argument', function() {
it('returns a string', function() {
expect(typeof _unescape('cord')).to.equal('string')
})
it('returns an identical copy if there is nothing to unescape', function() {
expect(_unescape('hello there')).to.equal('hello there')
})
it('unescapes all required entities', function() {
expect(_unescape('PG&E <<`electricity'>> is "cheap"'))
.to.equal('PG&E <<`electricity\'>> is "cheap"')
})
it('unescapes all required entities if ` is decimalized', function() {
expect(_unescape('PG&E <<`electricity'>> is "cheap"'))
.to.equal('PG&E <<`electricity\'>> is "cheap"')
})
it('returns a blank string if given a blank string', function() {
expect(_unescape('')).to.equal('')
})
})
context('no argument', function() {
it('returns undefined when there is argument', function() {
expect(_unescape()).to.be.undefined
})
})
context('1 nonstring argument', function() {
it('returns undefined when argument 0 is a number', function() {
expect(_unescape(123)).to.be.undefined
})
it(
'returns undefined when argument 0 is undefined',
function() {
expect(_unescape(undefined)).to.be.undefined
}
)
it(
'returns undefined when argument 0 is an array',
function() {
expect(_unescape(['string'])).to.be.undefined
}
)
it(
'returns undefined when argument 0 is null', function() {
expect(_unescape(null)).to.be.undefined
}
)
})
})
|
{
"content_hash": "58aceb203fc813fbb6548651a14d22e6",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 96,
"avg_line_length": 31.25423728813559,
"alnum_prop": 0.6003253796095445,
"repo_name": "jrpool/js-utility-underscore",
"id": "593aee3848f5ba09ab23794183c040f814617c6a",
"size": "1844",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spec/utility/_unescape.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "99996"
}
]
}
|
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:indeterminate="true"
style="?android:progressBarStyle" />
</RelativeLayout>
|
{
"content_hash": "633b025250ffb0ba4307fbacb740b291",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 74,
"avg_line_length": 34.46153846153846,
"alnum_prop": 0.6919642857142857,
"repo_name": "pchmn/RxSocialAuth",
"id": "17b4833e85321e3b68684d763e6804594e5eb1fd",
"size": "448",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "library/src/main/res/layout/activity_hidden_loading.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "84366"
}
]
}
|
<h1>SDLUnsubscribeButton Class Reference</h1>
<h3>Section Contents</h3>
<ul>
<li><a href="#section--init">-init</a></li>
<li><a href="#section--initWithDictionary:">-initWithDictionary:</a></li>
<li><a href="#section--initWithButtonName:">-initWithButtonName:</a></li>
<li><a href="#section-buttonName">buttonName</a></li>
</ul>
<h3>Overview</h3>
<p>Deletes a subscription to button notifications for the specified button. For
more information about button subscriptions, see SDLSubscribeButton
<p>
Application can unsubscribe from a button that is currently being pressed
(i.e. has not yet been released), but app will not get button event
<p>
<b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b>
<p></p>
<p>@since SmartDeviceLink 1.0<br/>
See SDLSubscribeButton</p>
<section class="section task-group-section">
<h3 id="section--init">
-init
</h3>
<p>@abstract Constructs a new SDLUnsubscribeButton object</p>
<h4>Objective-C</h4>
<pre class="highlight"><code><span class="k">-</span> <span class="p">(</span><span class="n">instancetype</span><span class="p">)</span><span class="n">init</span><span class="p">;</span></code></pre>
<h4>Swift</h4>
<pre class="highlight"><code><span class="nf">init</span><span class="o">!</span><span class="p">()</span></code></pre>
<h3 id="section--initWithDictionary:">
-initWithDictionary:
</h3>
<p>@abstract Constructs a new SDLUnsubscribeButton object indicated by the NSMutableDictionary
parameter
- parameter: dict The dictionary to use</p>
<h4>Objective-C</h4>
<pre class="highlight"><code><span class="k">-</span> <span class="p">(</span><span class="n">instancetype</span><span class="p">)</span><span class="nf">initWithDictionary</span><span class="p">:(</span><span class="n">NSMutableDictionary</span> <span class="o">*</span><span class="p">)</span><span class="nv">dict</span><span class="p">;</span></code></pre>
<h4>Swift</h4>
<pre class="highlight"><code><span class="nf">init</span><span class="o">!</span><span class="p">(</span><span class="n">dictionary</span> <span class="nv">dict</span><span class="p">:</span> <span class="kt">NSMutableDictionary</span><span class="o">!</span><span class="p">)</span></code></pre>
<h4>Parameters</h4>
<dl>
<dt>dict</dt>
<dd><p>The dictionary to use</p>
</dd>
</dl>
<h3 id="section--initWithButtonName:">
-initWithButtonName:
</h3>
<p>Undocumented</p>
<h4>Objective-C</h4>
<pre class="highlight"><code><span class="k">@interface</span> <span class="nc">SDLUnsubscribeButton</span> <span class="p">:</span> <span class="nc">SDLRPCRequest</span></code></pre>
<h3 id="section-buttonName">
buttonName
</h3>
<p>@abstract A name of the button to unsubscribe from
@discussion An Enumeration value, see <i>
SDLButtonName</i></p>
<h4>Objective-C</h4>
<pre class="highlight"><code><span class="k">@property</span> <span class="p">(</span><span class="n">readwrite</span><span class="p">,</span> <span class="n">strong</span><span class="p">,</span> <span class="n">atomic</span><span class="p">)</span> <span class="n"><a href="../Classes/SDLButtonName.html">SDLButtonName</a></span> <span class="o">*</span><span class="n">buttonName</span><span class="p">;</span></code></pre>
<h4>Swift</h4>
<pre class="highlight"><code><span class="k">var</span> <span class="nv">buttonName</span><span class="p">:</span> <span class="kt"><a href="../Classes/SDLButtonName.html">SDLButtonName</a></span><span class="o">!</span> <span class="p">{</span> <span class="k">get</span> <span class="k">set</span> <span class="p">}</span></code></pre>
</section>
|
{
"content_hash": "c5edf36796451f1e5045f773e0c02d16",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 428,
"avg_line_length": 34.99065420560748,
"alnum_prop": 0.6501068376068376,
"repo_name": "davidswi/sdl_ios",
"id": "85090973c50d325bc6765189370f412c98361b4d",
"size": "3744",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/Classes/SDLUnsubscribeButton.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C++",
"bytes": "438"
},
{
"name": "HTML",
"bytes": "1587"
},
{
"name": "Objective-C",
"bytes": "2448707"
},
{
"name": "Ruby",
"bytes": "11697"
},
{
"name": "Shell",
"bytes": "240"
},
{
"name": "Swift",
"bytes": "62"
}
]
}
|
using namespace json_spirit;
using namespace std;
void ScriptPubKeyToJSON(const CScript& scriptPubKey, Object& out, bool fIncludeHex)
{
txnouttype type;
vector<CTxDestination> addresses;
int nRequired;
out.push_back(Pair("asm", scriptPubKey.ToString()));
if (fIncludeHex)
out.push_back(Pair("hex", HexStr(scriptPubKey.begin(), scriptPubKey.end())));
if (!ExtractDestinations(scriptPubKey, type, addresses, nRequired)) {
out.push_back(Pair("type", GetTxnOutputType(type)));
return;
}
out.push_back(Pair("reqSigs", nRequired));
out.push_back(Pair("type", GetTxnOutputType(type)));
Array a;
BOOST_FOREACH(const CTxDestination& addr, addresses)
a.push_back(CBitcoinAddress(addr).ToString());
out.push_back(Pair("addresses", a));
}
void TxToJSON(const CTransaction& tx, const uint256 hashBlock, Object& entry)
{
entry.push_back(Pair("txid", tx.GetHash().GetHex()));
entry.push_back(Pair("version", tx.nVersion));
entry.push_back(Pair("locktime", (int64_t)tx.nLockTime));
Array vin;
BOOST_FOREACH(const CTxIn& txin, tx.vin) {
Object in;
if (tx.IsCoinBase())
in.push_back(Pair("coinbase", HexStr(txin.scriptSig.begin(), txin.scriptSig.end())));
else {
in.push_back(Pair("txid", txin.prevout.hash.GetHex()));
in.push_back(Pair("vout", (int64_t)txin.prevout.n));
Object o;
o.push_back(Pair("asm", txin.scriptSig.ToString()));
o.push_back(Pair("hex", HexStr(txin.scriptSig.begin(), txin.scriptSig.end())));
in.push_back(Pair("scriptSig", o));
}
in.push_back(Pair("sequence", (int64_t)txin.nSequence));
vin.push_back(in);
}
entry.push_back(Pair("vin", vin));
Array vout;
for (unsigned int i = 0; i < tx.vout.size(); i++) {
const CTxOut& txout = tx.vout[i];
Object out;
out.push_back(Pair("value", ValueFromAmount(txout.nValue)));
out.push_back(Pair("n", (int64_t)i));
Object o;
ScriptPubKeyToJSON(txout.scriptPubKey, o, true);
out.push_back(Pair("scriptPubKey", o));
vout.push_back(out);
}
entry.push_back(Pair("vout", vout));
if (!hashBlock.IsNull()) {
entry.push_back(Pair("blockhash", hashBlock.GetHex()));
BlockMap::iterator mi = mapBlockIndex.find(hashBlock);
if (mi != mapBlockIndex.end() && (*mi).second) {
CBlockIndex* pindex = (*mi).second;
if (chainActive.Contains(pindex)) {
entry.push_back(Pair("confirmations", 1 + chainActive.Height() - pindex->nHeight));
entry.push_back(Pair("time", pindex->GetBlockTime()));
entry.push_back(Pair("blocktime", pindex->GetBlockTime()));
}
else
entry.push_back(Pair("confirmations", 0));
}
}
}
Value getrawtransaction(const Array& params, bool fHelp)
{
if (fHelp || params.size() < 1 || params.size() > 2)
throw runtime_error(
"getrawtransaction \"txid\" ( verbose )\n"
"\nNOTE: By default this function only works sometimes. This is when the tx is in the mempool\n"
"or there is an unspent output in the utxo for this transaction. To make it always work,\n"
"you need to maintain a transaction index, using the -txindex command line option.\n"
"\nReturn the raw transaction data.\n"
"\nIf verbose=0, returns a string that is serialized, hex-encoded data for 'txid'.\n"
"If verbose is non-zero, returns an Object with information about 'txid'.\n"
"\nArguments:\n"
"1. \"txid\" (string, required) The transaction id\n"
"2. verbose (numeric, optional, default=0) If 0, return a string, other return a json object\n"
"\nResult (if verbose is not set or set to 0):\n"
"\"data\" (string) The serialized, hex-encoded data for 'txid'\n"
"\nResult (if verbose > 0):\n"
"{\n"
" \"hex\" : \"data\", (string) The serialized, hex-encoded data for 'txid'\n"
" \"txid\" : \"id\", (string) The transaction id (same as provided)\n"
" \"version\" : n, (numeric) The version\n"
" \"locktime\" : ttt, (numeric) The lock time\n"
" \"vin\" : [ (array of json objects)\n"
" {\n"
" \"txid\": \"id\", (string) The transaction id\n"
" \"vout\": n, (numeric) \n"
" \"scriptSig\": { (json object) The script\n"
" \"asm\": \"asm\", (string) asm\n"
" \"hex\": \"hex\" (string) hex\n"
" },\n"
" \"sequence\": n (numeric) The script sequence number\n"
" }\n"
" ,...\n"
" ],\n"
" \"vout\" : [ (array of json objects)\n"
" {\n"
" \"value\" : x.xxx, (numeric) The value in btc\n"
" \"n\" : n, (numeric) index\n"
" \"scriptPubKey\" : { (json object)\n"
" \"asm\" : \"asm\", (string) the asm\n"
" \"hex\" : \"hex\", (string) the hex\n"
" \"reqSigs\" : n, (numeric) The required sigs\n"
" \"type\" : \"pubkeyhash\", (string) The type, eg 'pubkeyhash'\n"
" \"addresses\" : [ (json array of string)\n"
" \"prototaniumaddress\" (string) bitcoin address\n"
" ,...\n"
" ]\n"
" }\n"
" }\n"
" ,...\n"
" ],\n"
" \"blockhash\" : \"hash\", (string) the block hash\n"
" \"confirmations\" : n, (numeric) The confirmations\n"
" \"time\" : ttt, (numeric) The transaction time in seconds since epoch (Jan 1 1970 GMT)\n"
" \"blocktime\" : ttt (numeric) The block time in seconds since epoch (Jan 1 1970 GMT)\n"
"}\n"
"\nExamples:\n"
+ HelpExampleCli("getrawtransaction", "\"mytxid\"")
+ HelpExampleCli("getrawtransaction", "\"mytxid\" 1")
+ HelpExampleRpc("getrawtransaction", "\"mytxid\", 1")
);
LOCK(cs_main);
uint256 hash = ParseHashV(params[0], "parameter 1");
bool fVerbose = false;
if (params.size() > 1)
fVerbose = (params[1].get_int() != 0);
CTransaction tx;
uint256 hashBlock;
if (!GetTransaction(hash, tx, hashBlock, true))
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "No information available about transaction");
string strHex = EncodeHexTx(tx);
if (!fVerbose)
return strHex;
Object result;
result.push_back(Pair("hex", strHex));
TxToJSON(tx, hashBlock, result);
return result;
}
#ifdef ENABLE_WALLET
Value listunspent(const Array& params, bool fHelp)
{
if (fHelp || params.size() > 3)
throw runtime_error(
"listunspent ( minconf maxconf [\"address\",...] )\n"
"\nReturns array of unspent transaction outputs\n"
"with between minconf and maxconf (inclusive) confirmations.\n"
"Optionally filter to only include txouts paid to specified addresses.\n"
"Results are an array of Objects, each of which has:\n"
"{txid, vout, scriptPubKey, amount, confirmations}\n"
"\nArguments:\n"
"1. minconf (numeric, optional, default=1) The minimum confirmations to filter\n"
"2. maxconf (numeric, optional, default=9999999) The maximum confirmations to filter\n"
"3. \"addresses\" (string) A json array of bitcoin addresses to filter\n"
" [\n"
" \"address\" (string) bitcoin address\n"
" ,...\n"
" ]\n"
"\nResult\n"
"[ (array of json object)\n"
" {\n"
" \"txid\" : \"txid\", (string) the transaction id \n"
" \"vout\" : n, (numeric) the vout value\n"
" \"address\" : \"address\", (string) the bitcoin address\n"
" \"account\" : \"account\", (string) DEPRECATED. The associated account, or \"\" for the default account\n"
" \"scriptPubKey\" : \"key\", (string) the script key\n"
" \"amount\" : x.xxx, (numeric) the transaction amount in btc\n"
" \"confirmations\" : n (numeric) The number of confirmations\n"
" }\n"
" ,...\n"
"]\n"
"\nExamples\n"
+ HelpExampleCli("listunspent", "")
+ HelpExampleCli("listunspent", "6 9999999 \"[\\\"1PGFqEzfmQch1gKD3ra4k18PNj3tTUUSqg\\\",\\\"1LtvqCaApEdUGFkpKMM4MstjcaL4dKg8SP\\\"]\"")
+ HelpExampleRpc("listunspent", "6, 9999999 \"[\\\"1PGFqEzfmQch1gKD3ra4k18PNj3tTUUSqg\\\",\\\"1LtvqCaApEdUGFkpKMM4MstjcaL4dKg8SP\\\"]\"")
);
RPCTypeCheck(params, boost::assign::list_of(int_type)(int_type)(array_type));
int nMinDepth = 1;
if (params.size() > 0)
nMinDepth = params[0].get_int();
int nMaxDepth = 9999999;
if (params.size() > 1)
nMaxDepth = params[1].get_int();
set<CBitcoinAddress> setAddress;
if (params.size() > 2) {
Array inputs = params[2].get_array();
BOOST_FOREACH(Value& input, inputs) {
CBitcoinAddress address(input.get_str());
if (!address.IsValid())
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, string("Invalid Bitcoin address: ")+input.get_str());
if (setAddress.count(address))
throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid parameter, duplicated address: ")+input.get_str());
setAddress.insert(address);
}
}
Array results;
vector<COutput> vecOutputs;
assert(pwalletMain != NULL);
LOCK2(cs_main, pwalletMain->cs_wallet);
pwalletMain->AvailableCoins(vecOutputs, false);
BOOST_FOREACH(const COutput& out, vecOutputs) {
if (out.nDepth < nMinDepth || out.nDepth > nMaxDepth)
continue;
if (setAddress.size()) {
CTxDestination address;
if (!ExtractDestination(out.tx->vout[out.i].scriptPubKey, address))
continue;
if (!setAddress.count(address))
continue;
}
CAmount nValue = out.tx->vout[out.i].nValue;
const CScript& pk = out.tx->vout[out.i].scriptPubKey;
Object entry;
entry.push_back(Pair("txid", out.tx->GetHash().GetHex()));
entry.push_back(Pair("vout", out.i));
CTxDestination address;
if (ExtractDestination(out.tx->vout[out.i].scriptPubKey, address)) {
entry.push_back(Pair("address", CBitcoinAddress(address).ToString()));
if (pwalletMain->mapAddressBook.count(address))
entry.push_back(Pair("account", pwalletMain->mapAddressBook[address].name));
}
entry.push_back(Pair("scriptPubKey", HexStr(pk.begin(), pk.end())));
if (pk.IsPayToScriptHash()) {
CTxDestination address;
if (ExtractDestination(pk, address)) {
const CScriptID& hash = boost::get<const CScriptID&>(address);
CScript redeemScript;
if (pwalletMain->GetCScript(hash, redeemScript))
entry.push_back(Pair("redeemScript", HexStr(redeemScript.begin(), redeemScript.end())));
}
}
entry.push_back(Pair("amount",ValueFromAmount(nValue)));
entry.push_back(Pair("confirmations",out.nDepth));
entry.push_back(Pair("spendable", out.fSpendable));
results.push_back(entry);
}
return results;
}
#endif
Value createrawtransaction(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 2)
throw runtime_error(
"createrawtransaction [{\"txid\":\"id\",\"vout\":n},...] {\"address\":amount,...}\n"
"\nCreate a transaction spending the given inputs and sending to the given addresses.\n"
"Returns hex-encoded raw transaction.\n"
"Note that the transaction's inputs are not signed, and\n"
"it is not stored in the wallet or transmitted to the network.\n"
"\nArguments:\n"
"1. \"transactions\" (string, required) A json array of json objects\n"
" [\n"
" {\n"
" \"txid\":\"id\", (string, required) The transaction id\n"
" \"vout\":n (numeric, required) The output number\n"
" }\n"
" ,...\n"
" ]\n"
"2. \"addresses\" (string, required) a json object with addresses as keys and amounts as values\n"
" {\n"
" \"address\": x.xxx (numeric, required) The key is the bitcoin address, the value is the btc amount\n"
" ,...\n"
" }\n"
"\nResult:\n"
"\"transaction\" (string) hex string of the transaction\n"
"\nExamples\n"
+ HelpExampleCli("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" \"{\\\"address\\\":0.01}\"")
+ HelpExampleRpc("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\", \"{\\\"address\\\":0.01}\"")
);
LOCK(cs_main);
RPCTypeCheck(params, boost::assign::list_of(array_type)(obj_type));
Array inputs = params[0].get_array();
Object sendTo = params[1].get_obj();
CMutableTransaction rawTx;
BOOST_FOREACH(const Value& input, inputs) {
const Object& o = input.get_obj();
uint256 txid = ParseHashO(o, "txid");
const Value& vout_v = find_value(o, "vout");
if (vout_v.type() != int_type)
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, missing vout key");
int nOutput = vout_v.get_int();
if (nOutput < 0)
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, vout must be positive");
CTxIn in(COutPoint(txid, nOutput));
rawTx.vin.push_back(in);
}
set<CBitcoinAddress> setAddress;
BOOST_FOREACH(const Pair& s, sendTo) {
CBitcoinAddress address(s.name_);
if (!address.IsValid())
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, string("Invalid Bitcoin address: ")+s.name_);
if (setAddress.count(address))
throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid parameter, duplicated address: ")+s.name_);
setAddress.insert(address);
CScript scriptPubKey = GetScriptForDestination(address.Get());
CAmount nAmount = AmountFromValue(s.value_);
CTxOut out(nAmount, scriptPubKey);
rawTx.vout.push_back(out);
}
return EncodeHexTx(rawTx);
}
Value decoderawtransaction(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 1)
throw runtime_error(
"decoderawtransaction \"hexstring\"\n"
"\nReturn a JSON object representing the serialized, hex-encoded transaction.\n"
"\nArguments:\n"
"1. \"hex\" (string, required) The transaction hex string\n"
"\nResult:\n"
"{\n"
" \"txid\" : \"id\", (string) The transaction id\n"
" \"version\" : n, (numeric) The version\n"
" \"locktime\" : ttt, (numeric) The lock time\n"
" \"vin\" : [ (array of json objects)\n"
" {\n"
" \"txid\": \"id\", (string) The transaction id\n"
" \"vout\": n, (numeric) The output number\n"
" \"scriptSig\": { (json object) The script\n"
" \"asm\": \"asm\", (string) asm\n"
" \"hex\": \"hex\" (string) hex\n"
" },\n"
" \"sequence\": n (numeric) The script sequence number\n"
" }\n"
" ,...\n"
" ],\n"
" \"vout\" : [ (array of json objects)\n"
" {\n"
" \"value\" : x.xxx, (numeric) The value in btc\n"
" \"n\" : n, (numeric) index\n"
" \"scriptPubKey\" : { (json object)\n"
" \"asm\" : \"asm\", (string) the asm\n"
" \"hex\" : \"hex\", (string) the hex\n"
" \"reqSigs\" : n, (numeric) The required sigs\n"
" \"type\" : \"pubkeyhash\", (string) The type, eg 'pubkeyhash'\n"
" \"addresses\" : [ (json array of string)\n"
" \"12tvKAXCxZjSmdNbao16dKXC8tRWfcF5oc\" (string) bitcoin address\n"
" ,...\n"
" ]\n"
" }\n"
" }\n"
" ,...\n"
" ],\n"
"}\n"
"\nExamples:\n"
+ HelpExampleCli("decoderawtransaction", "\"hexstring\"")
+ HelpExampleRpc("decoderawtransaction", "\"hexstring\"")
);
LOCK(cs_main);
RPCTypeCheck(params, boost::assign::list_of(str_type));
CTransaction tx;
if (!DecodeHexTx(tx, params[0].get_str()))
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed");
Object result;
TxToJSON(tx, uint256(), result);
return result;
}
Value decodescript(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 1)
throw runtime_error(
"decodescript \"hex\"\n"
"\nDecode a hex-encoded script.\n"
"\nArguments:\n"
"1. \"hex\" (string) the hex encoded script\n"
"\nResult:\n"
"{\n"
" \"asm\":\"asm\", (string) Script public key\n"
" \"hex\":\"hex\", (string) hex encoded public key\n"
" \"type\":\"type\", (string) The output type\n"
" \"reqSigs\": n, (numeric) The required signatures\n"
" \"addresses\": [ (json array of string)\n"
" \"address\" (string) bitcoin address\n"
" ,...\n"
" ],\n"
" \"p2sh\",\"address\" (string) script address\n"
"}\n"
"\nExamples:\n"
+ HelpExampleCli("decodescript", "\"hexstring\"")
+ HelpExampleRpc("decodescript", "\"hexstring\"")
);
LOCK(cs_main);
RPCTypeCheck(params, boost::assign::list_of(str_type));
Object r;
CScript script;
if (params[0].get_str().size() > 0){
vector<unsigned char> scriptData(ParseHexV(params[0], "argument"));
script = CScript(scriptData.begin(), scriptData.end());
} else {
// Empty scripts are valid
}
ScriptPubKeyToJSON(script, r, false);
r.push_back(Pair("p2sh", CBitcoinAddress(CScriptID(script)).ToString()));
return r;
}
Value signrawtransaction(const Array& params, bool fHelp)
{
if (fHelp || params.size() < 1 || params.size() > 4)
throw runtime_error(
"signrawtransaction \"hexstring\" ( [{\"txid\":\"id\",\"vout\":n,\"scriptPubKey\":\"hex\",\"redeemScript\":\"hex\"},...] [\"privatekey1\",...] sighashtype )\n"
"\nSign inputs for raw transaction (serialized, hex-encoded).\n"
"The second optional argument (may be null) is an array of previous transaction outputs that\n"
"this transaction depends on but may not yet be in the block chain.\n"
"The third optional argument (may be null) is an array of base58-encoded private\n"
"keys that, if given, will be the only keys used to sign the transaction.\n"
#ifdef ENABLE_WALLET
+ HelpRequiringPassphrase() + "\n"
#endif
"\nArguments:\n"
"1. \"hexstring\" (string, required) The transaction hex string\n"
"2. \"prevtxs\" (string, optional) An json array of previous dependent transaction outputs\n"
" [ (json array of json objects, or 'null' if none provided)\n"
" {\n"
" \"txid\":\"id\", (string, required) The transaction id\n"
" \"vout\":n, (numeric, required) The output number\n"
" \"scriptPubKey\": \"hex\", (string, required) script key\n"
" \"redeemScript\": \"hex\" (string, required for P2SH) redeem script\n"
" }\n"
" ,...\n"
" ]\n"
"3. \"privatekeys\" (string, optional) A json array of base58-encoded private keys for signing\n"
" [ (json array of strings, or 'null' if none provided)\n"
" \"privatekey\" (string) private key in base58-encoding\n"
" ,...\n"
" ]\n"
"4. \"sighashtype\" (string, optional, default=ALL) The signature hash type. Must be one of\n"
" \"ALL\"\n"
" \"NONE\"\n"
" \"SINGLE\"\n"
" \"ALL|ANYONECANPAY\"\n"
" \"NONE|ANYONECANPAY\"\n"
" \"SINGLE|ANYONECANPAY\"\n"
"\nResult:\n"
"{\n"
" \"hex\": \"value\", (string) The raw transaction with signature(s) (hex-encoded string)\n"
" \"complete\": n (numeric) if transaction has a complete set of signature (0 if not)\n"
"}\n"
"\nExamples:\n"
+ HelpExampleCli("signrawtransaction", "\"myhex\"")
+ HelpExampleRpc("signrawtransaction", "\"myhex\"")
);
#ifdef ENABLE_WALLET
LOCK2(cs_main, pwalletMain ? &pwalletMain->cs_wallet : NULL);
#else
LOCK(cs_main);
#endif
RPCTypeCheck(params, boost::assign::list_of(str_type)(array_type)(array_type)(str_type), true);
vector<unsigned char> txData(ParseHexV(params[0], "argument 1"));
CDataStream ssData(txData, SER_NETWORK, PROTOCOL_VERSION);
vector<CMutableTransaction> txVariants;
while (!ssData.empty()) {
try {
CMutableTransaction tx;
ssData >> tx;
txVariants.push_back(tx);
}
catch (const std::exception&) {
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed");
}
}
if (txVariants.empty())
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Missing transaction");
// mergedTx will end up with all the signatures; it
// starts as a clone of the rawtx:
CMutableTransaction mergedTx(txVariants[0]);
bool fComplete = true;
// Fetch previous transactions (inputs):
CCoinsView viewDummy;
CCoinsViewCache view(&viewDummy);
{
LOCK(mempool.cs);
CCoinsViewCache &viewChain = *pcoinsTip;
CCoinsViewMemPool viewMempool(&viewChain, mempool);
view.SetBackend(viewMempool); // temporarily switch cache backend to db+mempool view
BOOST_FOREACH(const CTxIn& txin, mergedTx.vin) {
const uint256& prevHash = txin.prevout.hash;
CCoins coins;
view.AccessCoins(prevHash); // this is certainly allowed to fail
}
view.SetBackend(viewDummy); // switch back to avoid locking mempool for too long
}
bool fGivenKeys = false;
CBasicKeyStore tempKeystore;
if (params.size() > 2 && params[2].type() != null_type) {
fGivenKeys = true;
Array keys = params[2].get_array();
BOOST_FOREACH(Value k, keys) {
CBitcoinSecret vchSecret;
bool fGood = vchSecret.SetString(k.get_str());
if (!fGood)
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid private key");
CKey key = vchSecret.GetKey();
if (!key.IsValid())
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Private key outside allowed range");
tempKeystore.AddKey(key);
}
}
#ifdef ENABLE_WALLET
else if (pwalletMain)
EnsureWalletIsUnlocked();
#endif
// Add previous txouts given in the RPC call:
if (params.size() > 1 && params[1].type() != null_type) {
Array prevTxs = params[1].get_array();
BOOST_FOREACH(Value& p, prevTxs) {
if (p.type() != obj_type)
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "expected object with {\"txid'\",\"vout\",\"scriptPubKey\"}");
Object prevOut = p.get_obj();
RPCTypeCheck(prevOut, boost::assign::map_list_of("txid", str_type)("vout", int_type)("scriptPubKey", str_type));
uint256 txid = ParseHashO(prevOut, "txid");
int nOut = find_value(prevOut, "vout").get_int();
if (nOut < 0)
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "vout must be positive");
vector<unsigned char> pkData(ParseHexO(prevOut, "scriptPubKey"));
CScript scriptPubKey(pkData.begin(), pkData.end());
{
CCoinsModifier coins = view.ModifyCoins(txid);
if (coins->IsAvailable(nOut) && coins->vout[nOut].scriptPubKey != scriptPubKey) {
string err("Previous output scriptPubKey mismatch:\n");
err = err + coins->vout[nOut].scriptPubKey.ToString() + "\nvs:\n"+
scriptPubKey.ToString();
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, err);
}
if ((unsigned int)nOut >= coins->vout.size())
coins->vout.resize(nOut+1);
coins->vout[nOut].scriptPubKey = scriptPubKey;
coins->vout[nOut].nValue = 0; // we don't know the actual output value
}
// if redeemScript given and not using the local wallet (private keys
// given), add redeemScript to the tempKeystore so it can be signed:
if (fGivenKeys && scriptPubKey.IsPayToScriptHash()) {
RPCTypeCheck(prevOut, boost::assign::map_list_of("txid", str_type)("vout", int_type)("scriptPubKey", str_type)("redeemScript",str_type));
Value v = find_value(prevOut, "redeemScript");
if (!(v == Value::null)) {
vector<unsigned char> rsData(ParseHexV(v, "redeemScript"));
CScript redeemScript(rsData.begin(), rsData.end());
tempKeystore.AddCScript(redeemScript);
}
}
}
}
#ifdef ENABLE_WALLET
const CKeyStore& keystore = ((fGivenKeys || !pwalletMain) ? tempKeystore : *pwalletMain);
#else
const CKeyStore& keystore = tempKeystore;
#endif
int nHashType = SIGHASH_ALL;
if (params.size() > 3 && params[3].type() != null_type) {
static map<string, int> mapSigHashValues =
boost::assign::map_list_of
(string("ALL"), int(SIGHASH_ALL))
(string("ALL|ANYONECANPAY"), int(SIGHASH_ALL|SIGHASH_ANYONECANPAY))
(string("NONE"), int(SIGHASH_NONE))
(string("NONE|ANYONECANPAY"), int(SIGHASH_NONE|SIGHASH_ANYONECANPAY))
(string("SINGLE"), int(SIGHASH_SINGLE))
(string("SINGLE|ANYONECANPAY"), int(SIGHASH_SINGLE|SIGHASH_ANYONECANPAY))
;
string strHashType = params[3].get_str();
if (mapSigHashValues.count(strHashType))
nHashType = mapSigHashValues[strHashType];
else
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid sighash param");
}
bool fHashSingle = ((nHashType & ~SIGHASH_ANYONECANPAY) == SIGHASH_SINGLE);
// Sign what we can:
for (unsigned int i = 0; i < mergedTx.vin.size(); i++) {
CTxIn& txin = mergedTx.vin[i];
const CCoins* coins = view.AccessCoins(txin.prevout.hash);
if (coins == NULL || !coins->IsAvailable(txin.prevout.n)) {
fComplete = false;
continue;
}
const CScript& prevPubKey = coins->vout[txin.prevout.n].scriptPubKey;
txin.scriptSig.clear();
// Only sign SIGHASH_SINGLE if there's a corresponding output:
if (!fHashSingle || (i < mergedTx.vout.size()))
SignSignature(keystore, prevPubKey, mergedTx, i, nHashType);
// ... and merge in other signatures:
BOOST_FOREACH(const CMutableTransaction& txv, txVariants) {
txin.scriptSig = CombineSignatures(prevPubKey, mergedTx, i, txin.scriptSig, txv.vin[i].scriptSig);
}
if (!VerifyScript(txin.scriptSig, prevPubKey, STANDARD_SCRIPT_VERIFY_FLAGS, MutableTransactionSignatureChecker(&mergedTx, i)))
fComplete = false;
}
Object result;
result.push_back(Pair("hex", EncodeHexTx(mergedTx)));
result.push_back(Pair("complete", fComplete));
return result;
}
Value sendrawtransaction(const Array& params, bool fHelp)
{
if (fHelp || params.size() < 1 || params.size() > 2)
throw runtime_error(
"sendrawtransaction \"hexstring\" ( allowhighfees )\n"
"\nSubmits raw transaction (serialized, hex-encoded) to local node and network.\n"
"\nAlso see createrawtransaction and signrawtransaction calls.\n"
"\nArguments:\n"
"1. \"hexstring\" (string, required) The hex string of the raw transaction)\n"
"2. allowhighfees (boolean, optional, default=false) Allow high fees\n"
"\nResult:\n"
"\"hex\" (string) The transaction hash in hex\n"
"\nExamples:\n"
"\nCreate a transaction\n"
+ HelpExampleCli("createrawtransaction", "\"[{\\\"txid\\\" : \\\"mytxid\\\",\\\"vout\\\":0}]\" \"{\\\"myaddress\\\":0.01}\"") +
"Sign the transaction, and get back the hex\n"
+ HelpExampleCli("signrawtransaction", "\"myhex\"") +
"\nSend the transaction (signed hex)\n"
+ HelpExampleCli("sendrawtransaction", "\"signedhex\"") +
"\nAs a json rpc call\n"
+ HelpExampleRpc("sendrawtransaction", "\"signedhex\"")
);
LOCK(cs_main);
RPCTypeCheck(params, boost::assign::list_of(str_type)(bool_type));
// parse hex string from parameter
CTransaction tx;
if (!DecodeHexTx(tx, params[0].get_str()))
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed");
uint256 hashTx = tx.GetHash();
bool fOverrideFees = false;
if (params.size() > 1)
fOverrideFees = params[1].get_bool();
CCoinsViewCache &view = *pcoinsTip;
const CCoins* existingCoins = view.AccessCoins(hashTx);
bool fHaveMempool = mempool.exists(hashTx);
bool fHaveChain = existingCoins && existingCoins->nHeight < 1000000000;
if (!fHaveMempool && !fHaveChain) {
// push to local node and sync with wallets
CValidationState state;
if (!AcceptToMemoryPool(mempool, state, tx, false, NULL, !fOverrideFees)) {
if(state.IsInvalid())
throw JSONRPCError(RPC_TRANSACTION_REJECTED, strprintf("%i: %s", state.GetRejectCode(), state.GetRejectReason()));
else
throw JSONRPCError(RPC_TRANSACTION_ERROR, state.GetRejectReason());
}
} else if (fHaveChain) {
throw JSONRPCError(RPC_TRANSACTION_ALREADY_IN_CHAIN, "transaction already in block chain");
}
RelayTransaction(tx);
return hashTx.GetHex();
}
|
{
"content_hash": "c5320fab32520191b65982da129f1d62",
"timestamp": "",
"source": "github",
"line_count": 741,
"max_line_length": 171,
"avg_line_length": 43,
"alnum_prop": 0.5435144211154003,
"repo_name": "Prototanium/Pr",
"id": "334e4edf6de0b6db0f947674352c942eabe28438",
"size": "32553",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/rpcrawtransaction.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "403176"
},
{
"name": "C++",
"bytes": "3556042"
},
{
"name": "CSS",
"bytes": "1127"
},
{
"name": "Groff",
"bytes": "18190"
},
{
"name": "HTML",
"bytes": "50621"
},
{
"name": "Java",
"bytes": "2100"
},
{
"name": "Makefile",
"bytes": "58579"
},
{
"name": "Objective-C",
"bytes": "3104"
},
{
"name": "Objective-C++",
"bytes": "7182"
},
{
"name": "Protocol Buffer",
"bytes": "2308"
},
{
"name": "Python",
"bytes": "215627"
},
{
"name": "QMake",
"bytes": "2019"
},
{
"name": "Shell",
"bytes": "374352"
}
]
}
|
TransparentActivity
===================
A transparent activity for Android
|
{
"content_hash": "19217d1abbeac18203e8d981208a00c7",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 34,
"avg_line_length": 19,
"alnum_prop": 0.6447368421052632,
"repo_name": "jiahaoliuliu/TransparentActivity",
"id": "5c28dd6dbabb0d652a4250d75140333480b73546",
"size": "76",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "4732"
}
]
}
|
$(document).ready(function () {
$('#results').empty;
var userID = localStorage['userID'];
var Snapster;
var playlists = [];
// $("#filename").focus(function (event) {
$('#infoHeader').empty();
$('#infoHeader').append("Upcoming Songs");
$.ajax({
type: "GET",
url: "https://api.spotify.com/v1/users/" + userID + "/playlists",
headers: { 'Authorization': 'Bearer ' + access_token },
dataType: "json",
data: "formdata",
success: function (data) {
for (i = 0; i < data.items.length; i++) {
playlists.push(data.items[i].name);
}
partyPlaylist = playlists.indexOf("Partify");
if (playlists.indexOf("Partify") != -1 && data.items[partyPlaylist].id === localStorage['Snapster']) {
for (i = 0; i < data.items.length; i++) {
localStorage['Snapster'] = data.items[partyPlaylist].id;
Snapster = localStorage['Snapster'];
}
$("#results").css("text-align", "center");
$.ajax({
type: "GET",
url: "https://api.spotify.com/v1/users/" + userID + "/playlists/" + Snapster + "/tracks",
headers: { 'Authorization': 'Bearer ' + access_token },
dataType: "json",
data: "formdata",
success: function (currentPLData) {
$('#results').empty();
for (i = 0; i < currentPLData.items.length; i++) {
$('#results').append("<header alt='0' class='songLinkCurrent'>" + currentPLData.items[i].track.artists[0].name + "<br />" + currentPLData.items[i].track.name + "</header><br>");
$(".songLinkCurrent").eq(i).on("click", function () {
$(".songLinkCurrent").eq(i).append("alt", "100");
alert("Clicked");
});
}
}
});
playlists = [];
}
}
// });
});
});
|
{
"content_hash": "23d09b8266943427734c29d45574f443",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 205,
"avg_line_length": 44.2,
"alnum_prop": 0.43529411764705883,
"repo_name": "univthink/lilsnapppy",
"id": "fc61fc62b36662a27764836d5a579277467ae2a9",
"size": "2210",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "authorization_code/public/upcomingSongs.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "44349"
},
{
"name": "JavaScript",
"bytes": "332292"
},
{
"name": "PHP",
"bytes": "157"
}
]
}
|
title: Google Fiber Won’t Be Available for Small Businesses… Yet
date: 2013-10-10 10:55:31 -05:00
tags:
- Google
layout: post
custom_type: link
link_url: http://thenextweb.com/google/2013/10/10/google-promises-fiber-for-small-businesses-in-the-future-but-you-can-use-the-isp-if-you-work-from-home/
---
>Google today decided to clarify its stance for small businesses using Google Fiber. In short, small businesses aren’t allowed to take advantage of the ISP, at least not yet.
>
>…
>
>Currently, Google is only bringing Fiber to residential locations (units and homes where people live) as well as the public and nonprofit sites selected by each Fiber city. This means that there is currently a loophole: home-based businesses can use Google Fiber.
Why they would make such a seemingly arbitrary rule, doesn't make sense, and I'm sure will disappoint a lot of local businesses.
The question is: Will they enforce the policy?
|
{
"content_hash": "65fac94c1616453443d9b3d1fed777cb",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 264,
"avg_line_length": 51.55555555555556,
"alnum_prop": 0.7790948275862069,
"repo_name": "smithtimmytim/brightlycolored.org",
"id": "8a5b3dc96ff0c8877a9081bfde86a7e14155524b",
"size": "940",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_posts/2013-10-10-google-fiber-isn-t-for-small-businesses-yet.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "41991"
},
{
"name": "HTML",
"bytes": "69363"
},
{
"name": "JavaScript",
"bytes": "6430"
},
{
"name": "Ruby",
"bytes": "3694"
}
]
}
|
End of preview.
No dataset card yet
- Downloads last month
- 3