commit stringlengths 40 40 | old_file stringlengths 4 236 | new_file stringlengths 4 236 | old_contents stringlengths 1 3.26k | new_contents stringlengths 16 4.43k | subject stringlengths 16 624 | message stringlengths 17 3.29k | lang stringclasses 5
values | license stringclasses 13
values | repos stringlengths 5 91.5k |
|---|---|---|---|---|---|---|---|---|---|
ff8443b20b19c12422050da6ecb476398999b25f | build.rs | build.rs | use std::env;
fn main() {
// Decide ideal limb width for arithmetic in the float parser. Refer to
// src/lexical/math.rs for where this has an effect.
let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap();
match target_arch.as_str() {
"aarch64" | "mips64" | "powerpc64" | "x86_64" => {
... | use std::env;
use std::process::Command;
use std::str::{self, FromStr};
fn main() {
// Decide ideal limb width for arithmetic in the float parser. Refer to
// src/lexical/math.rs for where this has an effect.
let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap();
match target_arch.as_str() {
... | Add compiler version detection for BTreeMap api | Add compiler version detection for BTreeMap api
| Rust | apache-2.0 | serde-rs/json,google/serde_json_lenient |
953362c624644a4b483c4155f02ef0d6089acc10 | build.rs | build.rs | use std::env;
use std::fs::File;
use std::io::Write;
use std::path::Path;
use std::process::Command;
fn main() {
let output_dir = env::var("OUT_DIR").unwrap();
let output_file_path = Path::new(&output_dir).join("git-hash");
let mut output_file = File::create(&output_file_path).unwrap();
let git_comman... | use std::env;
use std::fs::File;
use std::io::Write;
use std::path::Path;
use std::process::Command;
fn main() {
// Write the hash of our current revision to the file
// ${OUT_DIR}/git-hash, so that it can be tetxually included in the
// binary using include_str!() in src/main.rs.
let output_dir = env:... | Add a comment explaining what git-hash is for. | Add a comment explaining what git-hash is for.
| Rust | mit | dbaron/wgmeeting-github-ircbot,dbaron/wgmeeting-github-ircbot |
52172f188e5c23f0e46894aec49d8cfde7be9d42 | build.rs | build.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use std::process::Command;
use std::env;
fn main() {
assert!(Command::new("make")
.args(&["-R", "-f"... | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use std::process::Command;
use std::env;
fn main() {
assert!(Command::new("make")
.args(&["-R", "-f"... | Use NUM_JOBS to control make -j | Use NUM_JOBS to control make -j
| Rust | bsd-3-clause | nox/skia,vvuk/skia,akiss77/skia,akiss77/skia,nox/skia,vvuk/skia,larsbergstrom/skia,larsbergstrom/skia,larsbergstrom/skia,akiss77/skia,larsbergstrom/skia,vvuk/skia,nox/skia,vvuk/skia,larsbergstrom/skia,akiss77/skia,nox/skia,larsbergstrom/skia,vvuk/skia,akiss77/skia,nox/skia,larsbergstrom/skia,vvuk/skia,akiss77/skia,lars... |
1857c88ff7127689da538b31cdce7a9839cda61c | rust/rotational-cipher/src/lib.rs | rust/rotational-cipher/src/lib.rs | #![feature(ascii_ctype)]
use std::ascii::AsciiExt;
pub fn rotate(text: &str, key: usize) -> String {
text.chars()
.map(|x| match x {
_ if x.is_ascii_lowercase() => {
let v = (x as u8 - b'a' + key as u8) % 26 + b'a';
v as char
}
_ if x.is_a... | #![feature(ascii_ctype)]
use std::ascii::AsciiExt;
pub fn rotate(text: &str, key: usize) -> String {
const LA: u8 = b'a';
const UA: u8 = b'A';
text.chars()
.map(|x| match x {
_ if x.is_ascii_lowercase() => {
let v = (x as u8 - LA + key as u8) % 26 + LA;
v... | Use const instead of magic number | Use const instead of magic number
It looks better
| Rust | bsd-2-clause | gyn/exercism,gyn/exercism,gyn/exercism,gyn/exercism |
194c11237c01da1d3f86571732fbacc8fbc9713f | src/skin.rs | src/skin.rs | // Copyright 2015 Birunthan Mohanathas
//
// Licensed under the MIT license <http://opensource.org/licenses/MIT>. This
// file may not be copied, modified, or distributed except according to those
// terms.
use measure::Measureable;
pub struct Skin<'a> {
name: String,
measures: Vec<Box<Measureable<'a> + 'a>>,... | // Copyright 2015 Birunthan Mohanathas
//
// Licensed under the MIT license <http://opensource.org/licenses/MIT>. This
// file may not be copied, modified, or distributed except according to those
// terms.
use measure::Measureable;
pub struct Skin<'a> {
name: String,
measures: Vec<Box<Measureable<'a> + 'a>>,... | Allow measures to be added to a Skin | Allow measures to be added to a Skin
| Rust | mit | poiru/rainmeter-rust |
279ec9b9b871dc6ef52ebc808adca177f596795e | src/test/run-pass/macro-with-braces-in-expr-position.rs | src/test/run-pass/macro-with-braces-in-expr-position.rs | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | Join child threads on windows in tests | test: Join child threads on windows in tests
Windows tests can often deadlock if a child thread continues after the main
thread and then panics, and a `println!` executed in a child thread after the
main thread has exited is at risk of panicking.
| Rust | apache-2.0 | gifnksm/rust,krzysz00/rust,l0kod/rust,omasanori/rust,dwillmer/rust,dwillmer/rust,gifnksm/rust,zachwick/rust,kwantam/rust,graydon/rust,nwin/rust,seanrivera/rust,l0kod/rust,seanrivera/rust,vhbit/rust,sae-bom/rust,pelmers/rust,TheNeikos/rust,krzysz00/rust,nwin/rust,ejjeong/rust,jroesch/rust,TheNeikos/rust,aneeshusa/rust,j... |
a476e763ee36c7c9ca8ec427befb45bd046a7d00 | src/transport.rs | src/transport.rs | use netbuf::Buf;
use {Transport, StreamSocket};
/// Transport is thing that provides buffered I/O for stream sockets
impl<'a, S: StreamSocket> Transport<'a, S> {
/// Get the reference to the underlying stream
///
/// It's here so you can inspect socket state or tune it. For example you
/// might want ... | use netbuf::Buf;
use {Transport, StreamSocket};
/// Transport is thing that provides buffered I/O for stream sockets
impl<'a, S: StreamSocket> Transport<'a, S> {
/// Get the reference to the underlying stream
///
/// It's here so you can inspect socket state or tune it. For example you
/// might want ... | Add `buffers()` method to `Transport` | Add `buffers()` method to `Transport`
| Rust | mit | tailhook/rotor-stream |
4b5a4222bb58f2345c251dd068e16851da5c4e24 | fuzz/fuzzers/parse.rs | fuzz/fuzzers/parse.rs | #![no_main]
#[macro_use] extern crate libfuzzer_sys;
extern crate url;
use std::str;
fuzz_target!(|data: &[u8]| {
if let Ok(utf8) = str::from_utf8(data) {
let _ = url::Url::parse(utf8);
}
});
| #![no_main]
#[macro_use] extern crate libfuzzer_sys;
extern crate url;
use std::str;
fuzz_target!(|data: &[u8]| {
if let Ok(utf8) = str::from_utf8(data) {
if let Ok(parsed) = url::Url::parse(utf8) {
let as_str = parsed.as_str();
assert_eq!(parsed, url::Url::parse(as_str).unwrap());
... | Extend fuzz target to also do serialization. | Extend fuzz target to also do serialization.
| Rust | apache-2.0 | servo/rust-url,servo/rust-url |
df1c2b8b59d989e17a89bd160a1fcfae54e8d9a3 | src/main.rs | src/main.rs | extern crate core;
extern crate iron;
extern crate mount;
extern crate rustc_serialize;
extern crate staticfile;
extern crate toml;
extern crate url;
use std::path::Path;
use std::sync::Arc;
use std::sync::Mutex;
use iron::prelude::*;
use mount::Mount;
use staticfile::Static;
mod api;
mod collection;
mod error;
mod ... | extern crate core;
extern crate iron;
extern crate mount;
extern crate rustc_serialize;
extern crate staticfile;
extern crate toml;
extern crate url;
use std::path::Path;
use std::sync::Arc;
use std::sync::Mutex;
use iron::prelude::*;
use mount::Mount;
use staticfile::Static;
mod api;
mod collection;
mod error;
mod ... | Revert "Only list music files in browse/flatten" | Revert "Only list music files in browse/flatten"
This reverts commit 172c2bb2fc73f13e67e67840294a0133adeb54e8.
| Rust | mit | agersant/polaris,agersant/polaris,jxs/polaris,agersant/polaris,jxs/polaris |
84571a1f4bc547e45501a5b4aa73dcadde25b980 | src/vm.rs | src/vm.rs | type Cell = u8;
pub struct VM {
cells: [Cell; 30_000],
data_pointer: usize,
}
impl VM {
pub fn new() -> VM {
VM { cells: [0; 30_000], data_pointer: 0 }
}
pub fn output(&self) -> Cell {
self.cells[self.data_pointer]
}
pub fn increment(&mut self) {
let value = se... | type Cell = u8;
pub struct VM {
cells: [Cell; 30_000],
data_pointer: usize,
}
impl VM {
pub fn new() -> VM {
VM { cells: [0; 30_000], data_pointer: 0 }
}
pub fn output(&self) -> Cell {
self.cells[self.data_pointer]
}
pub fn increment(&mut self) {
self.cells[sel... | Simplify definition of increment function | Simplify definition of increment function
| Rust | mit | nafarlee/thoughtfuck |
0298621c29df687710997c076ccda167b69d40f7 | src/jira_client.rs | src/jira_client.rs | extern crate serde;
extern crate serde_json;
use hyper::Client;
use hyper::client::{Body, Response};
use hyper::header::Headers;
use hyper::status::StatusCode;
use jira_request::*;
use std::io::Read;
pub fn send<R: JIRARequest, T: serde::de::Deserialize>(request: R) -> Result<T, String> {
let client = Client::new... | extern crate serde;
extern crate serde_json;
use hyper::Client;
use hyper::client::{Body, Response};
use hyper::header::Headers;
use hyper::status::StatusCode;
use jira_request::*;
use std::io::Read;
pub fn send<R: JIRARequest, T: serde::de::Deserialize>(request: R) -> Result<Vec<T>, String> {
let client = Client... | Change to return the array of struct | :art: Change to return the array of struct
| Rust | mit | dorayakikun/alfred_jira_workflow |
8274a5f3e826b2bef69b64b6c56e8897cff30e55 | src/binary_digits.rs | src/binary_digits.rs | // Implements http://rosettacode.org/wiki/Binary_digits
use std::vec::Vec;
use std::string::String;
#[cfg(not(test))]
fn main() {
let bins=binaries(16u);
for s in bins.iter() {
println!("{}", s);
}
}
fn binaries(n:uint) -> Vec<String> {
let mut bins = Vec::<String>::with_capacity(n);
for i... | // Implements http://rosettacode.org/wiki/Binary_digits
use std::vec::Vec;
use std::string::String;
#[cfg(not(test))]
fn main() {
let bins=binaries(16u);
for s in bins.iter() {
println!("{}", s);
}
}
fn binaries(n:uint) -> Vec<String> {
range(0, n).map(|i| format!("{:t}", i)).collect()
}
#[te... | Make Binary Digits' solution more functional. | Make Binary Digits' solution more functional.
| Rust | unlicense | magum/rust-rosetta,pfalabella/rust-rosetta,crr0004/rust-rosetta,crespyl/rust-rosetta,magum/rust-rosetta,sakeven/rust-rosetta,ghotiphud/rust-rosetta,ZoomRmc/rust-rosetta,JIghtuse/rust-rosetta,Hoverbear/rust-rosetta |
20bb52511b94a759e80ebe26c72f08cf0e7e175f | src/codec/codec013.rs | src/codec/codec013.rs | //! Codec for chunk type 13 = FLI_BLACK.
use ::RasterMut;
/// Magic for a FLI_BLACK chunk - No Data.
///
/// This chunk has no data following the header. All pixels in the
/// frame are set to color index 0.
pub const FLI_BLACK: u16 = 13;
/// Decode a FLI_BLACK chunk.
pub fn decode_fli_black(dst: &mut RasterMut) {
... | //! Codec for chunk type 13 = FLI_BLACK.
use ::{Raster,RasterMut};
/// Magic for a FLI_BLACK chunk - No Data.
///
/// This chunk has no data following the header. All pixels in the
/// frame are set to color index 0.
pub const FLI_BLACK: u16 = 13;
/// Decode a FLI_BLACK chunk.
pub fn decode_fli_black(dst: &mut Rast... | Add test for encoding FLI_BLACK. | Add test for encoding FLI_BLACK.
While it is generally not helpful to try encoding a frame as a
FLI_BLACK chunk mid-animation, it can be helpful in the very first
frame which lacks the delta compression options and must rewrite the
entire screen. Doing so also helps with postage stamp creation.
| Rust | mit | wangds/libflic,wangds/libflic |
90b23ac320e17bc71458d298d6472c80b661fe9e | puyocore/src/lib.rs | puyocore/src/lib.rs | #![feature(platform_intrinsics)]
#![feature(simd, simd_ffi, link_llvm_intrinsics)]
#![feature(cfg_target_feature)]
extern crate rand;
extern crate x86intrin;
pub mod color;
pub mod decision;
pub mod field;
mod field_bit;
#[cfg(target_feature = "avx2")]
mod field_bit_256;
pub mod field_checker;
pub mod frame;
pub mod ... | #![feature(platform_intrinsics)]
#![feature(simd, simd_ffi, link_llvm_intrinsics)]
#![feature(cfg_target_feature)]
extern crate rand;
extern crate x86intrin;
pub mod color;
pub mod decision;
pub mod field;
mod field_bit;
#[cfg(all(target_feature = "avx2", target_feature="bmi2"))]
mod field_bit_256;
pub mod field_chec... | Build rensa_tracker only with AVX2 | :green_heart: Build rensa_tracker only with AVX2
RensaTracker needs AVX2 and BMI2. Add #[cfg] so that it's not built
on non AVX2 or BMI2 machine.
| Rust | mit | mayah/rust-puyoai,mayah/rust-puyoai |
e3b780294bb28d5db04169d200bf96c8ef45e1fe | src/httpcommon/lib.rs | src/httpcommon/lib.rs | //! Common HTTP functionality for the Teepee project.
//!
//! Anything shared between both client and server belongs in here, but this crate is not expected
//! to be used directly.
//!
//! Any crate using types from this crate should re‐export them. For example, the ``status`` module
//! should be exported in the root... | //! Common HTTP functionality for the Teepee project.
//!
//! Anything shared between both client and server belongs in here, but this crate is not expected
//! to be used directly.
//!
//! Any crate using types from this crate should re‐export them. For example, the ``status`` module
//! should be exported in the root... | Fix an unstable warning in testing. | Fix an unstable warning in testing.
| Rust | apache-2.0 | teepee/teepee,teepee/teepee |
676eb6d67d75ec1d73a3fe895bbb5271c03c3fde | lazers-changes-stream/examples/simple_parsing.rs | lazers-changes-stream/examples/simple_parsing.rs | extern crate hyper;
extern crate serde;
extern crate serde_json as json;
extern crate syncdb_changes_stream;
use syncdb_changes_stream::changes_stream::ChangesStream;
use hyper::Client;
use hyper::header::Connection;
fn main() {
// Create a client.
let client = Client::new();
// Creating an outgoing req... | extern crate hyper;
extern crate serde;
extern crate serde_json as json;
extern crate lazers_changes_stream;
use lazers_changes_stream::changes_stream::ChangesStream;
use hyper::Client;
use hyper::header::Connection;
fn main() {
// Create a client.
let client = Client::new();
// Creating an outgoing req... | Remove last trace of syncdb | Remove last trace of syncdb
| Rust | mpl-2.0 | skade/lazers,skade/lazers,skade/lazers,skade/lazers |
3f89110d2805289ef83d17018ceded346f3239a9 | guess.rs | guess.rs | use std::rand::random;
fn main() {
let random_value = random::<u8>() % 10u8;
let mut guess = 0u8;
println!("{}", random_value);
}
| use std::io;
use std::rand::random;
fn guessed_correctly(guess: uint, machine: uint) -> bool {
if guess == machine {
return true;
}
return false;
}
fn main() {
let random_value = random::<uint>() % 10u;
let mut guess = 0u;
println!("{}", random_value);
println!("{}", guessed_correc... | Add function to check for equality | Add function to check for equality
| Rust | bsd-2-clause | ambidextrousTx/ToyRustPrograms |
5949d8b2d7b2bd01cfa454b029e7d921aedd7e27 | src/test/ui/lint/lint-group-nonstandard-style.rs | src/test/ui/lint/lint-group-nonstandard-style.rs | // Copyright 2014–2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... | // Copyright 2014–2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... | Fix internal references to bad_style in test code. | Fix internal references to bad_style in test code.
| Rust | apache-2.0 | GBGamer/rust,graydon/rust,graydon/rust,GBGamer/rust,aidancully/rust,graydon/rust,graydon/rust,GBGamer/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,graydon/rust,GBGamer/rust |
d4ccd00abc3024ff4a82a76ee04d7151e5f12bc0 | api_server/src/main.rs | api_server/src/main.rs | #![feature(proc_macro_hygiene, decl_macro)]
#[macro_use]
extern crate rocket;
#[macro_use]
extern crate rocket_contrib;
// #[macro_use]
extern crate diesel;
mod schema;
// mod models;
use rocket_contrib::databases::diesel::PgConnection;
#[get("/")]
fn index(_db_conn: RustyDbConn) -> &'static str {
// Rocket u... | #![feature(proc_macro_hygiene, decl_macro)]
#[macro_use]
extern crate rocket;
#[macro_use]
extern crate rocket_contrib;
// #[macro_use]
extern crate diesel;
mod schema;
// mod models;
use rocket::request::Request;
use rocket_contrib::databases::diesel::PgConnection;
#[get("/")]
fn index(_db_conn: RustyDbConn) -> ... | Add a sample error catcher to make it nicer if the database isn't working for some reason. | Add a sample error catcher to make it nicer if the database isn't working for some reason.
| Rust | mit | ghotiphud/rust-web-starter,ghotiphud/rust-web-starter,ghotiphud/rust-web-starter,ghotiphud/rust-web-starter |
b47e0d6d777161b8b066fc377d85b687b8b87128 | src/day20.rs | src/day20.rs | extern crate zmq;
use zmq::{Context, Message};
fn main() {
println!("24 days of Rust - zmq (day 20)");
let args = std::env::args().collect::<Vec<_>>();
if args.len() < 2 {
println!("Usage: {} (client|server)", args[0]);
return;
}
let mut ctx = Context::new();
let addr = "tcp://... | extern crate zmq;
use zmq::{Context, Message};
fn main() {
println!("24 days of Rust - zmq (day 20)");
let args = std::env::args().collect::<Vec<_>>();
if args.len() < 2 {
println!("Usage: {} (client|server)", args[0]);
return;
}
let mut ctx = Context::new();
let addr = "tcp://... | Send back the same payload as client sent. | Send back the same payload as client sent.
| Rust | mit | folkengine/24daysofrust,folkengine/24daysofrust,zsiciarz/24daysofrust,folkengine/24daysofrust,zsiciarz/24daysofrust,zsiciarz/24daysofrust |
ec670cd181fc26d0cf6a1966e9851d929493f8e9 | src/conn/futures/ping.rs | src/conn/futures/ping.rs | use Conn;
use conn::futures::read_packet::ReadPacket;
use conn::futures::write_packet::WritePacket;
use errors::*;
use lib_futures::Async;
use lib_futures::Async::Ready;
use lib_futures::Future;
use lib_futures::Poll;
use proto::Packet;
use proto::PacketType;
enum Step {
WritePacket(WritePacket),
ReadResponse... | use Conn;
use conn::futures::read_packet::ReadPacket;
use conn::futures::write_packet::WritePacket;
use errors::*;
use lib_futures::Async;
use lib_futures::Async::Ready;
use lib_futures::Future;
use lib_futures::Poll;
use proto::PacketType;
steps! {
Ping {
WritePacket(WritePacket),
ReadPacket(Read... | Use steps! for Ping future | Use steps! for Ping future
| Rust | apache-2.0 | blackbeam/mysql_async |
9f7a4a72eaa37c32105889b8cfd4786c4a6895f3 | examples/hello_world.rs | examples/hello_world.rs | #[macro_use]
extern crate rouille;
use std::io;
fn main() {
rouille::start_server("localhost:8000", move |request| {
let _entry = rouille::LogEntry::start(io::stdout(), request);
if let Ok(r) = rouille::match_assets(request, "examples") {
return r;
}
let response = ro... | #[macro_use]
extern crate rouille;
use std::io;
fn main() {
rouille::start_server("localhost:8000", move |request| {
let _entry = rouille::LogEntry::start(io::stdout(), request);
if let Ok(r) = rouille::match_assets(request, "examples") {
return r;
}
let response = ro... | Add a "/panic" route in the hello world example | Add a "/panic" route in the hello world example
| Rust | apache-2.0 | tomaka/rouille |
79ea5e8021919131981e0cfe2716b6253951aa92 | src/lib.rs | src/lib.rs | #![feature(plugin_registrar)]
extern crate rustc;
extern crate syntax;
use rustc::plugin::Registry;
use syntax::ast::TokenTree;
use syntax::codemap::Span;
use syntax::ext::base::{ExtCtxt, MacExpr, MacResult};
use syntax::ext::build::AstBuilder;
#[plugin_registrar]
pub fn plugin_registrar(reg: &mut Registry) {
reg... | #![feature(plugin_registrar, quote)]
extern crate rustc;
extern crate syntax;
use rustc::plugin::Registry;
use syntax::ast::TokenTree;
use syntax::codemap::Span;
use syntax::ext::base::{ExtCtxt, MacItems, MacResult};
#[plugin_registrar]
pub fn plugin_registrar(reg: &mut Registry) {
reg.register_macro("speculate",... | Return an empty `mod` from `speculate!` using quasi-quoting macros. | Return an empty `mod` from `speculate!` using quasi-quoting macros.
| Rust | apache-2.0 | cmr/speculate.rs |
8099e801d66b4c575dad662b0e8539c520f4a98a | rust-cargo/src/main.rs | rust-cargo/src/main.rs | extern crate sdl2;
extern crate native;
fn main() {
sdl2::init(sdl2::InitEverything);
let win = match sdl2::video::Window::new("Hello World!", sdl2::video::Positioned(100), sdl2::video::Positioned(100), 960, 540, sdl2::video::Shown) {
Ok(window) => window,
Err(err) => fail!(format!("SDL_Create... | extern crate sdl2;
extern crate native;
use sdl2::timer;
use sdl2::render::Renderer;
use sdl2::render;
use sdl2::surface::Surface;
use sdl2::video::Window;
use sdl2::video;
fn main() {
sdl2::init(sdl2::InitEverything);
let win = Window::new("Hello World!",
video::Positioned(100),
... | Reduce verbosity of the example code | Rust: Reduce verbosity of the example code
| Rust | mit | xyproto/hello_sdl2,xyproto/hello_sdl2,xyproto/hello_sdl2,xyproto/hello_sdl2,xyproto/hello_sdl2,xyproto/hello_sdl2,xyproto/hello_sdl2 |
c27caed736f77f43a2a5bc18fcc7bdfc4c19f654 | src/main.rs | src/main.rs | use std::io;
use std::io::prelude::*;
use std::fs::File;
use std::env;
mod parser;
use parser::lexer;
fn repl_loop() {
println!("the poli language\n");
loop {
print!(">>> ");
io::stdout().flush().unwrap();
let mut input_line = String::new();
match io::stdin().read_line(&mut... | use std::io;
use std::io::prelude::*;
use std::fs::File;
use std::env;
mod parser;
use parser::lexer;
fn repl_loop() {
println!("the poli language\n");
loop {
print!(">>> ");
io::stdout().flush().unwrap();
let mut input_line = String::new();
match io::stdin().read_line(&mut... | Implement toy lexing on file reader | Implement toy lexing on file reader
| Rust | mit | polilang/poli,polilang/poli,polilang/poli |
73a872b658f5fa810a1f20bb40aa519618f9d27f | examples/read_pcapng.rs | examples/read_pcapng.rs | #[macro_use]
extern crate nom;
extern crate pcapng;
use std::env;
use std::fs;
use std::io::Read;
use nom::IResult;
use pcapng::block::parse_blocks;
fn main() {
let args: Vec<_> = env::args().collect();
if args.len() != 2 {
println!("Usage: {} <foo.pcapng>", args[0]);
return;
}
// I c... | #[macro_use]
extern crate nom;
extern crate pcapng;
use std::env;
use std::fs;
use std::io::Read;
use nom::IResult;
use pcapng::block::parse_blocks;
fn main() {
let args: Vec<_> = env::args().collect();
if args.len() != 2 {
println!("Usage: {} <foo.pcapng>", args[0]);
return;
}
let mu... | Remove comments full of lies | Remove comments full of lies
| Rust | mit | richo/pcapng-rs |
6f01cffdef30ad4a8502f3f20ee69561d2e96f8d | src/model/enclosure.rs | src/model/enclosure.rs | use uuid::Uuid;
use error::Error;
use model::provider::Provider;
use super::{conn, Model};
pub trait Enclosure where Self: Model {
fn new(provider: Provider, identifier: String) -> Self;
fn find_by_entry_id(entry_id: Uuid) -> Vec<Self>;
fn find_by(provider: &Provider, identifier: &str) -> Result<Self, Erro... | use uuid::Uuid;
use error::Error;
use model::provider::Provider;
use super::{conn, Model};
pub trait Enclosure where Self: Model {
fn new(provider: Provider, identifier: String) -> Self;
fn set_owner_id(&mut self, owner_id: Option<String>) -> &mut Self;
fn set_url(&mut self, url: String) -> &mut Self;
... | Add set_owner_id, set_url, fetch_props methods to Enclosure trait | Add set_owner_id, set_url, fetch_props methods to Enclosure trait
| Rust | mit | kumabook/pink-spider,kumabook/pink-spider,kumabook/pink-spider,kumabook/pink-spider |
5e3c2640ec6dbd3abacd28fa2826cb94f23f4e8e | tests/target/structs.rs | tests/target/structs.rs |
/// A Doc comment
#[AnAttribute]
pub struct Foo {
#[rustfmt_skip]
f : SomeType, // Comment beside a field
f: SomeType, // Comment beside a field
// Comment on a field
#[AnAttribute]
g: SomeOtherType,
/// A doc comment on a field
h: AThirdType,
}
struct Bar;
// With a where clause an... |
/// A Doc comment
#[AnAttribute]
pub struct Foo {
#[rustfmt_skip]
f : SomeType, // Comment beside a field
f: SomeType, // Comment beside a field
// Comment on a field
#[AnAttribute]
g: SomeOtherType,
/// A doc comment on a field
h: AThirdType,
pub i: TypeForPublicField,
}
struct ... | Add idempotent regression test for pub struct fields | Add idempotent regression test for pub struct fields
| Rust | apache-2.0 | aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,SingingTree/rustfmt,studoot/rustfmt,rust-lang/rustfmt,rust-lang/rustfmt,graydon/rust,aidancully/rust,SingingTree/rustfmt,graydon/rust,graydon/rust,studoot/rustfmt,aidancully/rust,Emilgardis/rustfmt,flutterhash/rustfmt,aidancully/rust,Emilgardis/rustfmt,graydon/r... |
4d4cc120a92e36f80889605b44a3e6296da5ed1b | src/c_callable/mod.rs | src/c_callable/mod.rs | extern crate libc;
pub mod anoncreds;
pub mod crypto;
pub mod sovrin;
pub mod wallet;
use self::libc::{c_char, c_uchar};
#[no_mangle]
pub extern fn init_client(host_and_port: *const c_char) -> i32 {
unimplemented!();
}
#[no_mangle]
pub extern fn release_client(client_id: i32) -> i32 {
unimplemented!();
}
#... | extern crate libc;
pub mod anoncreds;
pub mod crypto;
pub mod sovrin;
pub mod wallet;
use std::collections::HashMap;
use std::mem;
use std::sync::{Arc, Mutex, Once, ONCE_INIT};
use self::libc::{c_char, c_uchar};
use super::SovrinClient;
#[derive(Clone)]
pub struct SingletonClients {
inner: Arc<Mutex<(HashMap<i3... | Create simple storage for active clients in C API. | Create simple storage for active clients in C API.
| Rust | apache-2.0 | peacekeeper/indy-sdk,MRJCrunch/indy-sdk,MRJCrunch/indy-sdk,peacekeeper/indy-sdk,korsimoro/indy-sdk,peacekeeper/indy-sdk,srottem/indy-sdk,Artemkaaas/indy-sdk,evernym/sovrin-client-rust,srottem/indy-sdk,Artemkaaas/indy-sdk,evernym/sovrin-client-rust,korsimoro/indy-sdk,MRJCrunch/indy-sdk,peacekeeper/indy-sdk,Artemkaaas/in... |
38ba2c4941ede8d999a0208c50f1ad077ba259da | src/libcore/kinds.rs | src/libcore/kinds.rs | //! The kind traits
#[lang="const"]
pub trait Const {
// Empty.
}
#[lang="copy"]
pub trait Copy {
// Empty.
}
#[lang="send"]
pub trait Send {
// Empty.
}
#[lang="owned"]
pub trait Owned {
// Empty.
}
| /*!
The kind traits
Rust types can be classified in vairous useful ways according to
intrinsic properties of the type. These classifications, often called
'kinds', are represented as traits.
They cannot be implemented by user code, but are instead implemented
by the compiler automatically for the types to which they ... | Add docs about kind traits | core: Add docs about kind traits
| Rust | apache-2.0 | andars/rust,nwin/rust,rprichard/rust,pelmers/rust,mihneadb/rust,mvdnes/rust,pelmers/rust,retep998/rand,jroesch/rust,untitaker/rust,quornian/rust,zachwick/rust,aidancully/rust,barosl/rust,LeoTestard/rust,arthurprs/rand,graydon/rust,TheNeikos/rust,miniupnp/rust,robertg/rust,j16r/rust,servo/rust,cllns/rust,barosl/rust,zub... |
514e5c55e5b2ad79769ead45cdc2680c610ec71b | src/net/conn/defs.rs | src/net/conn/defs.rs | //! Definition of various types related to connexions
| //! Definition of various types related to connexions
/// Type of the ether_type
pub type EtherType = u16;
/// Type that represent a protocol id
pub type ProtocolIdType = u8;
/// Type that represent a port
pub type PortType = u16;
| Add definition of type EtherType, ProtocolIdType and PortType | net/conn: Add definition of type EtherType, ProtocolIdType and PortType
| Rust | mit | uni-rs/uni.rs |
801e8be6d3b504bb572082a06e700f843d728cd4 | 28_shared_state/src/main.rs | 28_shared_state/src/main.rs | use std::sync::Mutex;
fn main() {
let m = Mutex::new(5);
{
let mut num = m.lock().unwrap();
*num = 6;
}
println!("m = {:?}", m);
}
| use std::sync::{Mutex, Arc};
use std::thread;
fn main() {
let counter = Arc::new(Mutex::new(0));
let mut handles = vec![];
for _ in 1..10 {
let counter = counter.clone();
let handle = thread::spawn(move || {
let mut num = counter.lock().unwrap();
*num += 1;
... | Use mutex with multiple threads and Arc | Use mutex with multiple threads and Arc
| Rust | mit | pgrzesik/learning-rust |
f940b04de6524f94140f3630434f89034e0a6481 | tests/cargo/mod.rs | tests/cargo/mod.rs | use lazy_static::lazy_static;
use std::env;
use std::path::PathBuf;
lazy_static! {
pub static ref CARGO_TARGET_DIR: PathBuf = {
match env::var_os("CARGO_TARGET_DIR") {
Some(v) => v.into(),
None => "target".into(),
}
};
pub static ref TARGET_LIB: PathBuf = {
i... | use cargo_metadata::MetadataCommand;
use lazy_static::lazy_static;
use std::env;
use std::path::PathBuf;
lazy_static! {
pub static ref CARGO_TARGET_DIR: PathBuf = {
match env::var_os("CARGO_TARGET_DIR") {
Some(v) => v.into(),
None => MetadataCommand::new().exec().unwrap().target_dir... | Fix run-pass tests when CARGO_TARGET_DIR is not set | Fix run-pass tests when CARGO_TARGET_DIR is not set
| Rust | apache-2.0 | graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust |
ea5e8f7e54e4b38caac8d14b97008233dadc99e4 | src/lib.rs | src/lib.rs | extern crate i2cdev;
extern crate nix;
mod utils;
pub mod bme280;
pub use bme280::*;
| extern crate i2cdev;
extern crate nix;
mod bme280;
mod utils;
pub use bme280::*;
| Fix visibility of inner module. | Fix visibility of inner module.
| Rust | mit | chiro/bme280-rs |
7b375eb2e0cb28a55c97150a9d964967a6ba6618 | src/lib.rs | src/lib.rs |
pub fn puzzle(input: &str) -> usize {
0
}
#[cfg(test)]
mod test {
use super::*;
}
|
pub fn puzzle(input: &str) -> usize {
let initial_world_state = WorldState {
};
let mut queue = vec![initial_world_state];
while !queue.is_empty() {
let world = queue.remove(0);
}
panic!("Exhausted all possible moves without finding end condition!");
}
pub struct WorldState {
}
#... | Set up a BFS queue | Set up a BFS queue
| Rust | mit | carols10cents/adventofcode-rs |
59fa132dd23aa5f660d96dd81c3c47b8d4358d40 | src/lib.rs | src/lib.rs |
pub fn puzzle(input: &str) -> u32 {
let initial_world_state = WorldState {
steps: 0,
elevator_floor: 0,
};
let mut queue = vec![initial_world_state];
while !queue.is_empty() {
let world = queue.remove(0);
if world.in_end_state() {
return world.steps;
... |
pub fn puzzle(input: &str) -> u32 {
let initial_world_state = WorldState {
steps: 0,
elevator_floor: 0,
};
let mut queue = vec![initial_world_state];
while !queue.is_empty() {
let world = queue.remove(0);
if world.in_end_state() {
return world.steps;
... | Add a method skeleton for finding next moves and adding to queue | Add a method skeleton for finding next moves and adding to queue
| Rust | mit | carols10cents/adventofcode-rs |
f6ccf0372cb0d924567426432ab1d7aa1d87277e | src/bin/logname.rs | src/bin/logname.rs | extern crate libc;
use libc::funcs::posix88::unistd::getlogin;
use std::c_str::CString;
use std::os;
fn main() {
unsafe {
let login_c = getlogin() as *const libc::c_char;
let login = CString::new(login_c, false);
match login.as_str() {
Some(username) => println!("{}", userna... | extern crate libc;
use libc::funcs::posix88::unistd::getlogin;
use std::c_str::CString;
use std::os;
fn main() {
let login = unsafe {
CString::new(
getlogin() as *const libc::c_char,
false
)
};
match login.as_str() {
Some(username) => println!("{}", userna... | Move code outside of unsafe block | Move code outside of unsafe block
| Rust | apache-2.0 | gmjosack/coreutils.rs |
79e00b113c0987f726037fa28c04ce8e169057ac | examples/drilldown_builder.rs | examples/drilldown_builder.rs | extern crate ruroonga_command as ruroonga;
use ruroonga::selectable::drilldown::Drilldown;
use ruroonga::selectable::drilldown_builder::DrilldownBuilder;
use ruroonga::commandable::Commandable;
use ruroonga::queryable::Queryable;
use ruroonga::dsl::*;
fn simple_example() {
let select = select("Entries".to_string()... | extern crate ruroonga_command as ruroonga;
use ruroonga::selectable::drilldown::Drilldown;
use ruroonga::commandable::Commandable;
use ruroonga::queryable::Queryable;
use ruroonga::dsl::*;
fn simple_example() {
let select = select("Entries".to_string())
.filter("content @ \"fast\"".to_string());
... | Use std::ops::Add for select and drilldown | examples: Use std::ops::Add for select and drilldown
| Rust | mit | cosmo0920/ruroonga_command |
5bdf03f9e10302c7f34b14ac3b20a5aa2d84a8e2 | components/butterfly/src/protocol/swim.rs | components/butterfly/src/protocol/swim.rs | // Copyright (c) 2018 Chef Software Inc. and/or applicable contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless r... | // Copyright (c) 2018 Chef Software Inc. and/or applicable contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless r... | Establish baseline tests for `Ord` and `PartialOrd` for `Health` | Establish baseline tests for `Ord` and `PartialOrd` for `Health`
Membership health exists on a continuum of
Alive -> Suspect -> Confirmed -> Departed
It turns out that the latest version of `prost` automatically derives
`Ord` and `PartialOrd` for Enums (thanks, `prost`!), so this commit
merely introduces tests t... | Rust | apache-2.0 | habitat-sh/habitat,habitat-sh/habitat,habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat,habitat-sh/habitat,rsertelon/habitat,habitat-sh/habitat,rsertelon/habitat,rsertelon/habitat,rsertelon/habitat,habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat,rsertelon/habitat |
05e68b98a7d38efb95cca834e95ae35387bba730 | static/js/entity.js | static/js/entity.js | (function () {
var $specContainer = $('#spec-container');
if (!isMobile) {
$('.section-tabs a').click(function () {
var href = $(this).attr('href');
gotoTab(href);
return false;
});
$specContainer.scrollspy({
'data-spy': 'scroll',
'data-target': '.section-t... | (function () {
var $body = $('body');
if (!isMobile) {
$('.section-tabs a').click(function () {
var href = $(this).attr('href');
gotoTab(href);
return false;
});
$body.scrollspy({
'data-spy': 'scroll',
'data-target': '.section-tabs',
'offset': 1... | Fix scrollspy bug occured by layout changes | Fix scrollspy bug occured by layout changes
| JavaScript | apache-2.0 | teampopong/pokr.kr,teampopong/pokr.kr,teampopong/pokr.kr,teampopong/pokr.kr |
e9c17be9481632fd5f82b35c0a5782761c051122 | week-9/dom-manipulation/home_page.js | week-9/dom-manipulation/home_page.js | // DOM Manipulation Challenge
// I worked on this challenge by myself, with: Peter Leong.
// Add your JavaScript calls to this page:
// Release 0:
// Add the class "done" to the #release-0 div.
document.getElementById("release-0").className = "done";
// Release 1:
// Set the display property of the #release-1 di... | // DOM Manipulation Challenge
// I worked on this challenge with Peter Leong.
// Add your JavaScript calls to this page:
// Release 0:
// Add the class "done" to the #release-0 div.
document.getElementById("release-0").className = "done";
// Release 1:
// Set the display property of the #release-1 div to none.
d... | Fix text for partner, add questions for reflection | Fix text for partner, add questions for reflection
| JavaScript | mit | TimBek2/phase-0,TimBek2/phase-0,TimBek2/phase-0 |
e98716b1f18ffc2b2b8a6b06e401bda45f41794b | packages/motion/template/main.js | packages/motion/template/main.js | /* @flow */
import React from 'react'
class Main extends React.Component {
render() {
return <div>Hello World</div>
}
}
export default Main
| /* @flow */
import Motion from 'react'
class Main extends Motion.Component {
render() {
return <div>Hello World</div>
}
}
export default Main
| Fix a typo in template We need the name to be motion so Motion.createElement is available for JSX | :bug: Fix a typo in template
We need the name to be motion so Motion.createElement is available for JSX
| JavaScript | mpl-2.0 | motion/motion,flintjs/flint,flintjs/flint,motion/motion,flintjs/flint |
9679dea6460a85f815a966cfd6611f4c89dcc711 | lib/DownloadFile.js | lib/DownloadFile.js | import ChunkedBlob from './ChunkedBlob'
export default class DownloadFile {
constructor(name, size, type) {
this.name = name
this.size = size
this.type = type
this.chunks = new ChunkedBlob()
}
addChunk(b) {
this.chunks.add(b)
}
clearChunks() {
this.chunks = new ChunkedBlob()
}
... | import ChunkedBlob from './ChunkedBlob'
export default class DownloadFile {
constructor(name, size, type) {
this.name = name
this.size = size
this.type = type
this.chunks = new ChunkedBlob()
}
addChunk(b) {
this.chunks.add(b)
}
clearChunks() {
this.chunks = new ChunkedBlob()
}
... | Make downloads work in FF. | Make downloads work in FF.
| JavaScript | bsd-3-clause | hanford/filepizza,jekrb/filepizza,codebhendi/filepizza,Ribeiro/filepizza,bradparks/filepizza_javascript_send_files_webrtc,pquochoang/filepizza,gramakri/filepizza,codevlabs/filepizza |
0a4f016fb6c8215c72a2496f4318bdda08005d98 | index.js | index.js | var mysql = require('mysql')
var createTransaction = require('any-db-transaction').createFromArgs
exports.name = 'mysql'
exports.createQuery = mysql.createQuery
exports.createTransaction = createTransaction.bind(null, mysql.createQuery)
exports.createConnection = function createConnection(opts, callback) {
var c... | var mysql = require('mysql')
var Transaction = require('any-db-transaction')
exports.name = 'mysql'
exports.createQuery = mysql.createQuery
exports.createTransaction = Transaction.begin.bind(null, mysql.createQuery)
exports.createConnection = function createConnection(opts, callback) {
var conn = mysql.createConn... | Rename of function from transaction module | Rename of function from transaction module
| JavaScript | mit | grncdr/node-any-db |
c0dfb97b729bbc52806f7105c88e88fbe1110046 | index.js | index.js | #!/usr/bin/env node
var opener = require("opener");
var url = "http://bit.ly/cascadiafest";
console.log("Opening " + url);
opener(url);
| #!/usr/bin/env node
var opener = require("open");
var url = "http://cascadiajs.com/";
console.log("Opening " + url);
opener(url);
| Update url to plain old cascadiajs.com | Update url to plain old cascadiajs.com
| JavaScript | mit | itsananderson/cascadiafest |
f01144f381f7e91c5d25d3dbbdf06d23fcd1ae5a | index.js | index.js | /* jshint node: true */
'use strict';
module.exports = {
name: 'ember-g-map',
included: function(app, parentAddon) {
var target = (parentAddon || app);
target.import('vendor/addons.css');
},
contentFor: function(type, config) {
var content = '';
if (type === 'head') {
var src = '//maps... | /* jshint node: true */
'use strict';
module.exports = {
name: 'ember-g-map',
included: function(app, parentAddon) {
var target = (parentAddon || app);
target.import('vendor/addons.css');
},
contentFor: function(type, config) {
var content = '';
if (type === 'head') {
var src = '//maps... | Remove version when client is used | Remove version when client is used
Upon further reading of the Google Maps docs when using a client ID and not specifying a version it will by default supply the Release version. Since its not necessary to provide a version number I removed that bit of code. | JavaScript | mit | asennikov/ember-g-map,asennikov/ember-g-map |
1ca925b8586c3c0ace513c5fddc1363cf7d5eb4b | index.js | index.js | var katex = require("katex");
module.exports = {
book: {
assets: "./static",
js: [],
css: [
"katex.min.css"
]
},
ebook: {
assets: "./static",
css: [
"katex.min.css"
]
},
blocks: {
math: {
shortcuts: ... | var katex = require("katex");
module.exports = {
book: {
assets: "./static",
js: [],
css: [
"katex.min.css"
]
},
ebook: {
assets: "./static",
css: [
"katex.min.css"
]
},
blocks: {
math: {
shortcuts: ... | Fix display mode for block formulas | Fix display mode for block formulas
| JavaScript | apache-2.0 | GitbookIO/plugin-katex |
dadc1d864aec08d1fbea053a6183d70fb34322bb | index.js | index.js | var url = require("url"),
crypto = require("crypto");
var signGMapsURL = function(urlToSign, webSafeKey) {
var b64Key = fromWebSafeBase64(webSafeKey);
var path = url.parse(urlToSign).path;
var hmac = crypto.createHmac("sha1", new Buffer(b64Key, "base64"));
hmac.update(path);
return urlToSign + "&signature=... | var url = require("url"),
crypto = require("crypto");
var signGMapsURL = function(urlToSign, webSafeKey) {
var b64Key = fromWebSafeBase64(webSafeKey);
var path = url.parse(urlToSign).path;
var hmac = crypto.createHmac("sha1", new Buffer(b64Key, "base64"));
hmac.update(path);
return urlToSign + "&signature=... | Replace all the occurences of web-unsafe and web-safe characters in base64 functions | Replace all the occurences of web-unsafe and web-safe characters in base64 functions
| JavaScript | mit | fleetlog/gmaps-signer |
32d351481e9fb8877eaafb9b81ea21a4f44bf316 | index.js | index.js | /* eslint-env node */
'use strict';
var { requireUp } = require('./requireUp');
var { DEFAULT_EXTENSIONS } = require('./constants');
var rules = requireUp('eslint-local-rules', DEFAULT_EXTENSIONS, __dirname);
if (!rules) {
throw new Error(
'eslint-plugin-local-rules: ' +
'Cannot find "eslint-local-rules{... | /* eslint-env node */
'use strict';
var { requireUp } = require('./requireUp');
var { DEFAULT_EXTENSIONS } = require('./constants');
var rules = requireUp('eslint-local-rules', DEFAULT_EXTENSIONS, __dirname);
if (!rules) {
throw new Error(
'eslint-plugin-local-rules: ' +
'Cannot find "eslint-local-rules{... | Fix "undefined var exts when eslint-local-rules.js not found" | Fix "undefined var exts when eslint-local-rules.js not found"
Fixes #14 | JavaScript | mit | cletusw/eslint-plugin-local-rules |
b51d99f0304505e1835c9acd738c62670000a1f5 | index.js | index.js | 'use strict';
var reshape = require('reshape')
exports.name = 'reshape';
exports.inputFormats = ['reshape', 'html'];
exports.outputFormat = 'html';
exports.renderAsync = function (str, options) {
return new Promise(function (resolve, reject) {
var plugins = []
if (Array.isArray(options.plugins)) {
... | 'use strict';
var reshape = require('reshape')
exports.name = 'reshape';
exports.inputFormats = ['reshape', 'html'];
exports.outputFormat = 'html';
exports.renderAsync = function (str, options) {
return new Promise(function (resolve, reject) {
var plugins = []
if (Array.isArray(options.plugins)) {
... | Update for loop to be old-js compatible | Update for loop to be old-js compatible
| JavaScript | mit | jstransformers/jstransformer-reshape,jstransformers/jstransformer-reshape |
95dd519d8b7aa4c36394d6f1bbd76edd6b7c6870 | index.js | index.js | var es = require('event-stream');
var rs = require('replacestream');
var stream = require('stream');
module.exports = function(search, replacement) {
var doReplace = function(file, callback) {
var isRegExp = search instanceof RegExp;
var isStream = file.contents instanceof stream.Readable;
var isBuffer =... | var es = require('event-stream');
var rs = require('replacestream');
var stream = require('stream');
module.exports = function(search, replacement) {
var doReplace = function(file, callback) {
var isRegExp = search instanceof RegExp;
var isStream = file.contents && typeof file.contents.on === 'function' && t... | Use ducktyping to detect streams, return early instead of else | Use ducktyping to detect streams, return early instead of else
| JavaScript | mit | thoughtpalette/gulp-replace,se-panfilov/gulp-find,zensh/gulp-replace,tpgmartin/gulp-replace,tpgmartin/gulp-replace,qLearning/gulp-replace,lazd/gulp-replace,lazd/gulp-replace,zensh/gulp-replace,qLearning/gulp-replace,sahat/gulp-replace,se-panfilov/gulp-find,kennethlynne/gulp-replace-path,tokimari/gulp-replace,thoughtpal... |
095940d534409523833f347f0b852aa98a157938 | test/mock-server.js | test/mock-server.js | // assert(typeof callback === 'function');
// var duplex = !(method === 'GET' || method === 'DELETE' || method === 'HEAD');
// if (duplex) {
// return {
// end: function (body) {
// gotResponse(getResponse(method, url, options.headers, body, {isClient: false}));
// }
// };
// } else ... | const assert = require('assert');
const http = require('http');
const concat = require('concat-stream');
function createServer() {
return http.createServer((req, res) => {
const {method, url, headers} = req;
if (method === 'GET' && url === '/') {
res.statusCode = 200;
res.setHeader('FoO', 'bar');... | Remove commented code in test | Remove commented code in test
| JavaScript | mit | then/then-request,then/then-request |
37b050b2077e5bc8e3cf869086c1fd035a74c176 | test/simple-test.js | test/simple-test.js | 'use strict'
var assert = require('assert')
var dependenciesToArray = require('../')
assert.deepEqual(dependenciesToArray({
dependencies: {
foo: '^1.0.0'
}
}), [
{ package: 'foo', version: '^1.0.0', type: 'dependency', bundled: false }
])
| 'use strict'
var assert = require('assert')
var dependenciesToArray = require('../')
assert.deepEqual(dependenciesToArray({
dependencies: {
foo: '^1.0.0'
}
}), [
{ package: 'foo', version: '^1.0.0', type: 'dependency', bundled: false }
])
assert.deepEqual(dependenciesToArray({
bundledDependencies: ['foo'... | Test with a broken bundled dependency | Test with a broken bundled dependency
| JavaScript | mit | mmalecki/package-json-dependencies-to-array |
6ee6949f11ce9f342d3d4d388161f514b491d04d | test/test_helper.js | test/test_helper.js | /* eslint no-console:0 */
// mocha/jsdom setup from:
// http://reactjsnews.com/testing-in-react/
import jsdom from 'jsdom';
import chai from 'chai';
import chaiEnzyme from 'chai-enzyme';
// https://github.com/producthunt/chai-enzyme
chai.use(chaiEnzyme());
// setup the simplest document possible
const doc = jsdom.j... | /* eslint no-console:0 */
// mocha/jsdom setup from:
// http://reactjsnews.com/testing-in-react/
import jsdom from 'jsdom';
import chai from 'chai';
import chaiEnzyme from 'chai-enzyme';
// https://github.com/producthunt/chai-enzyme
chai.use(chaiEnzyme());
// setup the simplest document possible
const doc = jsdom.j... | Replace syntax disallowed by eslint config | Replace syntax disallowed by eslint config
| JavaScript | mit | patientslikeme/react-select-test-utils |
932999494a4e543c3b7969375194bd1840a7f4b0 | root/tasks/connect.js | root/tasks/connect.js | /*
Sets up a connect server to work from the /build folder. May also set up a
livereload server at some point.
*/
module.exports = function(grunt) {
grunt.loadNpmTasks("grunt-contrib-connect");
grunt.config.merge({
connect: {
dev: {
options: {
livereload: true,
base: "./... | /*
Sets up a connect server to work from the /build folder. May also set up a
livereload server at some point.
*/
var fs = require("fs");
var path = require("path");
module.exports = function(grunt) {
grunt.loadNpmTasks("grunt-contrib-connect");
grunt.config.merge({
connect: {
dev: {
optio... | Add a filter for case sensitivity | Add a filter for case sensitivity
@audreycarlsen Let me know if you see this screw anything up for you. It
should be relatively stable, but you never know.
| JavaScript | mit | seattletimes/newsapp-template,seattletimes/newsapp-template |
6e0507262942ca499ef4623ec272bcd3250fe3b1 | examples/single-notification/index.js | examples/single-notification/index.js | import React, { Component } from 'react';
import { render } from 'react-dom';
import { Notification } from 'react-notification';
class Example extends Component {
constructor(props) {
super(props);
this.state = {
isActive: false
}
}
toggleNotification() {
this.setState({
isActive: !... | import React, { Component } from 'react';
import { render } from 'react-dom';
import { Notification } from 'react-notification';
class Example extends Component {
constructor(props) {
super(props);
this.state = {
isActive: false,
permanentNotification: false
}
}
toggleNotification() {
... | Include permanent notification in example | Include permanent notification in example
| JavaScript | mit | pburtchaell/react-notification |
8ba18c2526237cc2623dfb634aae8fde432de371 | server/http/errors.js | server/http/errors.js | // Easier, more readable way of retrieving an HTTP Error type for passing through Koa
// example: throw new httpErrors.Forbidden('No way, Jose'))
import http from 'http'
import util from 'util'
class HttpError extends Error {
constructor(statusCode, message, cause) {
super(message)
this.status = +(statusCo... | // Easier, more readable way of retrieving an HTTP Error type for passing through Koa
// example: throw new httpErrors.Forbidden('No way, Jose'))
import http from 'http'
import util from 'util'
class HttpError extends Error {
constructor(statusCode, message, cause) {
super(message)
this.status = +(statusCo... | Fix the creation of object to follow the ES6 spec. | Fix the creation of object to follow the ES6 spec.
| JavaScript | mit | ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery |
3fee8f672c26127aed99a970b3bd37321c9732fe | client/app/shared/navigation/navigation-directive.js | client/app/shared/navigation/navigation-directive.js | (function () {
'use strict';
module.exports = ['Config', '$location', function (Config, $location) {
function link(scope) {
// Set key to watch for active class
scope.item.active = false;
/**
* Check if passed href is a location of current page
* @param {String} href - href... | (function () {
'use strict';
module.exports = ['Config', '$location', function (Config, $location) {
function link(scope) {
// Set key to watch for active class
scope.item.active = false;
/**
* Check if passed href is a location of current page
* @param {String} href - href... | Remove scope isolated scope from navigation directive | Remove scope isolated scope from navigation directive
| JavaScript | mit | SidKH/angular-starter-kit,SidKH/angular-starter-kit |
4008ee7f58eb6ec8772baa5ff15237259bccab6b | client/components/ServerThumbnail.js | client/components/ServerThumbnail.js | import React from 'react';
import { Card, CardHeader, CardMedia, CardTitle } from 'material-ui/Card';
const ServerThumbnail = ({
server,
media
}) => (
<Card className="thumb">
<a href={server.url}>
<CardHeader title={server.name} subtitle={server.description} />
{media && (
<CardMedia
... | import React from 'react';
import { Card, CardHeader, CardMedia, CardTitle } from 'material-ui/Card';
const overlayContentStyle = {
background: 'rgba(0, 0, 0, 0.75)',
};
const ServerThumbnail = ({
server,
media
}) => (
<Card className="thumb">
<a href={server.url}>
<CardHeader title={server.name} su... | Improve background contrast for current song titles. | client: Improve background contrast for current song titles.
| JavaScript | mit | u-wave/hub |
4ea9de07a68344570146b84fcb1e2217a4c3e194 | client/reactComponents/Projectile.js | client/reactComponents/Projectile.js | import React from 'react';
const Projectile = (props) => {
return (
<a-mixin
id='projectile'
dynamic-body
geometry='primitive: sphere; radius: 0.25;'
// velocity='0 0 -10'
material='color: black;' />
)
}
module.exports = Projectile;
| import React from 'react';
const Projectile = (props) => {
return (
<a-mixin
id='projectile'
dynamic-body
geometry='primitive: sphere; radius: 0.25;'
explode
// velocity='0 0 -10'
material='color: black;' />
)
}
module.exports = Projectile;
| Add explode to projectile mixin | Add explode to projectile mixin
| JavaScript | mit | elliotaplant/tanks,ourvrisrealerthanyours/tanks,ourvrisrealerthanyours/tanks,elliotaplant/tanks |
bef15cade40c154fb954b1bdf4c3c6909f6d0f43 | cypress/locators/decimal/locators.js | cypress/locators/decimal/locators.js | // knobs locators
export const INPUT_PRECISION_SLIDER = 'input[name="precision"][type="range"]';
// component preview locators
export const LABEL_INPUT_PREVIEW = 'div[role="presentation"][type="text"]';
| // knobs locators
export const INPUT_PRECISION_SLIDER = 'input[name="precision"][type="range"]';
// component preview locators
export const LABEL_INPUT_PREVIEW = 'div[role="presentation"]';
| Fix locator for decimal input | FIX: Fix locator for decimal input
| JavaScript | apache-2.0 | Sage/carbon,Sage/carbon,Sage/carbon |
545f5866e574554112bd9093bc58479d86e99f7b | src/AnimatedNumber.js | src/AnimatedNumber.js | function identity (x) {
return x
}
module.exports = {
name: 'AnimatedNumber',
functional: true,
props: {
number: Number,
formatter: {
type: Function,
required: false,
default: function () {
return identity
}
}
},
data: function () {
return {
display: th... | function identity (x) {
return x
}
module.exports = {
name: 'AnimatedNumber',
props: {
number: Number,
formatter: {
type: Function,
required: false,
default: function () {
return identity
}
}
},
data: function () {
return {
display: this.number,
int... | Remove functional property from component | Remove functional property from component
| JavaScript | mit | kylestev/vue-animated-number |
7a70a8ff6e5e33d845766a113ccd3347d1234c83 | src/TinkerProperty.js | src/TinkerProperty.js | var inherits = require('util').inherits;
// var Property = require('gremlin-core/src/structure/Property');
// var GraphKey = require('gremlin-core/src/structure/Graph.Key');
function TinkerProperty(element, key, value) {
this.element = element;
this.key = key;
this.value = value;
this.graph = this.element.gra... | class TinkerProperty {
constructor(element, key, value) {
this.element = element;
this.key = key;
this.value = value;
this.graph = this.element.graph;
}
getElement() {
return this.element;
};
getKey() {
// return GraphKey.unHide(this.key);
};
getValue() {
return this.value;
... | Convert Property to ES6 class | Convert Property to ES6 class
| JavaScript | mit | jbmusso/tinkergraph-js |
577d5569807a7cbbb1ce23fbc226d4d02ca747c2 | src/browser/logger.js | src/browser/logger.js | import * as sqlectron from 'sqlectron-core';
import config from './config';
// Hack solution to ignore console.error from dtrace imported by bunyan
/* eslint no-console:0 */
const realConsoleError = console.error;
console.error = () => {};
const { createLogger } = require('bunyan');
console.error = realConsoleError;
... | import * as sqlectron from 'sqlectron-core';
import config from './config';
// Hack solution to ignore console.error from dtrace imported by bunyan
/* eslint no-console:0 */
const realConsoleError = console.error;
console.error = () => {};
const { createLogger } = require('bunyan');
console.error = realConsoleError;
... | Fix log to allow use console and file at same time | Fix log to allow use console and file at same time
| JavaScript | mit | sqlectron/sqlectron-gui,sqlectron/sqlectron-gui,sqlectron/sqlectron-gui,sqlectron/sqlectron-gui |
4b9ef484a9421dd51cfb0bc3ee3d7730e54eaecd | websocket/server.js | websocket/server.js | const WebSocket = require('ws');
const wss = new WebSocket.Server({
perMessageDeflate: false,
port: 8080
});
wss.on('connection', (ws) => {
// Receive message from client
ws.on('message', (message) => {
console.log('Received: %s', message);
});
// Send message to client
ws.send('The message from s... | const WebSocket = require('ws');
const wss = new WebSocket.Server({
perMessageDeflate: false,
port: 8080
});
wss.on('connection', (ws) => {
console.log('WebSocket connection has been established.')
// Receive message from client
ws.on('message', (message) => {
console.log('Received: %s', message);
});... | Add message output from console.log. | Add message output from console.log.
| JavaScript | mit | chiehwen/Node-Exercises,chiehwen/Node-Exercises |
6b0ba4ea073bc9854180a215e6fc889272ceb5f7 | app/assets/javascripts/models/mixer.js | app/assets/javascripts/models/mixer.js | Mixer = function () {
this.mix = []
}
//Adds a track to the mix. Example args = {url: sound.aws.com, divId: 1}
Mixer.prototype.addTrack = function (args) {
var newTrack = new Howl({
url : [args['url']]
});
this.mix[args['divId']] = newTrack
}
// var someMix = new Mixer
// someMix.addTrack({url: 'https://s3.ama... | Mixer = function () {
this.mix = []
}
//Adds a track to the mix. Takes args = {url: sound.aws.com, divId: 1}
Mixer.prototype.addTrack = function (args) {
var newTrack = new Howl({
url : [args['url']]
});
this.mix[args['divId']] = newTrack
}
Mixer.prototype.removeTrack = function (arrayPosition) {
this.mix[arr... | Add remove track to Mixer model | Add remove track to Mixer model
| JavaScript | mit | chi-bobolinks-2015/TheGoldenRecord,chi-bobolinks-2015/TheGoldenRecord,chi-bobolinks-2015/TheGoldenRecord |
101dad340ce32e1c535aad06251cc14a93d5f16e | app/assets/javascripts/water_events.js | app/assets/javascripts/water_events.js | // Place all the behaviors and hooks related to the matching controller here.
// All this logic will automatically be available in application.js.
$(document).on("ajax:success", "form", function(status, data, xhr){
if (data.plant_id === 0) {
$(`.message${data.plant_id}`).text("All your plants have been watered!"... | // Place all the behaviors and hooks related to the matching controller here.
// All this logic will automatically be available in application.js.
$(document).on("ajax:success", "form", function(status, data, xhr){
if (data.plant_id === 0) {
$('.message' + data.plant_id).text("All your plants have been watered!"... | Change template literal string to use string concatination. | Change template literal string to use string concatination.
When precompiling assets for production, the template literals cause a
crash. String concatination avoids this issue.
| JavaScript | mit | Plantia/app,Plantia/app,Plantia/app |
b41d36c41ce70b62e9b8ff2f349837a26b28b8b4 | src/App.js | src/App.js | import React, { Component } from 'react';
import uuid from 'uuid';
import './store/reducers';
import CARD_TEXTS from './store/values.json';
import ShufflingCardGrid from './components/ShufflingCardGrid';
const CARDS = CARD_TEXTS.map(text => ({
key: uuid.v4(),
text,
accepted: false,
rejected: false
}));
clas... | import React, { Component } from 'react';
import uuid from 'uuid';
import './store/reducers';
import CARD_TEXTS from './store/values.json';
import ShufflingCardGrid from './components/ShufflingCardGrid';
const CARDS = CARD_TEXTS.map(text => ({
key: uuid.v4(),
text,
accepted: false,
rejected: false
}));
clas... | Use correct props on ShufflingCardGrid | Use correct props on ShufflingCardGrid
| JavaScript | apache-2.0 | flubstep/engvalues,flubstep/engvalues,flubstep/engvalues |
269550ae100c18f9bfa94fe76b435034a3a7a959 | app/assets/javascripts/start-modules.js | app/assets/javascripts/start-modules.js | // = require govuk_publishing_components/modules
// = require modules/global-bar
// = require modules/sticky-element-container
// = require modules/toggle
// = require modules/track-click
// = require modules/cross-domain-tracking
$(document).ready(function () {
GOVUK.modules.start()
})
| // = require govuk_publishing_components/modules
// = require govuk_publishing_components/components/cookie-banner
// = require modules/global-bar
// = require modules/sticky-element-container
// = require modules/toggle
// = require modules/track-click
// = require modules/cross-domain-tracking
$(document).ready(func... | Call cookie banner component JS | Call cookie banner component JS
| JavaScript | mit | alphagov/static,alphagov/static,alphagov/static |
84708e506ea014b0089f0dc08b4bd31436d2ad73 | app/assets/javascripts/application.js | app/assets/javascripts/application.js | // This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative ... | // This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative ... | Change ordering of JS pipeline | Change ordering of JS pipeline
| JavaScript | mit | SputterPuttRedux/storyvine_clone,mxngyn/StoryVine,SputterPuttRedux/storyvine_clone,mxngyn/StoryVine,SputterPuttRedux/storyvine_clone,pearlshin/StoryVine,mxngyn/StoryVine,pearlshin/StoryVine,pearlshin/StoryVine |
a635ef2c5710b88eb30fb08ba6033f8df75c1440 | app/assets/javascripts/application.js | app/assets/javascripts/application.js | // This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative ... | // This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative ... | Fix select2 not targeting inputs on navigation | Fix select2 not targeting inputs on navigation
Turbolinks navigation messes with select2's default behavior.
We have to add a an explit call to `.select2` when Turbolinks
has finished rendering the new content.
| JavaScript | mit | tmiller/network,tmiller/network,tmiller/network |
1150741e18a9562b09d7bfb45618c1e689d23e35 | src/widgets/HeaderRight.js | src/widgets/HeaderRight.js | /**
* mSupply Mobile
* Sustainable Solutions (NZ) Ltd. 2020
*/
import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { selectUsingVaccines } from '../selectors/modules';
import { SyncState } from './SyncState';
import { FlexRow } from './FlexRow';
import { T... | /**
* mSupply Mobile
* Sustainable Solutions (NZ) Ltd. 2020
*/
import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { selectUsingVaccines } from '../selectors/modules';
import { SyncState } from './SyncState';
import { FlexRow } from './FlexRow';
import { T... | Add switch sync icons around | Add switch sync icons around
| JavaScript | mit | sussol/mobile,sussol/mobile,sussol/mobile,sussol/mobile |
d74db01a8d6d3618a78269e57750b20ea30f36da | Build/Grunt-Options/jshint.js | Build/Grunt-Options/jshint.js | /**
* Grunt-Contrib-JSHint
* @description Validate files with JSHint.
* @docs https://github.com/gruntjs/grunt-contrib-jshint
*/
var config = require('../Config');
module.exports = {
options: {
// Environments
browser: true,
jquery: true,
// Enforcing options
camelcase: true,
curly: true,
devel: t... | /**
* Grunt-Contrib-JSHint
* @description Validate files with JSHint.
* @docs https://github.com/gruntjs/grunt-contrib-jshint
*/
var config = require('../Config');
module.exports = {
options: {
// Environments
browser: true,
jquery: true,
// Enforcing options
camelcase: true,
curly: true,
devel: t... | Validate all JS files in the 'Build/' subdir with JSHint | [TASK] Validate all JS files in the 'Build/' subdir with JSHint
| JavaScript | mit | t3b/t3b_template,t3b/t3b_template,t3b/t3b_template,t3b/t3b_template,t3b/t3b_template |
fd916a9107794d4242e590cfa357fc988d94b188 | assets/javascripts/create_wiki_page.js | assets/javascripts/create_wiki_page.js | $(document).ready(function($) {
$("#content .contextual").prepend("<a href=\"#\">New</a>");
});
| $(document).ready(function($) {
var newLink = $("<a href=\"#\">New</a>");
$("#content .contextual").prepend(newLink);
$(newLink).click(function() {
var parent = $(this).parent();
var form = $("<form></form>");
form.append("<input type=\"text\">");
$(form).submit(function(e) {... | Add some fugly javascript to pre-fill parent wiki page. | Add some fugly javascript to pre-fill parent wiki page.
| JavaScript | bsd-2-clause | peplin/redmine_create_wiki_page,peplin/redmine_create_wiki_page |
2ba7ff9f932b710b7a141c1dae4aa522115d2ca7 | frappe/public/js/frappe/translate.js | frappe/public/js/frappe/translate.js | // Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// MIT License. See license.txt
// for translation
frappe._messages = {};
frappe._ = function(txt, replace, context = null) {
if ($.isEmptyObject(frappe._messages)) {
$.extend(frappe._messages, frappe.boot.__messages);
}
if (!txt) return txt;
... | // Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// MIT License. See license.txt
// for translation
frappe._messages = {};
frappe._ = function(txt, replace, context = null) {
if ($.isEmptyObject(frappe._messages) && frappe.boot) {
$.extend(frappe._messages, frappe.boot.__messages);
}
if (!txt... | Check if boot obj exists | fix: Check if boot obj exists
| JavaScript | mit | saurabh6790/frappe,saurabh6790/frappe,almeidapaulopt/frappe,adityahase/frappe,yashodhank/frappe,yashodhank/frappe,StrellaGroup/frappe,StrellaGroup/frappe,frappe/frappe,frappe/frappe,saurabh6790/frappe,mhbu50/frappe,yashodhank/frappe,almeidapaulopt/frappe,adityahase/frappe,yashodhank/frappe,mhbu50/frappe,frappe/frappe,m... |
15469f1e3f4467dfd1ae234e17f0d337e8dd9eee | lib/models/PayInTemplateURLOptions.js | lib/models/PayInTemplateURLOptions.js | var EntityBase = require('./EntityBase');
var PayInTemplateURLOptions = EntityBase.extend({
defaults: {
PAYLINE: null
}
});
module.exports = PayInTemplateURLOptions; | var EntityBase = require('./EntityBase');
var PayInTemplateURLOptions = EntityBase.extend({
defaults: {
PAYLINE: null,
PAYLINEV2: null
}
});
module.exports = PayInTemplateURLOptions;
| Add PAYLINEV2 parameter on TemplateURLOptions | Add PAYLINEV2 parameter on TemplateURLOptions | JavaScript | mit | Mangopay/mangopay2-nodejs-sdk,Mangopay/mangopay2-nodejs-sdk |
9964565a9fadfab2a27cceeedc8a41199f764d08 | src/pat/gallery.js | src/pat/gallery.js | /**
* Patterns gallery - A simple gallery
*
* Copyright 2013 Simplon B.V. - Wichert Akkerman
*/
define([
"jquery",
"../registry",
"photoswipe"
], function($, patterns) {
var gallery = {
name: "gallery",
trigger: ".pat-gallery",
init: function($el) {
return $el;
... | /**
* Patterns gallery - A simple gallery
*
* Copyright 2013 Simplon B.V. - Wichert Akkerman
*/
define([
"jquery",
"../registry",
"klass", // Workaround because bungle is ignoring dependencies currently
"photoswipe"
], function($, patterns) {
var gallery = {
name: "gallery",
trig... | Work around bungle bug (it ignores dependencies). | Work around bungle bug (it ignores dependencies).
| JavaScript | bsd-3-clause | janga1997/Patterns,janga1997/Patterns,garbas/Patterns,garbas/Patterns,janga1997/Patterns,garbas/Patterns |
802bcc739c5483473eca91d4a478168779e1fa29 | client.src/shared/entities/gistbook.js | client.src/shared/entities/gistbook.js | //
// Gistbook
// A model representing a new Gistbook
//
import { BaseModel, BaseCollection } from 'base/entities';
export default BaseModel.extend({
initialize() {
this._dirty = false;
this.on('change', this._markDirty, this);
this.listenTo(this.get('pages'), 'change', this._markDirty);
},
// Crea... | //
// Gistbook
// A model representing a new Gistbook
//
import * as _ from 'underscore';
import { BaseModel, BaseCollection } from 'base/entities';
export default BaseModel.extend({
initialize() {
this._dirty = false;
this.on('change', this._markDirty, this);
this.listenTo(this.get('pages'), 'change', ... | Fix bug where homepage only displayed once. | Fix bug where homepage only displayed once.
Resolves #383
| JavaScript | mit | jmeas/gistbook,joshbedo/gistbook |
47790ccd945cef6e444a7c751b8f0548caed6cab | kiwi/app/assets/javascripts/answers.js | kiwi/app/assets/javascripts/answers.js | $(document).on("ready", function(){
$('#answers-form form').on('submit', function(event){
event.preventDefault();
var valuesToSubmit = $(this).serialize();
$.ajax({
url: $('#answers-form form').attr("action"),
type: "POST",
data: valuesToSubmit,
}).done(function(response) {
co... | $(document).on("ready", function(){
$('#answers-form form').on('submit', function(event){
event.preventDefault();
var valuesToSubmit = $(this).serialize();
$.ajax({
url: $('#answers-form form').attr("action"),
type: "POST",
data: valuesToSubmit,
}).done(function(response) {
$(... | Add JS to clear text area after submit answer post form | Add JS to clear text area after submit answer post form | JavaScript | mit | nyc-island-foxes-2016/kiwi-overflow,nyc-island-foxes-2016/kiwi-overflow,nyc-island-foxes-2016/kiwi-overflow |
e7ae9878b1b6fdbb5ba12a1d4ae04d9a15673bae | lib/core/outgoing_payment_processor.js | lib/core/outgoing_payment_processor.js | var depositCallbackJob = require(__dirname+'/../jobs/deposit_completion_callback.js');
var OutgoingPayment = require(__dirname+'/outgoing_payment.js');
var gateway = require(__dirname+'/../../');
var RippleRestClient = require('ripple-rest-client');
function OutgoingPaymentProcessor(payment) {
this.outgoingPayment =... | var depositCallbackJob = require(__dirname+'/../jobs/deposit_completion_callback.js');
var OutgoingPayment = require(__dirname+'/outgoing_payment.js');
var gateway = require(__dirname+'/../../');
var RippleRestClient = require('ripple-rest-client');
function OutgoingPaymentProcessor(payment) {
this.outgoingPayment =... | Update OutgoingPaymentProcessor to use new method. | [TASK] Update OutgoingPaymentProcessor to use new method.
| JavaScript | isc | xdv/gatewayd,Parkjeahwan/awegeeks,zealord/gatewayd,whotooktwarden/gatewayd,Parkjeahwan/awegeeks,whotooktwarden/gatewayd,crazyquark/gatewayd,xdv/gatewayd,zealord/gatewayd,crazyquark/gatewayd |
0023448a52536995dd243664fa4f090085a21a71 | packages/heroku-cli-plugin-certs-v5/test/helpers.js | packages/heroku-cli-plugin-certs-v5/test/helpers.js | 'use strict'
/* globals cli */
global.cli = require('heroku-cli-util')
cli.raiseErrors = true
cli.color.enabled = false
let nock = require('nock')
nock.disableNetConnect()
| 'use strict'
/* globals cli */
global.cli = require('heroku-cli-util')
cli.raiseErrors = true
cli.color.enabled = false
process.stdout.columns = 80
process.stderr.columns = 80
let nock = require('nock')
nock.disableNetConnect()
| Set stdout / stderr with to 80 to fix tests | Set stdout / stderr with to 80 to fix tests
| JavaScript | isc | heroku/cli,heroku/heroku-cli,heroku/cli,heroku/heroku-cli,heroku/heroku-cli,heroku/cli,heroku/cli,heroku/heroku-cli |
dc3f507e32b83fd16d62b16ba5d031478422d1a9 | grunt/browserSync.js | grunt/browserSync.js | module.exports = {
bsFiles: {
src: [
'<%= globalConfig.public.public %>/**/*',
'!<%= globalConfig.public.public %>/patterns/**/*'
]
},
options: {
watchTask: true,
port: 8000,
ui: {
port: 8001
},
server: {
... | module.exports = {
bsFiles: {
src: [
'<%= globalConfig.public.public %>/**/*',
'!<%= globalConfig.public.public %>/patterns/**/*'
]
},
options: {
watchTask: true,
port: 8000,
ui: {
port: 8001
},
server: {
... | Disable Browsersync notifications and ghostMode | Disable Browsersync notifications and ghostMode
| JavaScript | mit | dennisfrank/patternlab-scaffolding,dennisfrank/patternlab-scaffolding |
ec84b1d40db0872b4aedab724274ce47297c8ae9 | public/angular-1.5.8/controllers/reviewInputCtrl.js | public/angular-1.5.8/controllers/reviewInputCtrl.js | /* global angular */
angular.module('ClassRat').controller('reviewInputCtrl', function($scope, $http, sharedReviewInputFormService, addReviewService) {
$scope.sharedObj = sharedReviewInputFormService;
$scope.newReview = {}; //newReview object that will hold the newly created review
$scope.newReview.username... | /* global angular */
angular.module('ClassRat').controller('reviewInputCtrl', function($scope, $http, sharedReviewInputFormService, addReviewService) {
$scope.sharedObj = sharedReviewInputFormService;
$scope.newReview = {}; //newReview object that will hold the newly created review
clearReviewForm();
$s... | Add newly-posted review to the reviews list without needing to refresh. | Add newly-posted review to the reviews list without needing to refresh.
| JavaScript | mpl-2.0 | jdthomas718/ClassRat,jdthomas718/ClassRat |
0f0fb6928ba790cc8aaae72d4cc17735c26990a7 | src/services/index.js | src/services/index.js | 'use strict';
// const userLessonTokens = require('./user-lesson-tokens');
// const lessons = require('./lessons');
const users = require('./users');
const mongoose = require('mongoose')
module.exports = function() {
const app = this;
mongoose.connect(app.get('mongodb'));
mongoose.Promise = global.Promise;
... | 'use strict';
const userLessonTokens = require('./user-lesson-tokens');
const lessons = require('./lessons');
const users = require('./users');
const mongoose = require('mongoose');
module.exports = function() {
const app = this;
mongoose.connect(app.get('mongodb'));
mongoose.Promise = global.Promise;
app... | Add lessons and other service | Add lessons and other service
| JavaScript | mit | tum-ase-33/rest-server |
7e49d52fb9501a1bdd85d6c9d35d09d50aabb569 | tests/html-writer.tests.js | tests/html-writer.tests.js | var assert = require("assert");
var test = require("./testing").test;
var htmlWriter = require("../lib/html-writer");
describe('html-writer', function() {
test('can generate simple paragraph', function() {
var writer = htmlWriter.writer();
writer.open("p");
writer.text("Hello");
w... | var assert = require("assert");
var test = require("./testing").test;
var htmlWriter = require("../lib/html-writer");
describe('html-writer', function() {
test('can generate simple paragraph', function() {
var writer = htmlWriter.writer();
writer.open("p");
writer.text("Hello");
w... | Add test for nested HTML | Add test for nested HTML
| JavaScript | bsd-2-clause | mwilliamson/mammoth.js,mwilliamson/mammoth.js |
c9c6dbd63694e7dfc8a7a59ef788585e18825005 | myuw/static/vue/vuex/store/common.js | myuw/static/vue/vuex/store/common.js | import dayjsCommon from 'dayjs';
dayjsCommon.extend(require('dayjs/plugin/advancedFormat'))
dayjsCommon.extend(require('dayjs/plugin/calendar'))
dayjsCommon.extend(require('dayjs/plugin/relativeTime'))
dayjsCommon.extend(require('dayjs/plugin/timezone'))
dayjsCommon.extend(require('dayjs/plugin/utc'))
dayjsCommon.exte... | import dayjsCommon from 'dayjs';
dayjsCommon.extend(require('dayjs/plugin/advancedFormat'))
dayjsCommon.extend(require('dayjs/plugin/calendar'))
dayjsCommon.extend(require('dayjs/plugin/relativeTime'))
dayjsCommon.extend(require('dayjs/plugin/timezone'))
dayjsCommon.extend(require('dayjs/plugin/utc'))
dayjsCommon.exte... | Support event timezone aware datetime | Support event timezone aware datetime
| JavaScript | apache-2.0 | uw-it-aca/myuw,uw-it-aca/myuw,uw-it-aca/myuw,uw-it-aca/myuw |
7bf3a5a4054a3e46920b40ab4d103da8482c60b8 | sw-precache-config.js | sw-precache-config.js | module.exports = {
navigateFallbackWhitelist: [/^\/nothing\//],
staticFileGlobs: [
'manifest.json',
'bower_components/webcomponentsjs/*.js',
'images/*'
],
importScripts: [
'push-handler.js'
],
runtimeCaching: [
{
urlPattern: /\/data\/images\/.*/,
handler: 'cacheFirst',
... | module.exports = {
staticFileGlobs: [
'manifest.json',
'images/*',
'src/**/*',
],
importScripts: [
'push-handler.js'
],
runtimeCaching: [
{
urlPattern: /\/@webcomponents\/webcomponentsjs\//,
handler: 'fastest'
},
{
urlPattern: /\/data\/images\/.*/,
handler: ... | Update serviceworker cache config for source files | Update serviceworker cache config for source files
| JavaScript | apache-2.0 | frocher/bnb_app,frocher/bnb_app |
69626db05ccad8660ffb6516af189c6d90545031 | javascript/StripePaymentDetailsForm.js | javascript/StripePaymentDetailsForm.js | Stripe.setPublishableKey('$PublishKey');
var payment_form_id = '#$FormName';
$(function() {
var payment_form = $(payment_form_id);
payment_form.bind(
"submit",
function(event) {
// Disable the submit button to prevent repeated clicks:
payment_form
.find(... | Stripe.setPublishableKey('$PublishKey');
jQuery.noConflict();
var payment_form_id = '#$FormName';
(function($) {
var payment_form = $(payment_form_id);
payment_form.bind(
"submit",
function(event) {
// Disable the submit button to prevent repeated clicks:
payment_form
... | Make use of jquery no conflict for stripe JS | Make use of jquery no conflict for stripe JS
| JavaScript | bsd-3-clause | i-lateral/silverstripe-stripe-forms,i-lateral/silverstripe-stripe-forms |
4632a726ac1f7fc4b2eaed5059a094eb606593cc | javascripts/service/car_ads_service.js | javascripts/service/car_ads_service.js | define(["underscore", "jquery"], function(_, $) {
return function (averageCartype) {
var public = {};
var private = {};
private.createObject = function (averageCartype) {
var queryObject = {
c: [],
sc: null,
p: null,
ecol: []
};
for (var carclass in ave... | define(["underscore", "jquery", "app"], function(_, $, app) {
return function (averageCartype) {
var public = {};
var private = {};
private.createObject = function (averageCartype) {
var queryObject = {
c: [],
ecol: [],
sc: null,
p: null,
ll: null
};
... | Add params for location based search | Add params for location based search
| JavaScript | mit | HPI-Hackathon/find-my-car,HPI-Hackathon/find-my-car |
3fe54ecfb35a2a0c0d691b7b07b06b30b398c544 | lib/Object/key-of.js | lib/Object/key-of.js | 'use strict';
var some = require('./some');
module.exports = function (obj, searchValue) {
var r;
return some(obj, function (value, name) {
if (value === searchValue) {
r = name;
return true;
}
return false;
}) ? r : null;
};
| 'use strict';
var ois = require('./is')
, some = require('./some');
module.exports = function (obj, searchValue) {
var r;
return some(obj, function (value, name) {
if (ois(value, searchValue)) {
r = name;
return true;
}
return false;
}) ? r : null;
};
| Use Object.is for comparision in Object.keyOf | Use Object.is for comparision in Object.keyOf
| JavaScript | isc | medikoo/es5-ext |
0b8463458f04a27ac8bf5338e4ef1eff39b5ff98 | front/src/app/main/main.controller.js | front/src/app/main/main.controller.js | (function () {
'use strict';
angular
.module('springbootangularhtml5')
.controller('MainController', MainController);
/** @ngInject */
function MainController() {
var vm = this;
}
})();
| (function () {
'use strict';
angular
.module('springbootangularhtml5')
.controller('MainController', MainController);
/** @ngInject */
function MainController($http, $log) {
var vm = this;
vm.callService = function () {
console.log('yep');
$http... | Add an example call to show URL handling | Add an example call to show URL handling
| JavaScript | mit | mpalourdio/SpringBootAngularHTML5,mpalourdio/SpringBootAngularHTML5,mpalourdio/SpringBootAngularHTML5,mpalourdio/SpringBootAngularHTML5 |
af90a935ae86507f86df4ff1b793a96ed231f606 | frontend/webpack.config-test.babel.js | frontend/webpack.config-test.babel.js | import nodeExternals from 'webpack-node-externals';
var path = require('path')
export default {
target: 'node',
externals: [nodeExternals()],
module: {
rules: [
//{ test: /\.jsx$/, loaders: ['react-hot', 'babel'], exclude: /node_modules/ },
{
test: /\.js$/,
exclu... | import webpack from 'webpack'
import nodeExternals from 'webpack-node-externals';
var path = require('path')
export default {
target: 'node',
externals: [nodeExternals()],
module: {
rules: [
//{ test: /\.jsx$/, loaders: ['react-hot', 'babel'], exclude: /node_modules/ },
{
te... | Define __DEV__ for frontend tests | Define __DEV__ for frontend tests
| JavaScript | apache-2.0 | serverboards/serverboards,serverboards/serverboards,serverboards/serverboards,serverboards/serverboards,serverboards/serverboards |
73ebfab82f8f9c2c51d6052df484ca278a2a0047 | config/environment.js | config/environment.js | /* jshint node: true */
module.exports = function(environment) {
var ENV = {
modulePrefix: 'jolli',
environment: environment,
baseURL: '/',
locationType: 'auto',
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
// e.g. 'with-contr... | /* jshint node: true */
module.exports = function(environment) {
var ENV = {
modulePrefix: 'jolli',
environment: environment,
baseURL: '/',
locationType: 'auto',
contentSecurityPolicy: {
'default-src': "'none'",
'script-src': "'self' 'unsafe-eval' 'unsafe-inline' use.typekit.net",
... | Update Content Security Policy (CSP) to reduce reporting errors in the console. | Update Content Security Policy (CSP) to reduce reporting errors in the console.
| JavaScript | isc | donlink1/jolliTestSideBar,smockle-archive/jolli,donlink1/jolliTest,donlink1/jolliTest,donlink1/jolliTestSideBar |
20f2090629d1a8d8fc98ddb5f085bfd770ea1846 | lib/phrases/index.js | lib/phrases/index.js | function fileToArray(file) {
return (
fs.readFileSync(__dirname + '/' +file)
.toString()
.trim()
.split('\n')
);
}
const sandwich = require('sandwich');
const fs = require('fs');
const ADVERBS = fileToArray('adverbs.txt');
const ADJECTIVES = fileToArray('adjectives.txt');
const NOUNS = fileTo... | const path = require('path');
const sandwich = require('sandwich');
const fs = require('fs');
function fileToArray(file) {
return (
fs.readFileSync(path.join(__dirname, '/', file))
.toString()
.trim()
.split('\n')
);
}
const ADVERBS = fileToArray('adverbs.txt');
const ADJECTIVES = fileToArra... | Use path.join instead of concating directories. | Use path.join instead of concating directories.
| JavaScript | mpl-2.0 | kayaelle/msol-badger,mozilla/openbadger,mozilla/openbadger,kayaelle/msol-badger,bdgio/msol-site,kayaelle/msol-badger,bdgio/msol-site,bdgio/msol-site |
0321a434b0561a500a9783af68240686bad5b599 | static/scripts/index.min.js | static/scripts/index.min.js | !function(){var n=document.querySelector.bind(document),e=document.querySelectorAll.bind(document);window.onscroll=function(){(window.pageYOffset||document.documentElement.scrollTop)>(window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight)-n("nav").clientHeight?(n("nav").classList.add("na... | !function(){var n=document.querySelector.bind(document),t=document.querySelectorAll.bind(document);window.onscroll=function(){(window.pageYOffset||document.documentElement.scrollTop)>(window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight)-n("nav").clientHeight?(n("nav").classList.add("na... | Fix logoBig drawing over nav overlay | Fix logoBig drawing over nav overlay | JavaScript | apache-2.0 | tomanistor/osprey,tomanistor/osprey |
0c750bf56cc25a10c9a2b10e34482dff99c4f583 | logic/account/readAccountModelLogic.js | logic/account/readAccountModelLogic.js | module.exports = {
getAccountModel: function (redisClient, accountHashID, callback) {
}
} | var configuration = require('../../config/configuration.json')
module.exports = {
getAccountModel: function (redisClient, accountHashID, callback) {
var tableName = configuration.TableMAAccountModelAnnouncerAccountModel + accountHashID
redisClient.hmget(tableName,
configuration.ConstantAMAAMBudget,
... | Implement Get AccountModel Business Logic | Implement Get AccountModel Business Logic
| JavaScript | mit | Flieral/Announcer-Service,Flieral/Announcer-Service |
44ec618627351160cb880f31ce31666e3b9e818e | gulpfile.js | gulpfile.js | var gulp = require('gulp'),
exec = require('child_process').exec;
gulp.task('test', function(cb) {
exec(
'node testrunner.js',
{ cwd : 'tests' },
function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
cb(err);
}
);
});
gulp.task('default', function() {
gulp.watch(['*... | var gulp = require("gulp");
var exec = require("child_process").exec;
gulp.task("test", function(cb) {
exec(
"node testrunner.js",
{cwd: "tests"},
function(err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
cb(err);
}
);
});
gulp.task("default", function() {
gulp.... | Add an eslint config and update the code to match it. | Add an eslint config and update the code to match it.
| JavaScript | mit | jwadhams/json-logic-js,jwadhams/json-logic-js |
210b303b03c686cd16f76617b8761af14baffc75 | gulpfile.js | gulpfile.js | // gulpfile.js
// Packages
var gulp = require('gulp');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
var browserify = require('browserify');
var babelify = require('babelify');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
// Tasks
// Uglify
gulp.task... | // gulpfile.js
// Packages
var gulp = require('gulp');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
var browserify = require('browserify');
var babelify = require('babelify');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
// Tasks
var bundleGames = f... | Refactor Gulpfile for Gulp Watch | Refactor Gulpfile for Gulp Watch
| JavaScript | mit | alfredoem/gulp-prelude |
ab3771718761c3624f2da197d9abf0ea4c32fdea | www/js/services.js | www/js/services.js | var MIM = angular.module('starter.services', []);
MIM.factory('DB', function($q, $ionicPlatform, $cordovaSQLite) {
this.queryStatement = function(query, parameters) {
parameters = parameters || [];
var q = $q.defer();
$ionicPlatform.ready(function() {
$cordovaSQLite.execute(db, query, parameters).... | var MIM = angular.module('starter.services', []);
MIM.factory('DB', function($q, $ionicPlatform, $cordovaSQLite) {
this.queryStatement = function(query, parameters) {
parameters = parameters || [];
var q = $q.defer();
$ionicPlatform.ready(function() {
$cordovaSQLite.execute(db, query, parameters).... | Add global query function getAll and getById | Add global query function getAll and getById
| JavaScript | apache-2.0 | meisyal/MIM,meisyal/MIM |
bdd86613a5c949c59ae7348150e21b793ef7d832 | test/resource.js | test/resource.js | 'use strict';
import Fabric from '../';
const assert = require('assert');
const expect = require('chai').expect;
const widget = require('../data/widget');
describe('Resource', function () {
it('should expose a constructor', function () {
assert.equal(typeof Fabric.Resource, 'function');
});
it('should in... | 'use strict';
import Fabric from '../';
const assert = require('assert');
const expect = require('chai').expect;
const widget = require('../data/widget');
describe('Resource', function () {
it('should expose a constructor', function () {
assert.equal(typeof Fabric.Resource, 'function');
});
it('should in... | Add query() test for Resource | Add query() test for Resource
| JavaScript | mit | martindale/fabric,martindale/fabric,martindale/fabric |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.