commit stringlengths 40 40 | old_file stringlengths 4 184 | new_file stringlengths 4 184 | old_contents stringlengths 1 3.6k | new_contents stringlengths 5 3.38k | subject stringlengths 15 778 | message stringlengths 16 6.74k | lang stringclasses 201 values | license stringclasses 13 values | repos stringlengths 6 116k | config stringclasses 201 values | content stringlengths 137 7.24k | diff stringlengths 26 5.55k | diff_length int64 1 123 | relative_diff_length float64 0.01 89 | n_lines_added int64 0 108 | n_lines_deleted int64 0 106 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
895e85dadbcc759220d05349501749d710e34b0e | k9mail/src/main/java/com/fsck/k9/mailstore/migrations/MigrationTo61.java | k9mail/src/main/java/com/fsck/k9/mailstore/migrations/MigrationTo61.java | package com.fsck.k9.mailstore.migrations;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
class MigrationTo61 {
static void addFolderRemoteId(SQLiteDatabase db) {
if (!columnExists(db, "folders", "remoteId")) {
db.execSQL("ALTER TABLE folders ADD remoteId TEXT");
db.execSQL("UPDATE folders SET remoteId = name");
}
}
private static boolean columnExists(SQLiteDatabase db, String table, String columnName) {
Cursor columnCursor = db.rawQuery("PRAGMA table_info(" + table + ")", null);
boolean foundColumn = false;
while (columnCursor.moveToNext()) {
String currentColumnName = columnCursor.getString(1);
if (currentColumnName.equals(columnName)) {
foundColumn = true;
break;
}
}
columnCursor.close();
return foundColumn;
}
}
| package com.fsck.k9.mailstore.migrations;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
class MigrationTo61 {
static void addFolderRemoteId(SQLiteDatabase db) {
if (!columnExists(db, "folders", "remoteId")) {
db.execSQL("ALTER TABLE folders ADD remoteId TEXT");
db.execSQL("UPDATE folders SET remoteId = name");
db.execSQL("DROP INDEX IF EXISTS folder_name");
db.execSQL("CREATE INDEX IF NOT EXISTS folder_remoteId ON folders (remoteId)");
}
}
private static boolean columnExists(SQLiteDatabase db, String table, String columnName) {
Cursor columnCursor = db.rawQuery("PRAGMA table_info(" + table + ")", null);
boolean foundColumn = false;
while (columnCursor.moveToNext()) {
String currentColumnName = columnCursor.getString(1);
if (currentColumnName.equals(columnName)) {
foundColumn = true;
break;
}
}
columnCursor.close();
return foundColumn;
}
}
| Update indexes on folders table during migration | Update indexes on folders table during migration
| Java | apache-2.0 | philipwhiuk/q-mail,philipwhiuk/q-mail,philipwhiuk/q-mail | java | ## Code Before:
package com.fsck.k9.mailstore.migrations;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
class MigrationTo61 {
static void addFolderRemoteId(SQLiteDatabase db) {
if (!columnExists(db, "folders", "remoteId")) {
db.execSQL("ALTER TABLE folders ADD remoteId TEXT");
db.execSQL("UPDATE folders SET remoteId = name");
}
}
private static boolean columnExists(SQLiteDatabase db, String table, String columnName) {
Cursor columnCursor = db.rawQuery("PRAGMA table_info(" + table + ")", null);
boolean foundColumn = false;
while (columnCursor.moveToNext()) {
String currentColumnName = columnCursor.getString(1);
if (currentColumnName.equals(columnName)) {
foundColumn = true;
break;
}
}
columnCursor.close();
return foundColumn;
}
}
## Instruction:
Update indexes on folders table during migration
## Code After:
package com.fsck.k9.mailstore.migrations;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
class MigrationTo61 {
static void addFolderRemoteId(SQLiteDatabase db) {
if (!columnExists(db, "folders", "remoteId")) {
db.execSQL("ALTER TABLE folders ADD remoteId TEXT");
db.execSQL("UPDATE folders SET remoteId = name");
db.execSQL("DROP INDEX IF EXISTS folder_name");
db.execSQL("CREATE INDEX IF NOT EXISTS folder_remoteId ON folders (remoteId)");
}
}
private static boolean columnExists(SQLiteDatabase db, String table, String columnName) {
Cursor columnCursor = db.rawQuery("PRAGMA table_info(" + table + ")", null);
boolean foundColumn = false;
while (columnCursor.moveToNext()) {
String currentColumnName = columnCursor.getString(1);
if (currentColumnName.equals(columnName)) {
foundColumn = true;
break;
}
}
columnCursor.close();
return foundColumn;
}
}
| package com.fsck.k9.mailstore.migrations;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
class MigrationTo61 {
static void addFolderRemoteId(SQLiteDatabase db) {
if (!columnExists(db, "folders", "remoteId")) {
db.execSQL("ALTER TABLE folders ADD remoteId TEXT");
db.execSQL("UPDATE folders SET remoteId = name");
+ db.execSQL("DROP INDEX IF EXISTS folder_name");
+ db.execSQL("CREATE INDEX IF NOT EXISTS folder_remoteId ON folders (remoteId)");
}
}
private static boolean columnExists(SQLiteDatabase db, String table, String columnName) {
Cursor columnCursor = db.rawQuery("PRAGMA table_info(" + table + ")", null);
boolean foundColumn = false;
while (columnCursor.moveToNext()) {
String currentColumnName = columnCursor.getString(1);
if (currentColumnName.equals(columnName)) {
foundColumn = true;
break;
}
}
columnCursor.close();
return foundColumn;
}
} | 2 | 0.066667 | 2 | 0 |
5770f82f0e98bdfb2bbf3a9bc1c8bd9dbf6e9e47 | test/window/index.js | test/window/index.js | exports.tests = {
addmetatohead : function() {
var meta = window.document.createElement("meta");
var head = window.document.getElementsByTagName("body").item(0);
head.appendChild(meta);
assertTrue("last element should be the new meta tag",
head.lastChild === meta);
assertTrue("meta should not be stringified with a closing tag",
window.document.innerHTML.indexOf("<meta>") > -1 &&
window.document.innerHTML.indexOf("</meta>") === -1
);
}
};
| exports.tests = {
addmetatohead : function() {
var meta = window.document.createElement("meta");
window.document.getElementsByTagName("head").item(0).appendChild(meta);
var elements = window.document.getElementsByTagName("head").item(0).childNodes;
assertTrue("last element should be the new meta tag",
elements.item(elements.length-1) === meta);
assertTrue("meta should not be stringified with a closing tag",
window.document.innerHTML.indexOf("<meta>") > -1 &&
window.document.innerHTML.indexOf("</meta>") === -1
);
}
};
| Revert "fix the meta tag test" | Revert "fix the meta tag test"
This reverts commit dde2e693efbd0e39a3cae96bdcb5b59bcce38ddd.
| JavaScript | mit | singlebrook/linkck,jeffcarp/jsdom,aduyng/jsdom,lcstore/jsdom,Joris-van-der-Wel/jsdom,iizukanao/jsdom,susaing/jsdom,Sebmaster/jsdom,danieljoppi/jsdom,robertknight/jsdom,kesla/jsdom,szarouski/jsdom,kevinold/jsdom,selam/jsdom,zaucy/jsdom,crealogix/jsdom,kevinold/jsdom,evdevgit/jsdom,nicolashenry/jsdom,evdevgit/jsdom,Zirro/jsdom,jeffcarp/jsdom,aduyng/jsdom,beni55/jsdom,fiftin/jsdom,darobin/jsdom,kangax/jsdom,jeffcarp/jsdom,darobin/jsdom,susaing/jsdom,kittens/jsdom,janusnic/jsdom,mbostock/jsdom,janusnic/jsdom,AshCoolman/jsdom,vestineo/jsdom,evdevgit/jsdom,cpojer/jsdom,darobin/jsdom,substack/jsdom,janusnic/jsdom,AVGP/jsdom,crealogix/jsdom,sirbrillig/jsdom,tmpvar/jsdom,vestineo/jsdom,evanlucas/jsdom,szarouski/jsdom,kittens/jsdom,Zirro/jsdom,sebmck/jsdom,szarouski/jsdom,concord-consortium/jsdom,kangax/jsdom,Joris-van-der-Wel/jsdom,beni55/jsdom,godmar/jsdom,mbostock/jsdom,beni55/jsdom,zaucy/jsdom,kesla/jsdom,evanlucas/jsdom,robertknight/jsdom,papandreou/jsdom,isaacs/jsdom,brianmcd/cloudbrowser-jsdom,Ye-Yong-Chi/jsdom,lcstore/jsdom,kevinold/jsdom,sebmck/jsdom,Ye-Yong-Chi/jsdom,oelmekki/jsdom,fiftin/jsdom,AshCoolman/jsdom,Joris-van-der-Wel/jsdom,Sebmaster/jsdom,sebmck/jsdom,mzgol/jsdom,danieljoppi/jsdom,medikoo/jsdom,susaing/jsdom,sirbrillig/jsdom,kesla/jsdom,nicolashenry/jsdom,oelmekki/jsdom,selam/jsdom,Sebmaster/jsdom,Ye-Yong-Chi/jsdom,sirbrillig/jsdom,snuggs/jsdom,mbostock/jsdom,tmpvar/jsdom,concord-consortium/jsdom,kittens/jsdom,fiftin/jsdom,godmar/jsdom,cpojer/jsdom,robertknight/jsdom,evanlucas/jsdom,AVGP/jsdom,papandreou/jsdom,isaacs/jsdom,substack/jsdom,selam/jsdom,dexteryy/jsdom-nogyp,cpojer/jsdom,brianmcd/cloudbrowser-jsdom,nicolashenry/jsdom,iizukanao/jsdom,dexteryy/jsdom-nogyp,aduyng/jsdom,vestineo/jsdom,medikoo/jsdom,snuggs/jsdom,lcstore/jsdom,danieljoppi/jsdom,medikoo/jsdom,mzgol/jsdom,mzgol/jsdom,zaucy/jsdom,AshCoolman/jsdom | javascript | ## Code Before:
exports.tests = {
addmetatohead : function() {
var meta = window.document.createElement("meta");
var head = window.document.getElementsByTagName("body").item(0);
head.appendChild(meta);
assertTrue("last element should be the new meta tag",
head.lastChild === meta);
assertTrue("meta should not be stringified with a closing tag",
window.document.innerHTML.indexOf("<meta>") > -1 &&
window.document.innerHTML.indexOf("</meta>") === -1
);
}
};
## Instruction:
Revert "fix the meta tag test"
This reverts commit dde2e693efbd0e39a3cae96bdcb5b59bcce38ddd.
## Code After:
exports.tests = {
addmetatohead : function() {
var meta = window.document.createElement("meta");
window.document.getElementsByTagName("head").item(0).appendChild(meta);
var elements = window.document.getElementsByTagName("head").item(0).childNodes;
assertTrue("last element should be the new meta tag",
elements.item(elements.length-1) === meta);
assertTrue("meta should not be stringified with a closing tag",
window.document.innerHTML.indexOf("<meta>") > -1 &&
window.document.innerHTML.indexOf("</meta>") === -1
);
}
};
| exports.tests = {
addmetatohead : function() {
var meta = window.document.createElement("meta");
+ window.document.getElementsByTagName("head").item(0).appendChild(meta);
- var head = window.document.getElementsByTagName("body").item(0);
? - ^^ ^^ -
+ var elements = window.document.getElementsByTagName("head").item(0).childNodes;
? ^^^^^^^ ^^^ +++++++++++
- head.appendChild(meta);
+
assertTrue("last element should be the new meta tag",
- head.lastChild === meta);
+ elements.item(elements.length-1) === meta);
assertTrue("meta should not be stringified with a closing tag",
window.document.innerHTML.indexOf("<meta>") > -1 &&
window.document.innerHTML.indexOf("</meta>") === -1
);
}
}; | 7 | 0.538462 | 4 | 3 |
3104587dc9980dca3f7fcb7bd32fbe685b0d7da2 | server/operations.js | server/operations.js | /**
*
* form-serializer#loadForm
*
* This is the server operation that reads the content of
* the HTML file that must be loaded and sends it back to the
* client.
*
*/
exports.loadForm = function (link) {
link.send(200, {
html: "Foo"
});
};
| // dependencies
var fs = require("fs");
/**
*
* form-serializer#loadForm
*
* This is the server operation that reads the content of
* the HTML file that must be loaded and sends it back to the
* client.
*
*/
exports.loadForm = function (link) {
// get data, params
var data = Object(link.data)
, params = link.params
;
// missing form id
if (!data.formId) {
return link.send(400, "Missing formId");
}
// html path
var htmlPath = params[data.formId];
// invalid form id
if (!htmlPath) {
return link.send(400, "Wrong form id.");
}
// set the absolute path to the html file
htmlPath = M.app.getPath() + htmlPath;
// read the file
fs.readFile(htmlPath, function (err, buffer) {
// handle error
if (err) {
return link.send(400, err);
}
// send success response
link.send(200, {
html: buffer.toString()
});
});
};
| Read the file content and send it to client | Read the file content and send it to client
| JavaScript | mit | amininus/jQuery-form-serializer,jillix/jQuery-form-serializer,amininus/jQuery-form-serializer,janusnic/jQuery-form-serializer,carabina/jQuery-form-serializer,jillix/jQuery-json-editor,jillix/jQuery-form-serializer,jillix/jQuery-json-editor,carabina/jQuery-form-serializer,jxmono/form-serializer,janusnic/jQuery-form-serializer | javascript | ## Code Before:
/**
*
* form-serializer#loadForm
*
* This is the server operation that reads the content of
* the HTML file that must be loaded and sends it back to the
* client.
*
*/
exports.loadForm = function (link) {
link.send(200, {
html: "Foo"
});
};
## Instruction:
Read the file content and send it to client
## Code After:
// dependencies
var fs = require("fs");
/**
*
* form-serializer#loadForm
*
* This is the server operation that reads the content of
* the HTML file that must be loaded and sends it back to the
* client.
*
*/
exports.loadForm = function (link) {
// get data, params
var data = Object(link.data)
, params = link.params
;
// missing form id
if (!data.formId) {
return link.send(400, "Missing formId");
}
// html path
var htmlPath = params[data.formId];
// invalid form id
if (!htmlPath) {
return link.send(400, "Wrong form id.");
}
// set the absolute path to the html file
htmlPath = M.app.getPath() + htmlPath;
// read the file
fs.readFile(htmlPath, function (err, buffer) {
// handle error
if (err) {
return link.send(400, err);
}
// send success response
link.send(200, {
html: buffer.toString()
});
});
};
| + // dependencies
+ var fs = require("fs");
+
/**
*
* form-serializer#loadForm
*
* This is the server operation that reads the content of
* the HTML file that must be loaded and sends it back to the
* client.
*
*/
exports.loadForm = function (link) {
+
+ // get data, params
+ var data = Object(link.data)
+ , params = link.params
+ ;
+
+ // missing form id
+ if (!data.formId) {
+ return link.send(400, "Missing formId");
+ }
+
+ // html path
+ var htmlPath = params[data.formId];
+
+ // invalid form id
+ if (!htmlPath) {
+ return link.send(400, "Wrong form id.");
+ }
+
+ // set the absolute path to the html file
+ htmlPath = M.app.getPath() + htmlPath;
+
+ // read the file
+ fs.readFile(htmlPath, function (err, buffer) {
+
+ // handle error
+ if (err) {
+ return link.send(400, err);
+ }
+
+ // send success response
- link.send(200, {
+ link.send(200, {
? ++++
- html: "Foo"
+ html: buffer.toString()
+ });
});
}; | 39 | 2.785714 | 37 | 2 |
50b8c8f421b4e24917e791d32660912daff1d873 | chapter12/src/Control/Monad/Cont/Extras.purs | chapter12/src/Control/Monad/Cont/Extras.purs | module Control.Monad.Cont.Extras where
import Data.Array ()
import Data.Maybe
import Data.Tuple
import Control.Monad
import Control.Monad.Eff
import Control.Monad.Eff.Ref
import Control.Monad.Trans
import Control.Monad.Cont.Trans
type WithRef eff = Eff (ref :: Ref | eff)
type ContRef eff = ContT Unit (WithRef eff)
foldC :: forall eff a r. (r -> a -> Tuple Boolean r) -> r -> ContRef eff a -> ContRef eff r
foldC f r0 c = do
current <- lift $ newRef r0
callCC $ \k -> do
a <- c
r <- lift $ readRef current
case f r a of
Tuple emit next -> do
when emit $ k next
quietly $ lift $ writeRef current next
where
quietly :: forall m a. (Monad m) => ContT Unit m Unit -> ContT Unit m a
quietly = withContT (\_ _ -> return unit)
collect :: forall eff a. ContRef eff (Maybe a) -> ContRef eff [a]
collect = foldC f []
where
f xs Nothing = Tuple true xs
f xs (Just x) = Tuple false (xs ++ [x])
| module Control.Monad.Cont.Extras where
import Data.Array ()
import Data.Maybe
import Data.Tuple
import Control.Monad
import Control.Monad.Eff
import Control.Monad.Eff.Ref
import Control.Monad.Trans
import Control.Monad.Cont.Trans
type WithRef eff = Eff (ref :: Ref | eff)
type ContRef eff = ContT Unit (WithRef eff)
foldC :: forall eff a r. (r -> a -> Tuple Boolean r) -> r -> ContRef eff a -> ContRef eff r
foldC f r0 c = do
current <- lift $ newRef r0
callCC $ \k -> quietly $ do
a <- c
r <- lift $ readRef current
case f r a of
Tuple emit next -> do
when emit $ k next
lift $ writeRef current next
where
quietly :: forall m a. (Monad m) => ContT Unit m Unit -> ContT Unit m a
quietly = withContT (\_ _ -> return unit)
collect :: forall eff a. ContRef eff (Maybe a) -> ContRef eff [a]
collect = foldC f []
where
f xs Nothing = Tuple true xs
f xs (Just x) = Tuple false (xs ++ [x])
| Use quietly at the top level | Use quietly at the top level
| PureScript | mit | endeavour/purescript-book,ascjones/purescript-book,ruisalgado/purescript-book,rick68/purescript-book,ericssmith/purescript-book,shybyte/purescript-book,mikemcgowan/purescript-book,rick68/purescript-book,paf31/purescript-book,ericssmith/purescript-book,paf31/purescript-book,beckyconning/purescript-by-example,ruisalgado/purescript-book,beckyconning/purescript-by-example,mikemcgowan/purescript-book,ascjones/purescript-book,endeavour/purescript-book,shybyte/purescript-book | purescript | ## Code Before:
module Control.Monad.Cont.Extras where
import Data.Array ()
import Data.Maybe
import Data.Tuple
import Control.Monad
import Control.Monad.Eff
import Control.Monad.Eff.Ref
import Control.Monad.Trans
import Control.Monad.Cont.Trans
type WithRef eff = Eff (ref :: Ref | eff)
type ContRef eff = ContT Unit (WithRef eff)
foldC :: forall eff a r. (r -> a -> Tuple Boolean r) -> r -> ContRef eff a -> ContRef eff r
foldC f r0 c = do
current <- lift $ newRef r0
callCC $ \k -> do
a <- c
r <- lift $ readRef current
case f r a of
Tuple emit next -> do
when emit $ k next
quietly $ lift $ writeRef current next
where
quietly :: forall m a. (Monad m) => ContT Unit m Unit -> ContT Unit m a
quietly = withContT (\_ _ -> return unit)
collect :: forall eff a. ContRef eff (Maybe a) -> ContRef eff [a]
collect = foldC f []
where
f xs Nothing = Tuple true xs
f xs (Just x) = Tuple false (xs ++ [x])
## Instruction:
Use quietly at the top level
## Code After:
module Control.Monad.Cont.Extras where
import Data.Array ()
import Data.Maybe
import Data.Tuple
import Control.Monad
import Control.Monad.Eff
import Control.Monad.Eff.Ref
import Control.Monad.Trans
import Control.Monad.Cont.Trans
type WithRef eff = Eff (ref :: Ref | eff)
type ContRef eff = ContT Unit (WithRef eff)
foldC :: forall eff a r. (r -> a -> Tuple Boolean r) -> r -> ContRef eff a -> ContRef eff r
foldC f r0 c = do
current <- lift $ newRef r0
callCC $ \k -> quietly $ do
a <- c
r <- lift $ readRef current
case f r a of
Tuple emit next -> do
when emit $ k next
lift $ writeRef current next
where
quietly :: forall m a. (Monad m) => ContT Unit m Unit -> ContT Unit m a
quietly = withContT (\_ _ -> return unit)
collect :: forall eff a. ContRef eff (Maybe a) -> ContRef eff [a]
collect = foldC f []
where
f xs Nothing = Tuple true xs
f xs (Just x) = Tuple false (xs ++ [x])
| module Control.Monad.Cont.Extras where
import Data.Array ()
import Data.Maybe
import Data.Tuple
import Control.Monad
import Control.Monad.Eff
import Control.Monad.Eff.Ref
import Control.Monad.Trans
import Control.Monad.Cont.Trans
type WithRef eff = Eff (ref :: Ref | eff)
type ContRef eff = ContT Unit (WithRef eff)
foldC :: forall eff a r. (r -> a -> Tuple Boolean r) -> r -> ContRef eff a -> ContRef eff r
foldC f r0 c = do
current <- lift $ newRef r0
- callCC $ \k -> do
+ callCC $ \k -> quietly $ do
? ++++++++++
a <- c
r <- lift $ readRef current
case f r a of
Tuple emit next -> do
when emit $ k next
- quietly $ lift $ writeRef current next
? ----------
+ lift $ writeRef current next
where
quietly :: forall m a. (Monad m) => ContT Unit m Unit -> ContT Unit m a
quietly = withContT (\_ _ -> return unit)
collect :: forall eff a. ContRef eff (Maybe a) -> ContRef eff [a]
collect = foldC f []
where
f xs Nothing = Tuple true xs
f xs (Just x) = Tuple false (xs ++ [x]) | 4 | 0.108108 | 2 | 2 |
63a1239d2415dc117d6871468ebaaaccbb6506eb | shell/update-repos.sh | shell/update-repos.sh | cd `dirname $0`;
# Neuter the internal field separator
IFS=''
# Formatting variables
BOLD=`tput bold`
BLUE=`tput setaf 12`
RESET=`tput sgr0`
# Cycle through each item in the CWD
for i in *; do
# Ensure the item's really a Git repository
[ -d "$i/.git" ] && { echo $(
cd $i;
# Print a divider to STDOUT to break the feedback up better
printf %s$'\n' "${BOLD}${BLUE}==>${RESET}${BOLD} Updating: $i${RESET}";
# Update!
git status --porcelain && { git pull; };
); };
# Is this a Subversion repository instead?
[ -d "$i/.svn" ] && { echo $(
cd $i;
# Drop another divider to break feedback up a little
printf %s$'\n' "${BOLD}${BLUE}==>${RESET}${BOLD} Updating: $i${RESET}";
# Update!
svn update;
); };
done;
| cd `dirname $0`;
# Neuter the internal field separator
IFS=''
# Formatting variables
BOLD=`tput bold`
BLUE=`tput setaf 12`
RESET=`tput sgr0`
# Cycle through each item in the CWD
for i in *; do
# Ensure the item's really a Git repository
[ -d "$i/.git" ] && { echo $(
cd $i;
# Print a divider to STDOUT to break the feedback up better
printf %s$'\n' "${BOLD}${BLUE}==>${RESET}${BOLD} Updating: $i${RESET}";
# Update!
git status --porcelain && { git pull; };
); };
# Is this a Subversion repository instead?
[ -d "$i/.svn" ] && { echo $(
cd $i;
# Drop another divider to break feedback up a little
printf %s$'\n' "${BOLD}${BLUE}==>${RESET}${BOLD} Updating: $i${RESET}";
# Clear .DS_Store crap if possible
hash dsclean 2>/dev/null && dsclean;
# Update!
svn update;
); };
done;
| Delete .DS_Store files before updating SVN repos | Delete .DS_Store files before updating SVN repos
| Shell | isc | Alhadis/Snippets,Alhadis/Snippets,Alhadis/Snippets,Alhadis/Snippets,Alhadis/Snippets | shell | ## Code Before:
cd `dirname $0`;
# Neuter the internal field separator
IFS=''
# Formatting variables
BOLD=`tput bold`
BLUE=`tput setaf 12`
RESET=`tput sgr0`
# Cycle through each item in the CWD
for i in *; do
# Ensure the item's really a Git repository
[ -d "$i/.git" ] && { echo $(
cd $i;
# Print a divider to STDOUT to break the feedback up better
printf %s$'\n' "${BOLD}${BLUE}==>${RESET}${BOLD} Updating: $i${RESET}";
# Update!
git status --porcelain && { git pull; };
); };
# Is this a Subversion repository instead?
[ -d "$i/.svn" ] && { echo $(
cd $i;
# Drop another divider to break feedback up a little
printf %s$'\n' "${BOLD}${BLUE}==>${RESET}${BOLD} Updating: $i${RESET}";
# Update!
svn update;
); };
done;
## Instruction:
Delete .DS_Store files before updating SVN repos
## Code After:
cd `dirname $0`;
# Neuter the internal field separator
IFS=''
# Formatting variables
BOLD=`tput bold`
BLUE=`tput setaf 12`
RESET=`tput sgr0`
# Cycle through each item in the CWD
for i in *; do
# Ensure the item's really a Git repository
[ -d "$i/.git" ] && { echo $(
cd $i;
# Print a divider to STDOUT to break the feedback up better
printf %s$'\n' "${BOLD}${BLUE}==>${RESET}${BOLD} Updating: $i${RESET}";
# Update!
git status --porcelain && { git pull; };
); };
# Is this a Subversion repository instead?
[ -d "$i/.svn" ] && { echo $(
cd $i;
# Drop another divider to break feedback up a little
printf %s$'\n' "${BOLD}${BLUE}==>${RESET}${BOLD} Updating: $i${RESET}";
# Clear .DS_Store crap if possible
hash dsclean 2>/dev/null && dsclean;
# Update!
svn update;
); };
done;
| cd `dirname $0`;
# Neuter the internal field separator
IFS=''
# Formatting variables
BOLD=`tput bold`
BLUE=`tput setaf 12`
RESET=`tput sgr0`
# Cycle through each item in the CWD
for i in *; do
# Ensure the item's really a Git repository
[ -d "$i/.git" ] && { echo $(
cd $i;
# Print a divider to STDOUT to break the feedback up better
printf %s$'\n' "${BOLD}${BLUE}==>${RESET}${BOLD} Updating: $i${RESET}";
# Update!
git status --porcelain && { git pull; };
); };
# Is this a Subversion repository instead?
[ -d "$i/.svn" ] && { echo $(
cd $i;
# Drop another divider to break feedback up a little
printf %s$'\n' "${BOLD}${BLUE}==>${RESET}${BOLD} Updating: $i${RESET}";
+ # Clear .DS_Store crap if possible
+ hash dsclean 2>/dev/null && dsclean;
+
# Update!
svn update;
); };
done; | 3 | 0.075 | 3 | 0 |
37716cc499cd0636d70cdf5c45feb853061786c6 | package.json | package.json | {
"name": "monastery-dwelling",
"version": "0.0.1",
"description": "Game of chase and ring the bell",
"main": "app.js",
"repository": {
"type": "git",
"url": "git://github.com/coderextreme/pc.multiplayer.git"
},
"dependencies": {
"hoek": "~>4.2.1",
"express": "*",
"node-rest-client": "*",
"osm2x3d": "*",
"socket.io": "*"
},
"devDependencies": {
"hoek": "~>4.2.1",
"chai": "*",
"jshint": "*",
"grunt": "*",
"grunt-simple-mocha": "*",
"grunt-contrib-concat": "*",
"grunt-contrib-jshint": "*",
"grunt-contrib-uglify": "*",
"grunt-contrib-watch": "*",
"grunt-contrib-nodeunit": "*",
"gulp": "*",
"gulp-jshint": "*",
"gulp-mocha": "*",
"mocha": "*",
"socket.io-client": "*"
},
"scripts": {
"start": "node app.js"
}
}
| {
"name": "monastery-dwelling",
"version": "0.0.1",
"description": "Game of chase and ring the bell",
"main": "app.js",
"engines": {
"npm":"6.0.1",
"node":"10.1.0"
},
"repository": {
"type": "git",
"url": "git://github.com/coderextreme/pc.multiplayer.git"
},
"dependencies": {
"hoek": "~>4.2.1",
"express": "*",
"node-rest-client": "*",
"osm2x3d": "*",
"socket.io": "*"
},
"devDependencies": {
"hoek": "~>4.2.1",
"chai": "*",
"jshint": "*",
"grunt": "*",
"grunt-simple-mocha": "*",
"grunt-contrib-concat": "*",
"grunt-contrib-jshint": "*",
"grunt-contrib-uglify": "*",
"grunt-contrib-watch": "*",
"grunt-contrib-nodeunit": "*",
"gulp": "*",
"gulp-jshint": "*",
"gulp-mocha": "*",
"mocha": "*",
"socket.io-client": "*"
},
"scripts": {
"start": "node app.js"
}
}
| Upgrade node and npm versions | Upgrade node and npm versions
| JSON | bsd-2-clause | coderextreme/pc.multiplayer,carlsonsolutiondesign/pc.multiplayer,carlsonsolutiondesign/pc.multiplayer,coderextreme/pc.multiplayer | json | ## Code Before:
{
"name": "monastery-dwelling",
"version": "0.0.1",
"description": "Game of chase and ring the bell",
"main": "app.js",
"repository": {
"type": "git",
"url": "git://github.com/coderextreme/pc.multiplayer.git"
},
"dependencies": {
"hoek": "~>4.2.1",
"express": "*",
"node-rest-client": "*",
"osm2x3d": "*",
"socket.io": "*"
},
"devDependencies": {
"hoek": "~>4.2.1",
"chai": "*",
"jshint": "*",
"grunt": "*",
"grunt-simple-mocha": "*",
"grunt-contrib-concat": "*",
"grunt-contrib-jshint": "*",
"grunt-contrib-uglify": "*",
"grunt-contrib-watch": "*",
"grunt-contrib-nodeunit": "*",
"gulp": "*",
"gulp-jshint": "*",
"gulp-mocha": "*",
"mocha": "*",
"socket.io-client": "*"
},
"scripts": {
"start": "node app.js"
}
}
## Instruction:
Upgrade node and npm versions
## Code After:
{
"name": "monastery-dwelling",
"version": "0.0.1",
"description": "Game of chase and ring the bell",
"main": "app.js",
"engines": {
"npm":"6.0.1",
"node":"10.1.0"
},
"repository": {
"type": "git",
"url": "git://github.com/coderextreme/pc.multiplayer.git"
},
"dependencies": {
"hoek": "~>4.2.1",
"express": "*",
"node-rest-client": "*",
"osm2x3d": "*",
"socket.io": "*"
},
"devDependencies": {
"hoek": "~>4.2.1",
"chai": "*",
"jshint": "*",
"grunt": "*",
"grunt-simple-mocha": "*",
"grunt-contrib-concat": "*",
"grunt-contrib-jshint": "*",
"grunt-contrib-uglify": "*",
"grunt-contrib-watch": "*",
"grunt-contrib-nodeunit": "*",
"gulp": "*",
"gulp-jshint": "*",
"gulp-mocha": "*",
"mocha": "*",
"socket.io-client": "*"
},
"scripts": {
"start": "node app.js"
}
}
| {
"name": "monastery-dwelling",
"version": "0.0.1",
"description": "Game of chase and ring the bell",
"main": "app.js",
+ "engines": {
+ "npm":"6.0.1",
+ "node":"10.1.0"
+ },
"repository": {
"type": "git",
"url": "git://github.com/coderextreme/pc.multiplayer.git"
},
"dependencies": {
"hoek": "~>4.2.1",
"express": "*",
"node-rest-client": "*",
"osm2x3d": "*",
"socket.io": "*"
},
"devDependencies": {
"hoek": "~>4.2.1",
"chai": "*",
"jshint": "*",
"grunt": "*",
"grunt-simple-mocha": "*",
"grunt-contrib-concat": "*",
"grunt-contrib-jshint": "*",
"grunt-contrib-uglify": "*",
"grunt-contrib-watch": "*",
"grunt-contrib-nodeunit": "*",
"gulp": "*",
"gulp-jshint": "*",
"gulp-mocha": "*",
"mocha": "*",
"socket.io-client": "*"
},
"scripts": {
"start": "node app.js"
}
} | 4 | 0.108108 | 4 | 0 |
61fdd2b074127bb57924f065fef0cf9f21431146 | qa/src/test/java/org/eclipse/kapua/qa/steps/BasicSteps.java | qa/src/test/java/org/eclipse/kapua/qa/steps/BasicSteps.java | /*******************************************************************************
* Copyright (c) 2017 Red Hat Inc and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat Inc - initial API and implementation
*******************************************************************************/
package org.eclipse.kapua.qa.steps;
import static java.time.Duration.ofSeconds;
import cucumber.api.java.en.When;
import cucumber.runtime.java.guice.ScenarioScoped;
@ScenarioScoped
public class BasicSteps {
private static final double WAIT_MULTIPLIER = Double.parseDouble(System.getProperty("org.eclipse.kapua.qa.waitMultiplier", "1.0"));
@When("I wait (\\d+) seconds?.*")
public void waitSeconds(int seconds) throws InterruptedException {
double effectiveSeconds = ((double) seconds) * WAIT_MULTIPLIER;
Thread.sleep(ofSeconds((long) Math.ceil(effectiveSeconds)).toMillis());
}
}
| /*******************************************************************************
* Copyright (c) 2017 Red Hat Inc and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat Inc - initial API and implementation
*******************************************************************************/
package org.eclipse.kapua.qa.steps;
import static java.time.Duration.ofSeconds;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import cucumber.api.java.Before;
import cucumber.api.java.en.When;
import cucumber.runtime.java.guice.ScenarioScoped;
@ScenarioScoped
public class BasicSteps {
private static final Logger logger = LoggerFactory.getLogger(BasicSteps.class);
private static final double WAIT_MULTIPLIER = Double.parseDouble(System.getProperty("org.eclipse.kapua.qa.waitMultiplier", "1.0"));
@Before
public void checkWaitMultipier() {
if (WAIT_MULTIPLIER != 1.0d) {
logger.info("Wait multiplier active: {}", WAIT_MULTIPLIER);
}
}
@When("I wait (\\d+) seconds?.*")
public void waitSeconds(int seconds) throws InterruptedException {
double effectiveSeconds = ((double) seconds) * WAIT_MULTIPLIER;
Thread.sleep(ofSeconds((long) Math.ceil(effectiveSeconds)).toMillis());
}
}
| Add a message for the wait multiplier | Add a message for the wait multiplier | Java | epl-1.0 | stzilli/kapua,stzilli/kapua,LeoNerdoG/kapua,LeoNerdoG/kapua,stzilli/kapua,stzilli/kapua,LeoNerdoG/kapua,LeoNerdoG/kapua,stzilli/kapua,LeoNerdoG/kapua | java | ## Code Before:
/*******************************************************************************
* Copyright (c) 2017 Red Hat Inc and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat Inc - initial API and implementation
*******************************************************************************/
package org.eclipse.kapua.qa.steps;
import static java.time.Duration.ofSeconds;
import cucumber.api.java.en.When;
import cucumber.runtime.java.guice.ScenarioScoped;
@ScenarioScoped
public class BasicSteps {
private static final double WAIT_MULTIPLIER = Double.parseDouble(System.getProperty("org.eclipse.kapua.qa.waitMultiplier", "1.0"));
@When("I wait (\\d+) seconds?.*")
public void waitSeconds(int seconds) throws InterruptedException {
double effectiveSeconds = ((double) seconds) * WAIT_MULTIPLIER;
Thread.sleep(ofSeconds((long) Math.ceil(effectiveSeconds)).toMillis());
}
}
## Instruction:
Add a message for the wait multiplier
## Code After:
/*******************************************************************************
* Copyright (c) 2017 Red Hat Inc and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat Inc - initial API and implementation
*******************************************************************************/
package org.eclipse.kapua.qa.steps;
import static java.time.Duration.ofSeconds;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import cucumber.api.java.Before;
import cucumber.api.java.en.When;
import cucumber.runtime.java.guice.ScenarioScoped;
@ScenarioScoped
public class BasicSteps {
private static final Logger logger = LoggerFactory.getLogger(BasicSteps.class);
private static final double WAIT_MULTIPLIER = Double.parseDouble(System.getProperty("org.eclipse.kapua.qa.waitMultiplier", "1.0"));
@Before
public void checkWaitMultipier() {
if (WAIT_MULTIPLIER != 1.0d) {
logger.info("Wait multiplier active: {}", WAIT_MULTIPLIER);
}
}
@When("I wait (\\d+) seconds?.*")
public void waitSeconds(int seconds) throws InterruptedException {
double effectiveSeconds = ((double) seconds) * WAIT_MULTIPLIER;
Thread.sleep(ofSeconds((long) Math.ceil(effectiveSeconds)).toMillis());
}
}
| /*******************************************************************************
* Copyright (c) 2017 Red Hat Inc and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat Inc - initial API and implementation
*******************************************************************************/
package org.eclipse.kapua.qa.steps;
import static java.time.Duration.ofSeconds;
+ import org.slf4j.Logger;
+ import org.slf4j.LoggerFactory;
+
+ import cucumber.api.java.Before;
import cucumber.api.java.en.When;
import cucumber.runtime.java.guice.ScenarioScoped;
@ScenarioScoped
public class BasicSteps {
+ private static final Logger logger = LoggerFactory.getLogger(BasicSteps.class);
+
private static final double WAIT_MULTIPLIER = Double.parseDouble(System.getProperty("org.eclipse.kapua.qa.waitMultiplier", "1.0"));
+
+ @Before
+ public void checkWaitMultipier() {
+ if (WAIT_MULTIPLIER != 1.0d) {
+ logger.info("Wait multiplier active: {}", WAIT_MULTIPLIER);
+ }
+ }
@When("I wait (\\d+) seconds?.*")
public void waitSeconds(int seconds) throws InterruptedException {
double effectiveSeconds = ((double) seconds) * WAIT_MULTIPLIER;
Thread.sleep(ofSeconds((long) Math.ceil(effectiveSeconds)).toMillis());
}
} | 13 | 0.433333 | 13 | 0 |
70b23dbd315b93213fc62540aab6293665b9dd0c | pebble_tool/sdk/__init__.py | pebble_tool/sdk/__init__.py | from __future__ import absolute_import
__author__ = 'katharine'
import os
import subprocess
from pebble_tool.exceptions import MissingSDK
from pebble_tool.util import get_persist_dir
def sdk_path():
path = os.getenv('PEBBLE_SDK_PATH', None) or os.path.normpath(os.path.join(os.path.dirname(__file__), '..', '..'))
if not os.path.exists(path):
raise MissingSDK("SDK unavailable; can't run this command.")
return path
def sdk_version():
try:
from . import version
return version.version_string
except ImportError:
try:
return subprocess.check_output(["git", "describe"], stderr=subprocess.STDOUT).strip()
except subprocess.CalledProcessError as e:
if e.returncode == 128:
return 'g{}'.format(subprocess.check_output(["git", "rev-parse", "--short", "HEAD"],
stderr=subprocess.STDOUT)).strip()
else:
return 'unknown'
def get_sdk_persist_dir(platform):
dir = os.path.join(get_persist_dir(), sdk_version(), platform)
if not os.path.exists(dir):
os.makedirs(dir)
return dir
def add_arm_tools_to_path(self, args):
os.environ['PATH'] += ":{}".format(os.path.join(self.sdk_path(args), "arm-cs-tools", "bin")) | from __future__ import absolute_import
__author__ = 'katharine'
import os
import subprocess
from pebble_tool.exceptions import MissingSDK
from pebble_tool.util import get_persist_dir
def sdk_path():
path = os.getenv('PEBBLE_SDK_PATH', None) or os.path.normpath(os.path.join(os.path.dirname(__file__), '..', '..'))
if not os.path.exists(path):
raise MissingSDK("SDK unavailable; can't run this command.")
return path
def sdk_version():
try:
from . import version
return version.version_string
except ImportError:
here = os.path.dirname(__file__)
try:
return subprocess.check_output(["git", "describe"], cwd=here, stderr=subprocess.STDOUT).strip()
except subprocess.CalledProcessError as e:
if e.returncode == 128:
try:
return 'g{}'.format(subprocess.check_output(["git", "rev-parse", "--short", "HEAD"], cwd=here,
stderr=subprocess.STDOUT)).strip()
except subprocess.CalledProcessError as e:
pass
return 'unknown'
def get_sdk_persist_dir(platform):
dir = os.path.join(get_persist_dir(), sdk_version(), platform)
if not os.path.exists(dir):
os.makedirs(dir)
return dir
def add_arm_tools_to_path(self, args):
os.environ['PATH'] += ":{}".format(os.path.join(self.sdk_path(args), "arm-cs-tools", "bin")) | Fix error determining current version in other working directories. | Fix error determining current version in other working directories.
| Python | mit | pebble/pebble-tool,pebble/pebble-tool,gregoiresage/pebble-tool,gregoiresage/pebble-tool,pebble/pebble-tool,pebble/pebble-tool,gregoiresage/pebble-tool,gregoiresage/pebble-tool | python | ## Code Before:
from __future__ import absolute_import
__author__ = 'katharine'
import os
import subprocess
from pebble_tool.exceptions import MissingSDK
from pebble_tool.util import get_persist_dir
def sdk_path():
path = os.getenv('PEBBLE_SDK_PATH', None) or os.path.normpath(os.path.join(os.path.dirname(__file__), '..', '..'))
if not os.path.exists(path):
raise MissingSDK("SDK unavailable; can't run this command.")
return path
def sdk_version():
try:
from . import version
return version.version_string
except ImportError:
try:
return subprocess.check_output(["git", "describe"], stderr=subprocess.STDOUT).strip()
except subprocess.CalledProcessError as e:
if e.returncode == 128:
return 'g{}'.format(subprocess.check_output(["git", "rev-parse", "--short", "HEAD"],
stderr=subprocess.STDOUT)).strip()
else:
return 'unknown'
def get_sdk_persist_dir(platform):
dir = os.path.join(get_persist_dir(), sdk_version(), platform)
if not os.path.exists(dir):
os.makedirs(dir)
return dir
def add_arm_tools_to_path(self, args):
os.environ['PATH'] += ":{}".format(os.path.join(self.sdk_path(args), "arm-cs-tools", "bin"))
## Instruction:
Fix error determining current version in other working directories.
## Code After:
from __future__ import absolute_import
__author__ = 'katharine'
import os
import subprocess
from pebble_tool.exceptions import MissingSDK
from pebble_tool.util import get_persist_dir
def sdk_path():
path = os.getenv('PEBBLE_SDK_PATH', None) or os.path.normpath(os.path.join(os.path.dirname(__file__), '..', '..'))
if not os.path.exists(path):
raise MissingSDK("SDK unavailable; can't run this command.")
return path
def sdk_version():
try:
from . import version
return version.version_string
except ImportError:
here = os.path.dirname(__file__)
try:
return subprocess.check_output(["git", "describe"], cwd=here, stderr=subprocess.STDOUT).strip()
except subprocess.CalledProcessError as e:
if e.returncode == 128:
try:
return 'g{}'.format(subprocess.check_output(["git", "rev-parse", "--short", "HEAD"], cwd=here,
stderr=subprocess.STDOUT)).strip()
except subprocess.CalledProcessError as e:
pass
return 'unknown'
def get_sdk_persist_dir(platform):
dir = os.path.join(get_persist_dir(), sdk_version(), platform)
if not os.path.exists(dir):
os.makedirs(dir)
return dir
def add_arm_tools_to_path(self, args):
os.environ['PATH'] += ":{}".format(os.path.join(self.sdk_path(args), "arm-cs-tools", "bin")) | from __future__ import absolute_import
__author__ = 'katharine'
import os
import subprocess
from pebble_tool.exceptions import MissingSDK
from pebble_tool.util import get_persist_dir
def sdk_path():
path = os.getenv('PEBBLE_SDK_PATH', None) or os.path.normpath(os.path.join(os.path.dirname(__file__), '..', '..'))
if not os.path.exists(path):
raise MissingSDK("SDK unavailable; can't run this command.")
return path
def sdk_version():
try:
from . import version
return version.version_string
except ImportError:
+ here = os.path.dirname(__file__)
try:
- return subprocess.check_output(["git", "describe"], stderr=subprocess.STDOUT).strip()
+ return subprocess.check_output(["git", "describe"], cwd=here, stderr=subprocess.STDOUT).strip()
? ++++++++++
except subprocess.CalledProcessError as e:
if e.returncode == 128:
+ try:
- return 'g{}'.format(subprocess.check_output(["git", "rev-parse", "--short", "HEAD"],
+ return 'g{}'.format(subprocess.check_output(["git", "rev-parse", "--short", "HEAD"], cwd=here,
? ++++ ++++++++++
- stderr=subprocess.STDOUT)).strip()
+ stderr=subprocess.STDOUT)).strip()
? ++++
- else:
+ except subprocess.CalledProcessError as e:
+ pass
- return 'unknown'
? ----
+ return 'unknown'
def get_sdk_persist_dir(platform):
dir = os.path.join(get_persist_dir(), sdk_version(), platform)
if not os.path.exists(dir):
os.makedirs(dir)
return dir
def add_arm_tools_to_path(self, args):
os.environ['PATH'] += ":{}".format(os.path.join(self.sdk_path(args), "arm-cs-tools", "bin")) | 13 | 0.325 | 8 | 5 |
39404dfa8ab921977347d4405c525935a0ce234d | cc/license/tests/test_licenses.py | cc/license/tests/test_licenses.py | from nose.tools import assert_true
def test_find_sampling_selector():
from zope.interface import implementedBy
import cc.license
sampling_selector = cc.license.get_selector('recombo')()
return sampling_selector
def test_find_sampling_licenses():
selector = test_find_sampling_selector()
lic = selector.by_code('sampling')
assert_true(not lic.libre)
assert_true(lic.deprecated)
lic = selector.by_code('sampling+')
assert_true(not lic.deprecated)
def test_find_pd():
from zope.interface import implementedBy
import cc.license
pd_selector = cc.license.get_selector('publicdomain')()
pd = pd_selector.by_code('publicdomain')
return pd
def test_pd():
pd = test_find_pd()
assert_true(pd.libre)
assert_true(pd.jurisdiction == 'Your mom')
assert_true(not pd.deprecated)
assert_true(pd.jurisdiction == 'Your mom')
assert_true(pd.license_code == 'publicdomain')
assert_true(pd.name() == 'Public Domain' == pd.name('en'))
assert_true(pd.name('hr') == u'Javna domena')
| from nose.tools import assert_true
def test_find_sampling_selector():
from zope.interface import implementedBy
import cc.license
sampling_selector = cc.license.get_selector('recombo')()
return sampling_selector
def test_find_standard_selector():
from zope.interface import implementedBy
import cc.license
standard_selector = cc.license.get_selector('standard')()
return standard_selector
def test_find_sampling_licenses():
selector = test_find_sampling_selector()
lic = selector.by_code('sampling')
assert_true(not lic.libre)
assert_true(lic.deprecated)
lic = selector.by_code('sampling+')
assert_true(not lic.deprecated)
def test_find_pd():
from zope.interface import implementedBy
import cc.license
pd_selector = cc.license.get_selector('publicdomain')()
pd = pd_selector.by_code('publicdomain')
return pd
def test_pd():
pd = test_find_pd()
assert_true(pd.libre)
assert_true(pd.jurisdiction == 'Your mom')
assert_true(not pd.deprecated)
assert_true(pd.jurisdiction == 'Your mom')
assert_true(pd.license_code == 'publicdomain')
assert_true(pd.name() == 'Public Domain' == pd.name('en'))
assert_true(pd.name('hr') == u'Javna domena')
| Add a test for grabbing the standard selector | Add a test for grabbing the standard selector
| Python | mit | creativecommons/cc.license,creativecommons/cc.license | python | ## Code Before:
from nose.tools import assert_true
def test_find_sampling_selector():
from zope.interface import implementedBy
import cc.license
sampling_selector = cc.license.get_selector('recombo')()
return sampling_selector
def test_find_sampling_licenses():
selector = test_find_sampling_selector()
lic = selector.by_code('sampling')
assert_true(not lic.libre)
assert_true(lic.deprecated)
lic = selector.by_code('sampling+')
assert_true(not lic.deprecated)
def test_find_pd():
from zope.interface import implementedBy
import cc.license
pd_selector = cc.license.get_selector('publicdomain')()
pd = pd_selector.by_code('publicdomain')
return pd
def test_pd():
pd = test_find_pd()
assert_true(pd.libre)
assert_true(pd.jurisdiction == 'Your mom')
assert_true(not pd.deprecated)
assert_true(pd.jurisdiction == 'Your mom')
assert_true(pd.license_code == 'publicdomain')
assert_true(pd.name() == 'Public Domain' == pd.name('en'))
assert_true(pd.name('hr') == u'Javna domena')
## Instruction:
Add a test for grabbing the standard selector
## Code After:
from nose.tools import assert_true
def test_find_sampling_selector():
from zope.interface import implementedBy
import cc.license
sampling_selector = cc.license.get_selector('recombo')()
return sampling_selector
def test_find_standard_selector():
from zope.interface import implementedBy
import cc.license
standard_selector = cc.license.get_selector('standard')()
return standard_selector
def test_find_sampling_licenses():
selector = test_find_sampling_selector()
lic = selector.by_code('sampling')
assert_true(not lic.libre)
assert_true(lic.deprecated)
lic = selector.by_code('sampling+')
assert_true(not lic.deprecated)
def test_find_pd():
from zope.interface import implementedBy
import cc.license
pd_selector = cc.license.get_selector('publicdomain')()
pd = pd_selector.by_code('publicdomain')
return pd
def test_pd():
pd = test_find_pd()
assert_true(pd.libre)
assert_true(pd.jurisdiction == 'Your mom')
assert_true(not pd.deprecated)
assert_true(pd.jurisdiction == 'Your mom')
assert_true(pd.license_code == 'publicdomain')
assert_true(pd.name() == 'Public Domain' == pd.name('en'))
assert_true(pd.name('hr') == u'Javna domena')
| from nose.tools import assert_true
def test_find_sampling_selector():
from zope.interface import implementedBy
import cc.license
sampling_selector = cc.license.get_selector('recombo')()
return sampling_selector
+
+ def test_find_standard_selector():
+ from zope.interface import implementedBy
+ import cc.license
+
+ standard_selector = cc.license.get_selector('standard')()
+ return standard_selector
def test_find_sampling_licenses():
selector = test_find_sampling_selector()
lic = selector.by_code('sampling')
assert_true(not lic.libre)
assert_true(lic.deprecated)
lic = selector.by_code('sampling+')
assert_true(not lic.deprecated)
def test_find_pd():
from zope.interface import implementedBy
import cc.license
pd_selector = cc.license.get_selector('publicdomain')()
pd = pd_selector.by_code('publicdomain')
return pd
def test_pd():
pd = test_find_pd()
assert_true(pd.libre)
assert_true(pd.jurisdiction == 'Your mom')
assert_true(not pd.deprecated)
assert_true(pd.jurisdiction == 'Your mom')
assert_true(pd.license_code == 'publicdomain')
assert_true(pd.name() == 'Public Domain' == pd.name('en'))
assert_true(pd.name('hr') == u'Javna domena') | 7 | 0.205882 | 7 | 0 |
638f52f59135d151a3c7ed4f84fc0716c6c0d69d | mcbench/xpath.py | mcbench/xpath.py | import sys
import lxml.etree
class XPathError(Exception):
pass
def parse_xml_filename(filename):
return lxml.etree.parse(filename)
def compile_xpath(query):
try:
return lxml.etree.XPath(query)
except lxml.etree.XPathSyntaxError as e:
raise XPathError(e.msg), None, sys.exc_info()[2]
def register_extensions():
ns = lxml.etree.FunctionNamespace(None)
ns['is_call'] = lambda c, n: is_call(c.context_node, n)
def is_call(node, name):
return (node.tag == 'ParameterizedExpr' and
node[0].tag == 'NameExpr' and
node[0].get('kind') == 'FUN' and
node[0][0].get('nameId') == name)
| import sys
import lxml.etree
class XPathError(Exception):
pass
def parse_xml_filename(filename):
return lxml.etree.parse(filename)
def compile_xpath(query):
try:
return lxml.etree.XPath(query)
except lxml.etree.XPathSyntaxError as e:
raise XPathError(e.msg), None, sys.exc_info()[2]
def register_extensions():
ns = lxml.etree.FunctionNamespace(None)
ns['is_call'] = is_call
def is_call(context, *names):
node = context.context_node
if node.tag != 'ParameterizedExpr':
return False
if node[0].tag != 'NameExpr' or node[0].get('kind') != 'FUN':
return False
called_name = node[0][0].get('nameId')
# Could this function like
# is_call('eval', 'feval') -> names is a tuple of strings
# is_call(//some/sequence) -> names[0] is a list of strings
for name in names:
if isinstance(name, basestring) and called_name == name:
return True
elif any(called_name == n for n in name):
return True
return False
| Make is_call handle multiple arguments. | Make is_call handle multiple arguments.
Can now be called with a sequence, as in
is_call(ancestor::Function/@name)
or just several literals, as in is_call('eval', 'feval').
In both cases, it does an or.
| Python | mit | isbadawi/mcbench,isbadawi/mcbench | python | ## Code Before:
import sys
import lxml.etree
class XPathError(Exception):
pass
def parse_xml_filename(filename):
return lxml.etree.parse(filename)
def compile_xpath(query):
try:
return lxml.etree.XPath(query)
except lxml.etree.XPathSyntaxError as e:
raise XPathError(e.msg), None, sys.exc_info()[2]
def register_extensions():
ns = lxml.etree.FunctionNamespace(None)
ns['is_call'] = lambda c, n: is_call(c.context_node, n)
def is_call(node, name):
return (node.tag == 'ParameterizedExpr' and
node[0].tag == 'NameExpr' and
node[0].get('kind') == 'FUN' and
node[0][0].get('nameId') == name)
## Instruction:
Make is_call handle multiple arguments.
Can now be called with a sequence, as in
is_call(ancestor::Function/@name)
or just several literals, as in is_call('eval', 'feval').
In both cases, it does an or.
## Code After:
import sys
import lxml.etree
class XPathError(Exception):
pass
def parse_xml_filename(filename):
return lxml.etree.parse(filename)
def compile_xpath(query):
try:
return lxml.etree.XPath(query)
except lxml.etree.XPathSyntaxError as e:
raise XPathError(e.msg), None, sys.exc_info()[2]
def register_extensions():
ns = lxml.etree.FunctionNamespace(None)
ns['is_call'] = is_call
def is_call(context, *names):
node = context.context_node
if node.tag != 'ParameterizedExpr':
return False
if node[0].tag != 'NameExpr' or node[0].get('kind') != 'FUN':
return False
called_name = node[0][0].get('nameId')
# Could this function like
# is_call('eval', 'feval') -> names is a tuple of strings
# is_call(//some/sequence) -> names[0] is a list of strings
for name in names:
if isinstance(name, basestring) and called_name == name:
return True
elif any(called_name == n for n in name):
return True
return False
| import sys
import lxml.etree
class XPathError(Exception):
pass
def parse_xml_filename(filename):
return lxml.etree.parse(filename)
def compile_xpath(query):
try:
return lxml.etree.XPath(query)
except lxml.etree.XPathSyntaxError as e:
raise XPathError(e.msg), None, sys.exc_info()[2]
def register_extensions():
ns = lxml.etree.FunctionNamespace(None)
- ns['is_call'] = lambda c, n: is_call(c.context_node, n)
+ ns['is_call'] = is_call
- def is_call(node, name):
? ^^
+ def is_call(context, *names):
? ++ ^ ++ + +
+ node = context.context_node
- return (node.tag == 'ParameterizedExpr' and
? ^^^^^^ - ^ ^^^^
+ if node.tag != 'ParameterizedExpr':
? ^^ ^ ^
- node[0].tag == 'NameExpr' and
- node[0].get('kind') == 'FUN' and
- node[0][0].get('nameId') == name)
+ return False
+ if node[0].tag != 'NameExpr' or node[0].get('kind') != 'FUN':
+ return False
+
+ called_name = node[0][0].get('nameId')
+
+ # Could this function like
+ # is_call('eval', 'feval') -> names is a tuple of strings
+ # is_call(//some/sequence) -> names[0] is a list of strings
+ for name in names:
+ if isinstance(name, basestring) and called_name == name:
+ return True
+ elif any(called_name == n for n in name):
+ return True
+ return False | 25 | 0.833333 | 19 | 6 |
d7a77380ad95e316efb73a7be485d9b882fd64e9 | Core/models.py | Core/models.py | from django.db import models
##
# Location Types
##
class World(models.Model):
name = models.CharField(max_length=30)
homes = models.ManyToManyField(Home)
class Home(models.Model):
name = models.CharField(max_length=30)
rooms = models.ManyToManyField(Room)
class Room(models.Model):
name = models.CharField(max_length=30)
##
# Device Types
##
class Device(models.Model):
name = models.CharField(max_length=30)
class Meta:
abstract = True
class OutputDevice(Device):
actions = models.ManyToManyField(Action)
class Meta:
abstract = True
class InputDevice(Device):
events = models.ManyToManyField(Event)
class Meta:
abstract = True
##
# Input/Output
##
class Action(models.Model):
name = models.CharField(max_length=30)
def run()
class Meta:
abstract = True
class Event(models.Model):
name = models.CharField(max_length=30)
actions = models.ManyToMany(Action)
def call():
for (action in self.actions):
action.run()
class Meta:
abstract = True
| from django.db import models
##
# Location Types
##
class World(models.Model):
name = models.CharField(max_length=30)
homes = models.ManyToManyField(Home)
class Meta:
db_table = u'Worlds'
class Home(models.Model):
name = models.CharField(max_length=30)
rooms = models.ManyToManyField(Room)
class Meta:
db_table = u'Homes'
class Room(models.Model):
name = models.CharField(max_length=30)
class Meta:
db_table = u'Rooms'
##
# Device Types
##
class Device(models.Model):
name = models.CharField(max_length=30)
class Meta:
abstract = True
class OutputDevice(Device):
actions = models.ManyToManyField(Action)
class Meta:
abstract = True
class InputDevice(Device):
events = models.ManyToManyField(Event)
class Meta:
abstract = True
##
# Input/Output
##
class Action(models.Model):
name = models.CharField(max_length=30)
def run()
class Meta:
abstract = True
class Event(models.Model):
name = models.CharField(max_length=30)
actions = models.ManyToMany(Action)
def call():
for (action in self.actions):
action.run()
class Meta:
abstract = True
| Add table names to core model items | Add table names to core model items
| Python | mit | Tomcuzz/OctaHomeAutomation,Tomcuzz/OctaHomeAutomation,Tomcuzz/OctaHomeAutomation,Tomcuzz/OctaHomeAutomation | python | ## Code Before:
from django.db import models
##
# Location Types
##
class World(models.Model):
name = models.CharField(max_length=30)
homes = models.ManyToManyField(Home)
class Home(models.Model):
name = models.CharField(max_length=30)
rooms = models.ManyToManyField(Room)
class Room(models.Model):
name = models.CharField(max_length=30)
##
# Device Types
##
class Device(models.Model):
name = models.CharField(max_length=30)
class Meta:
abstract = True
class OutputDevice(Device):
actions = models.ManyToManyField(Action)
class Meta:
abstract = True
class InputDevice(Device):
events = models.ManyToManyField(Event)
class Meta:
abstract = True
##
# Input/Output
##
class Action(models.Model):
name = models.CharField(max_length=30)
def run()
class Meta:
abstract = True
class Event(models.Model):
name = models.CharField(max_length=30)
actions = models.ManyToMany(Action)
def call():
for (action in self.actions):
action.run()
class Meta:
abstract = True
## Instruction:
Add table names to core model items
## Code After:
from django.db import models
##
# Location Types
##
class World(models.Model):
name = models.CharField(max_length=30)
homes = models.ManyToManyField(Home)
class Meta:
db_table = u'Worlds'
class Home(models.Model):
name = models.CharField(max_length=30)
rooms = models.ManyToManyField(Room)
class Meta:
db_table = u'Homes'
class Room(models.Model):
name = models.CharField(max_length=30)
class Meta:
db_table = u'Rooms'
##
# Device Types
##
class Device(models.Model):
name = models.CharField(max_length=30)
class Meta:
abstract = True
class OutputDevice(Device):
actions = models.ManyToManyField(Action)
class Meta:
abstract = True
class InputDevice(Device):
events = models.ManyToManyField(Event)
class Meta:
abstract = True
##
# Input/Output
##
class Action(models.Model):
name = models.CharField(max_length=30)
def run()
class Meta:
abstract = True
class Event(models.Model):
name = models.CharField(max_length=30)
actions = models.ManyToMany(Action)
def call():
for (action in self.actions):
action.run()
class Meta:
abstract = True
| from django.db import models
##
# Location Types
##
class World(models.Model):
name = models.CharField(max_length=30)
homes = models.ManyToManyField(Home)
+ class Meta:
+ db_table = u'Worlds'
class Home(models.Model):
name = models.CharField(max_length=30)
rooms = models.ManyToManyField(Room)
+ class Meta:
+ db_table = u'Homes'
class Room(models.Model):
name = models.CharField(max_length=30)
+ class Meta:
+ db_table = u'Rooms'
##
# Device Types
##
class Device(models.Model):
name = models.CharField(max_length=30)
class Meta:
abstract = True
class OutputDevice(Device):
actions = models.ManyToManyField(Action)
class Meta:
abstract = True
class InputDevice(Device):
events = models.ManyToManyField(Event)
class Meta:
abstract = True
##
# Input/Output
##
class Action(models.Model):
name = models.CharField(max_length=30)
def run()
class Meta:
abstract = True
class Event(models.Model):
name = models.CharField(max_length=30)
actions = models.ManyToMany(Action)
def call():
for (action in self.actions):
action.run()
class Meta:
abstract = True
| 6 | 0.095238 | 6 | 0 |
a4bd6fab3048f28d7656de69be4758620286e9e1 | scripts/build-example.sh | scripts/build-example.sh | dir=${dir-"examples/compiled"}
for name in "$@"
do
echo "Compiling $name" # to $dir (nopatch=$nopatch, forcesvg=$forcesvg)"
# compile normalized example if $skipnormalize is not set
if [ ! -n "$skipnormalize" ]; then
#build full vl example
scripts/build-normalized-example $name.vl.json
fi
# compile Vega example
rm -f examples/compiled/$name.vg.json
bin/vl2vg -p examples/specs/$name.vl.json > examples/compiled/$name.vg.json
if (! git diff $nopatch --exit-code HEAD -- $dir/$name.vg.json || $forcesvg)
then
rm -f examples/compiled/$name.svg
node_modules/vega/bin/vg2svg --seed 123456789 examples/compiled/$name.vg.json > examples/compiled/$name.svg -b .
fi
done
| dir=${dir-"examples/compiled"}
for name in "$@"
do
echo "Compiling $name" # to $dir (nopatch=$nopatch, forcesvg=$forcesvg)"
# compile normalized example if $skipnormalize is not set
if [ ! -n "$skipnormalize" ]; then
#build full vl example
scripts/build-normalized-example $name.vl.json
fi
# compile Vega example
rm -f examples/compiled/$name.vg.json
bin/vl2vg -p examples/specs/$name.vl.json > examples/compiled/$name.vg.json
# compile SVG if one of the following condition is true
# 1) Vega spec has changed
# 2) The SVG file does not exist (new example would not have vg file diff)
# or 3) the forcesvg environment variable is true
if (! git diff $nopatch --exit-code HEAD -- $dir/$name.vg.json || [ ! -f $dir/$name.svg ] || $forcesvg)
then
rm -f examples/compiled/$name.svg
node_modules/vega/bin/vg2svg --seed 123456789 examples/compiled/$name.vg.json > examples/compiled/$name.svg -b .
fi
done
| Make build:example correctly build SVG for new examples | Make build:example correctly build SVG for new examples
| Shell | bsd-3-clause | uwdata/vega-lite,vega/vega-lite,vega/vega-lite,vega/vega-lite,uwdata/vega-lite,uwdata/vega-lite,vega/vega-lite,uwdata/vega-lite,uwdata/vega-lite,vega/vega-lite | shell | ## Code Before:
dir=${dir-"examples/compiled"}
for name in "$@"
do
echo "Compiling $name" # to $dir (nopatch=$nopatch, forcesvg=$forcesvg)"
# compile normalized example if $skipnormalize is not set
if [ ! -n "$skipnormalize" ]; then
#build full vl example
scripts/build-normalized-example $name.vl.json
fi
# compile Vega example
rm -f examples/compiled/$name.vg.json
bin/vl2vg -p examples/specs/$name.vl.json > examples/compiled/$name.vg.json
if (! git diff $nopatch --exit-code HEAD -- $dir/$name.vg.json || $forcesvg)
then
rm -f examples/compiled/$name.svg
node_modules/vega/bin/vg2svg --seed 123456789 examples/compiled/$name.vg.json > examples/compiled/$name.svg -b .
fi
done
## Instruction:
Make build:example correctly build SVG for new examples
## Code After:
dir=${dir-"examples/compiled"}
for name in "$@"
do
echo "Compiling $name" # to $dir (nopatch=$nopatch, forcesvg=$forcesvg)"
# compile normalized example if $skipnormalize is not set
if [ ! -n "$skipnormalize" ]; then
#build full vl example
scripts/build-normalized-example $name.vl.json
fi
# compile Vega example
rm -f examples/compiled/$name.vg.json
bin/vl2vg -p examples/specs/$name.vl.json > examples/compiled/$name.vg.json
# compile SVG if one of the following condition is true
# 1) Vega spec has changed
# 2) The SVG file does not exist (new example would not have vg file diff)
# or 3) the forcesvg environment variable is true
if (! git diff $nopatch --exit-code HEAD -- $dir/$name.vg.json || [ ! -f $dir/$name.svg ] || $forcesvg)
then
rm -f examples/compiled/$name.svg
node_modules/vega/bin/vg2svg --seed 123456789 examples/compiled/$name.vg.json > examples/compiled/$name.svg -b .
fi
done
| dir=${dir-"examples/compiled"}
for name in "$@"
do
echo "Compiling $name" # to $dir (nopatch=$nopatch, forcesvg=$forcesvg)"
# compile normalized example if $skipnormalize is not set
if [ ! -n "$skipnormalize" ]; then
#build full vl example
scripts/build-normalized-example $name.vl.json
fi
# compile Vega example
rm -f examples/compiled/$name.vg.json
bin/vl2vg -p examples/specs/$name.vl.json > examples/compiled/$name.vg.json
+ # compile SVG if one of the following condition is true
+ # 1) Vega spec has changed
+ # 2) The SVG file does not exist (new example would not have vg file diff)
+ # or 3) the forcesvg environment variable is true
- if (! git diff $nopatch --exit-code HEAD -- $dir/$name.vg.json || $forcesvg)
+ if (! git diff $nopatch --exit-code HEAD -- $dir/$name.vg.json || [ ! -f $dir/$name.svg ] || $forcesvg)
? +++++++++++++++++++++++++++
then
rm -f examples/compiled/$name.svg
node_modules/vega/bin/vg2svg --seed 123456789 examples/compiled/$name.vg.json > examples/compiled/$name.svg -b .
fi
done | 6 | 0.272727 | 5 | 1 |
ae20f0c5b9e61d3fcefafa1bc79fef30f0af96f2 | documentation/concepts/index.md | documentation/concepts/index.md | ---
layout: flat
title: STIX Concepts
---
This page describes several central STIX concepts that cut across all of the core STIX data types
* [Controlled Vocabularies](controlled-vocabularies) - Describes how to use
values from a default vocabulary, define custom vocabularies, or use values
outside of any vocabulary.
* [Data Markings](data-markings) - Describes how to use data markings to mark STIX content.
* [Relationships](relationships) - Describes how to use STIX relationships.
* [Versioning](versioning) - Describes a few different versioning scenarios and how those are handled in STIX.
* [xsi:type](xsi-type) - Describes the STIX usage of xsi:type for core components, extension points, and controlled vocabularies.
| ---
layout: flat
title: STIX Concepts
---
This page describes several central STIX concepts that cut across all of the core STIX data types.
<div class="row">
<div class="col-md-6">
<div class="well">
<h4><a href="controlled-vocabularies">Constrolled Vocabularies</a></h4>
<p>Describes how to use values from a default vocabulary, define custom
vocabularies, or use values outside of any vocabulary.</p>
<a class="btn btn-primary" href="controlled-vocabularies">Go »</a>
</div>
<div class="well">
<img src="/images/Data Marking.png" class="component-img" alt="Data Marking Icon" />
<h4><a href="data-markings">Data Markings</a></h4>
<p>Describes how to use data markings to mark STIX content.</p>
<a class="btn btn-primary" href="data-marking">Go »</a>
</div>
<div class="well">
<h4><a href="relationships">Relationships</a></h4>
<p>Describes how to use STIX relationships.</p>
<a class="btn btn-primary" href="relationships">Go »</a>
</div>
</div>
<div class="col-md-6">
<div class="well">
<h4><a href="versioning">Versioning</a></h4>
<p>Describes a few different versioning scenarios and how those are
handled in STIX.</p>
<a class="btn btn-primary" href="versioning">Go »</a>
</div>
<div class="well">
<h4><a href="xsi-type">xsi:type</a></h4>
<p>Describes the STIX usage of xsi:type for core components, extension
points, and controlled vocabularies.</p>
<a class="btn btn-primary" href="xsi-type">Go »</a>
</div>
</div>
</div>
| Convert concepts page to wells | Convert concepts page to wells
| Markdown | bsd-3-clause | jburns12/stixproject.github.io,jburns12/stixproject.github.io,johnwunder/johnwunder.github.io,johnwunder/johnwunder.github.io,STIXProject/stixproject.github.io,jburns12/stixproject.github.io,johnwunder/johnwunder.github.io,johnwunder/johnwunder.github.io,STIXProject/stixproject.github.io,jburns12/stixproject.github.io,STIXProject/stixproject.github.io,STIXProject/stixproject.github.io | markdown | ## Code Before:
---
layout: flat
title: STIX Concepts
---
This page describes several central STIX concepts that cut across all of the core STIX data types
* [Controlled Vocabularies](controlled-vocabularies) - Describes how to use
values from a default vocabulary, define custom vocabularies, or use values
outside of any vocabulary.
* [Data Markings](data-markings) - Describes how to use data markings to mark STIX content.
* [Relationships](relationships) - Describes how to use STIX relationships.
* [Versioning](versioning) - Describes a few different versioning scenarios and how those are handled in STIX.
* [xsi:type](xsi-type) - Describes the STIX usage of xsi:type for core components, extension points, and controlled vocabularies.
## Instruction:
Convert concepts page to wells
## Code After:
---
layout: flat
title: STIX Concepts
---
This page describes several central STIX concepts that cut across all of the core STIX data types.
<div class="row">
<div class="col-md-6">
<div class="well">
<h4><a href="controlled-vocabularies">Constrolled Vocabularies</a></h4>
<p>Describes how to use values from a default vocabulary, define custom
vocabularies, or use values outside of any vocabulary.</p>
<a class="btn btn-primary" href="controlled-vocabularies">Go »</a>
</div>
<div class="well">
<img src="/images/Data Marking.png" class="component-img" alt="Data Marking Icon" />
<h4><a href="data-markings">Data Markings</a></h4>
<p>Describes how to use data markings to mark STIX content.</p>
<a class="btn btn-primary" href="data-marking">Go »</a>
</div>
<div class="well">
<h4><a href="relationships">Relationships</a></h4>
<p>Describes how to use STIX relationships.</p>
<a class="btn btn-primary" href="relationships">Go »</a>
</div>
</div>
<div class="col-md-6">
<div class="well">
<h4><a href="versioning">Versioning</a></h4>
<p>Describes a few different versioning scenarios and how those are
handled in STIX.</p>
<a class="btn btn-primary" href="versioning">Go »</a>
</div>
<div class="well">
<h4><a href="xsi-type">xsi:type</a></h4>
<p>Describes the STIX usage of xsi:type for core components, extension
points, and controlled vocabularies.</p>
<a class="btn btn-primary" href="xsi-type">Go »</a>
</div>
</div>
</div>
| ---
layout: flat
title: STIX Concepts
---
- This page describes several central STIX concepts that cut across all of the core STIX data types
+ This page describes several central STIX concepts that cut across all of the core STIX data types.
? +
- * [Controlled Vocabularies](controlled-vocabularies) - Describes how to use
- values from a default vocabulary, define custom vocabularies, or use values
- outside of any vocabulary.
+ <div class="row">
+ <div class="col-md-6">
+ <div class="well">
+ <h4><a href="controlled-vocabularies">Constrolled Vocabularies</a></h4>
+
+ <p>Describes how to use values from a default vocabulary, define custom
+ vocabularies, or use values outside of any vocabulary.</p>
+
+ <a class="btn btn-primary" href="controlled-vocabularies">Go »</a>
+ </div>
+
+ <div class="well">
+ <img src="/images/Data Marking.png" class="component-img" alt="Data Marking Icon" />
+ <h4><a href="data-markings">Data Markings</a></h4>
+
- * [Data Markings](data-markings) - Describes how to use data markings to mark STIX content.
? - ----- ------------------------ -
+ <p>Describes how to use data markings to mark STIX content.</p>
? +++++ ++++
- * [Relationships](relationships) - Describes how to use STIX relationships.
- * [Versioning](versioning) - Describes a few different versioning scenarios and how those are handled in STIX.
- * [xsi:type](xsi-type) - Describes the STIX usage of xsi:type for core components, extension points, and controlled vocabularies.
+
+ <a class="btn btn-primary" href="data-marking">Go »</a>
+ </div>
+
+ <div class="well">
+ <h4><a href="relationships">Relationships</a></h4>
+
+ <p>Describes how to use STIX relationships.</p>
+
+ <a class="btn btn-primary" href="relationships">Go »</a>
+ </div>
+ </div>
+
+ <div class="col-md-6">
+ <div class="well">
+ <h4><a href="versioning">Versioning</a></h4>
+
+ <p>Describes a few different versioning scenarios and how those are
+ handled in STIX.</p>
+
+ <a class="btn btn-primary" href="versioning">Go »</a>
+ </div>
+
+ <div class="well">
+ <h4><a href="xsi-type">xsi:type</a></h4>
+
+ <p>Describes the STIX usage of xsi:type for core components, extension
+ points, and controlled vocabularies.</p>
+
+ <a class="btn btn-primary" href="xsi-type">Go »</a>
+ </div>
+ </div>
+ </div> | 58 | 4.142857 | 50 | 8 |
7938aa91d2889536af6a2f3857ae0a2dc7cf0a42 | templates/accordion.html | templates/accordion.html | <%!
from django.core.urlresolvers import reverse
%>
<%def name="make_chapter(chapter)">
<h3><a href="#">${chapter['name']}</a></h3>
<ul>
% for section in chapter['sections']:
<li
% if 'active' in section and section['active']:
class="active"
% endif
>
<a href="${reverse('courseware_section', args=format_url_params([course_name, chapter['name'], section['name']]))}">
<p>${section['name']}</p>
<p class="subtitle">
${section['format']}
% if 'due' in section and section['due']!="":
due ${section['due']}
% endif
</p>
</a>
% endfor
</ul>
</%def>
% for chapter in toc:
${make_chapter(chapter)}
% endfor
| <%!
from django.core.urlresolvers import reverse
%>
<%def name="make_chapter(chapter)">
<h3><a href="#">${chapter['name']}</a></h3>
<ul>
% for section in chapter['sections']:
<li${' class="active"' if 'active' in section and section['active'] else ''}>
<a href="${reverse('courseware_section', args=format_url_params([course_name, chapter['name'], section['name']]))}">
<p>${section['name']}</p>
<p class="subtitle">
${section['format']} ${"due " + section['due'] if 'due' in section and section['due'] != '' else ''}
</p>
</a>
% endfor
</ul>
</%def>
% for chapter in toc:
${make_chapter(chapter)}
% endfor
| Use inline if-else to cleanup HTML | Use inline if-else to cleanup HTML
The result from the normal if-else block has linebreak, which result in
poorly formatted HTML code. This should fix it and make the code looks
cleaner.
| HTML | agpl-3.0 | jazkarta/edx-platform,benpatterson/edx-platform,mahendra-r/edx-platform,shabab12/edx-platform,ampax/edx-platform,CredoReference/edx-platform,jamiefolsom/edx-platform,polimediaupv/edx-platform,angelapper/edx-platform,lduarte1991/edx-platform,EDUlib/edx-platform,morpheby/levelup-by,EduPepperPDTesting/pepper2013-testing,hkawasaki/kawasaki-aio8-0,hastexo/edx-platform,eestay/edx-platform,rhndg/openedx,defance/edx-platform,solashirai/edx-platform,nanolearningllc/edx-platform-cypress-2,caesar2164/edx-platform,martynovp/edx-platform,Livit/Livit.Learn.EdX,jbassen/edx-platform,miptliot/edx-platform,jazkarta/edx-platform,kamalx/edx-platform,wwj718/ANALYSE,wwj718/edx-platform,MSOpenTech/edx-platform,zofuthan/edx-platform,Edraak/circleci-edx-platform,chudaol/edx-platform,ahmadio/edx-platform,ovnicraft/edx-platform,DNFcode/edx-platform,ubc/edx-platform,hkawasaki/kawasaki-aio8-2,cognitiveclass/edx-platform,shubhdev/openedx,shubhdev/openedx,Kalyzee/edx-platform,IITBinterns13/edx-platform-dev,stvstnfrd/edx-platform,mjirayu/sit_academy,zhenzhai/edx-platform,vikas1885/test1,zubair-arbi/edx-platform,dkarakats/edx-platform,zofuthan/edx-platform,TsinghuaX/edx-platform,nttks/edx-platform,cselis86/edx-platform,ak2703/edx-platform,shubhdev/edx-platform,zerobatu/edx-platform,amir-qayyum-khan/edx-platform,ferabra/edx-platform,DNFcode/edx-platform,alu042/edx-platform,leansoft/edx-platform,4eek/edx-platform,procangroup/edx-platform,eestay/edx-platform,atsolakid/edx-platform,xinjiguaike/edx-platform,Semi-global/edx-platform,dsajkl/123,andyzsf/edx,marcore/edx-platform,msegado/edx-platform,dcosentino/edx-platform,zhenzhai/edx-platform,chauhanhardik/populo,shubhdev/edx-platform,jamesblunt/edx-platform,cyanna/edx-platform,ubc/edx-platform,chauhanhardik/populo,mahendra-r/edx-platform,B-MOOC/edx-platform,teltek/edx-platform,chauhanhardik/populo_2,devs1991/test_edx_docmode,jbassen/edx-platform,martynovp/edx-platform,philanthropy-u/edx-platform,cpennington/edx-platform,ampax/edx-platform,lduarte1991/edx-platform,shubhdev/openedx,gsehub/edx-platform,cecep-edu/edx-platform,MSOpenTech/edx-platform,yokose-ks/edx-platform,teltek/edx-platform,cyanna/edx-platform,shubhdev/edxOnBaadal,atsolakid/edx-platform,chudaol/edx-platform,jazkarta/edx-platform-for-isc,beacloudgenius/edx-platform,kursitet/edx-platform,morpheby/levelup-by,LearnEra/LearnEraPlaftform,appsembler/edx-platform,utecuy/edx-platform,jazztpt/edx-platform,ubc/edx-platform,msegado/edx-platform,TsinghuaX/edx-platform,dsajkl/reqiop,EDUlib/edx-platform,10clouds/edx-platform,motion2015/edx-platform,jzoldak/edx-platform,nanolearning/edx-platform,sudheerchintala/LearnEraPlatForm,kalebhartje/schoolboost,cognitiveclass/edx-platform,simbs/edx-platform,bitifirefly/edx-platform,ahmadiga/min_edx,jazztpt/edx-platform,mjg2203/edx-platform-seas,romain-li/edx-platform,kursitet/edx-platform,utecuy/edx-platform,wwj718/ANALYSE,rationalAgent/edx-platform-custom,10clouds/edx-platform,ahmedaljazzar/edx-platform,xingyepei/edx-platform,zadgroup/edx-platform,rismalrv/edx-platform,polimediaupv/edx-platform,mahendra-r/edx-platform,jelugbo/tundex,zofuthan/edx-platform,jamiefolsom/edx-platform,shubhdev/edx-platform,naresh21/synergetics-edx-platform,doismellburning/edx-platform,J861449197/edx-platform,etzhou/edx-platform,jjmiranda/edx-platform,devs1991/test_edx_docmode,naresh21/synergetics-edx-platform,chrisndodge/edx-platform,leansoft/edx-platform,louyihua/edx-platform,nanolearning/edx-platform,y12uc231/edx-platform,PepperPD/edx-pepper-platform,zadgroup/edx-platform,raccoongang/edx-platform,torchingloom/edx-platform,zerobatu/edx-platform,ahmedaljazzar/edx-platform,Edraak/edraak-platform,ahmadio/edx-platform,Ayub-Khan/edx-platform,cyanna/edx-platform,xinjiguaike/edx-platform,UXE/local-edx,Edraak/edraak-platform,rhndg/openedx,beni55/edx-platform,shashank971/edx-platform,BehavioralInsightsTeam/edx-platform,shabab12/edx-platform,nagyistoce/edx-platform,MSOpenTech/edx-platform,OmarIthawi/edx-platform,shubhdev/edxOnBaadal,TeachAtTUM/edx-platform,MakeHer/edx-platform,bigdatauniversity/edx-platform,WatanabeYasumasa/edx-platform,beacloudgenius/edx-platform,vismartltd/edx-platform,marcore/edx-platform,halvertoluke/edx-platform,cecep-edu/edx-platform,itsjeyd/edx-platform,bigdatauniversity/edx-platform,mushtaqak/edx-platform,playm2mboy/edx-platform,BehavioralInsightsTeam/edx-platform,pepeportela/edx-platform,ahmadio/edx-platform,jswope00/GAI,kmoocdev/edx-platform,chauhanhardik/populo_2,apigee/edx-platform,iivic/BoiseStateX,nagyistoce/edx-platform,hastexo/edx-platform,JCBarahona/edX,a-parhom/edx-platform,adoosii/edx-platform,y12uc231/edx-platform,carsongee/edx-platform,zhenzhai/edx-platform,ampax/edx-platform-backup,synergeticsedx/deployment-wipro,proversity-org/edx-platform,romain-li/edx-platform,jelugbo/tundex,etzhou/edx-platform,cselis86/edx-platform,longmen21/edx-platform,EDUlib/edx-platform,dsajkl/reqiop,analyseuc3m/ANALYSE-v1,rue89-tech/edx-platform,wwj718/edx-platform,JioEducation/edx-platform,marcore/edx-platform,devs1991/test_edx_docmode,hmcmooc/muddx-platform,rhndg/openedx,atsolakid/edx-platform,jamesblunt/edx-platform,Lektorium-LLC/edx-platform,ak2703/edx-platform,y12uc231/edx-platform,raccoongang/edx-platform,jazkarta/edx-platform-for-isc,leansoft/edx-platform,wwj718/edx-platform,gsehub/edx-platform,cecep-edu/edx-platform,SravanthiSinha/edx-platform,ZLLab-Mooc/edx-platform,synergeticsedx/deployment-wipro,xuxiao19910803/edx,arifsetiawan/edx-platform,shubhdev/edxOnBaadal,DNFcode/edx-platform,Edraak/circleci-edx-platform,chrisndodge/edx-platform,kxliugang/edx-platform,pomegranited/edx-platform,zerobatu/edx-platform,eestay/edx-platform,jswope00/griffinx,chand3040/cloud_that,ampax/edx-platform-backup,eemirtekin/edx-platform,mjirayu/sit_academy,iivic/BoiseStateX,B-MOOC/edx-platform,don-github/edx-platform,dsajkl/reqiop,syjeon/new_edx,dsajkl/123,jbzdak/edx-platform,eestay/edx-platform,eduNEXT/edunext-platform,simbs/edx-platform,jswope00/griffinx,jswope00/griffinx,CourseTalk/edx-platform,morenopc/edx-platform,beni55/edx-platform,arbrandes/edx-platform,appsembler/edx-platform,nttks/jenkins-test,chrisndodge/edx-platform,jswope00/griffinx,ESOedX/edx-platform,romain-li/edx-platform,appliedx/edx-platform,IONISx/edx-platform,pku9104038/edx-platform,longmen21/edx-platform,Softmotions/edx-platform,mjirayu/sit_academy,J861449197/edx-platform,Edraak/edx-platform,chauhanhardik/populo_2,hamzehd/edx-platform,LearnEra/LearnEraPlaftform,ak2703/edx-platform,motion2015/a3,LearnEra/LearnEraPlaftform,nttks/jenkins-test,mjg2203/edx-platform-seas,wwj718/ANALYSE,halvertoluke/edx-platform,Edraak/edraak-platform,chauhanhardik/populo,cyanna/edx-platform,torchingloom/edx-platform,Shrhawk/edx-platform,pdehaye/theming-edx-platform,doganov/edx-platform,chauhanhardik/populo,synergeticsedx/deployment-wipro,MakeHer/edx-platform,kursitet/edx-platform,knehez/edx-platform,deepsrijit1105/edx-platform,dcosentino/edx-platform,appliedx/edx-platform,halvertoluke/edx-platform,benpatterson/edx-platform,msegado/edx-platform,alexthered/kienhoc-platform,sudheerchintala/LearnEraPlatForm,jonathan-beard/edx-platform,shurihell/testasia,pepeportela/edx-platform,olexiim/edx-platform,arifsetiawan/edx-platform,pabloborrego93/edx-platform,morenopc/edx-platform,TsinghuaX/edx-platform,fly19890211/edx-platform,rue89-tech/edx-platform,utecuy/edx-platform,ampax/edx-platform-backup,kmoocdev2/edx-platform,jonathan-beard/edx-platform,CredoReference/edx-platform,eduNEXT/edunext-platform,UOMx/edx-platform,appsembler/edx-platform,jruiperezv/ANALYSE,ampax/edx-platform-backup,eduNEXT/edunext-platform,TeachAtTUM/edx-platform,jazztpt/edx-platform,ahmedaljazzar/edx-platform,angelapper/edx-platform,Semi-global/edx-platform,pomegranited/edx-platform,stvstnfrd/edx-platform,eemirtekin/edx-platform,kmoocdev2/edx-platform,jbzdak/edx-platform,EDUlib/edx-platform,chand3040/cloud_that,nikolas/edx-platform,kamalx/edx-platform,Stanford-Online/edx-platform,BehavioralInsightsTeam/edx-platform,nanolearningllc/edx-platform-cypress,syjeon/new_edx,don-github/edx-platform,rhndg/openedx,devs1991/test_edx_docmode,amir-qayyum-khan/edx-platform,mtlchun/edx,angelapper/edx-platform,polimediaupv/edx-platform,yokose-ks/edx-platform,iivic/BoiseStateX,RPI-OPENEDX/edx-platform,defance/edx-platform,amir-qayyum-khan/edx-platform,rue89-tech/edx-platform,waheedahmed/edx-platform,xuxiao19910803/edx-platform,franosincic/edx-platform,vismartltd/edx-platform,RPI-OPENEDX/edx-platform,raccoongang/edx-platform,bitifirefly/edx-platform,tanmaykm/edx-platform,unicri/edx-platform,jruiperezv/ANALYSE,Semi-global/edx-platform,gsehub/edx-platform,eduNEXT/edx-platform,nanolearning/edx-platform,ferabra/edx-platform,motion2015/a3,martynovp/edx-platform,TeachAtTUM/edx-platform,JioEducation/edx-platform,IONISx/edx-platform,motion2015/a3,adoosii/edx-platform,chudaol/edx-platform,fly19890211/edx-platform,xuxiao19910803/edx-platform,jolyonb/edx-platform,dcosentino/edx-platform,Ayub-Khan/edx-platform,motion2015/edx-platform,jelugbo/tundex,DefyVentures/edx-platform,chand3040/cloud_that,procangroup/edx-platform,hmcmooc/muddx-platform,ESOedX/edx-platform,jbzdak/edx-platform,ahmadio/edx-platform,vismartltd/edx-platform,TsinghuaX/edx-platform,jazztpt/edx-platform,mtlchun/edx,Unow/edx-platform,nttks/edx-platform,rationalAgent/edx-platform-custom,benpatterson/edx-platform,apigee/edx-platform,AkA84/edx-platform,DefyVentures/edx-platform,JioEducation/edx-platform,sameetb-cuelogic/edx-platform-test,leansoft/edx-platform,peterm-itr/edx-platform,ak2703/edx-platform,Unow/edx-platform,jazkarta/edx-platform-for-isc,kmoocdev/edx-platform,nagyistoce/edx-platform,nanolearningllc/edx-platform-cypress-2,kmoocdev/edx-platform,Endika/edx-platform,ahmadio/edx-platform,cpennington/edx-platform,sameetb-cuelogic/edx-platform-test,appsembler/edx-platform,MakeHer/edx-platform,antoviaque/edx-platform,dkarakats/edx-platform,xingyepei/edx-platform,kxliugang/edx-platform,teltek/edx-platform,WatanabeYasumasa/edx-platform,LICEF/edx-platform,B-MOOC/edx-platform,EduPepperPDTesting/pepper2013-testing,OmarIthawi/edx-platform,ZLLab-Mooc/edx-platform,chauhanhardik/populo_2,chudaol/edx-platform,PepperPD/edx-pepper-platform,inares/edx-platform,deepsrijit1105/edx-platform,valtech-mooc/edx-platform,dsajkl/123,jolyonb/edx-platform,eemirtekin/edx-platform,atsolakid/edx-platform,mjirayu/sit_academy,abdoosh00/edraak,zubair-arbi/edx-platform,nikolas/edx-platform,jjmiranda/edx-platform,mcgachey/edx-platform,bdero/edx-platform,yokose-ks/edx-platform,kmoocdev/edx-platform,4eek/edx-platform,xuxiao19910803/edx-platform,fintech-circle/edx-platform,doganov/edx-platform,IONISx/edx-platform,bdero/edx-platform,rismalrv/edx-platform,sameetb-cuelogic/edx-platform-test,lduarte1991/edx-platform,jruiperezv/ANALYSE,bdero/edx-platform,vismartltd/edx-platform,bigdatauniversity/edx-platform,ahmadiga/min_edx,motion2015/a3,kalebhartje/schoolboost,UOMx/edx-platform,IONISx/edx-platform,B-MOOC/edx-platform,zhenzhai/edx-platform,pku9104038/edx-platform,mitocw/edx-platform,tiagochiavericosta/edx-platform,pku9104038/edx-platform,mjirayu/sit_academy,shashank971/edx-platform,etzhou/edx-platform,IONISx/edx-platform,unicri/edx-platform,iivic/BoiseStateX,naresh21/synergetics-edx-platform,rationalAgent/edx-platform-custom,rismalrv/edx-platform,jzoldak/edx-platform,gymnasium/edx-platform,deepsrijit1105/edx-platform,cognitiveclass/edx-platform,ZLLab-Mooc/edx-platform,MSOpenTech/edx-platform,cselis86/edx-platform,PepperPD/edx-pepper-platform,eduNEXT/edunext-platform,olexiim/edx-platform,nttks/jenkins-test,auferack08/edx-platform,EduPepperPD/pepper2013,antoviaque/edx-platform,simbs/edx-platform,kamalx/edx-platform,shabab12/edx-platform,playm2mboy/edx-platform,pdehaye/theming-edx-platform,solashirai/edx-platform,valtech-mooc/edx-platform,utecuy/edx-platform,arifsetiawan/edx-platform,4eek/edx-platform,nanolearningllc/edx-platform-cypress,xinjiguaike/edx-platform,dsajkl/123,nanolearningllc/edx-platform-cypress-2,xingyepei/edx-platform,beacloudgenius/edx-platform,rationalAgent/edx-platform-custom,jamesblunt/edx-platform,Softmotions/edx-platform,EduPepperPD/pepper2013,AkA84/edx-platform,waheedahmed/edx-platform,hkawasaki/kawasaki-aio8-1,longmen21/edx-platform,unicri/edx-platform,jonathan-beard/edx-platform,tiagochiavericosta/edx-platform,romain-li/edx-platform,benpatterson/edx-platform,OmarIthawi/edx-platform,antonve/s4-project-mooc,ESOedX/edx-platform,jbassen/edx-platform,appliedx/edx-platform,vismartltd/edx-platform,antonve/s4-project-mooc,itsjeyd/edx-platform,xingyepei/edx-platform,eemirtekin/edx-platform,WatanabeYasumasa/edx-platform,LICEF/edx-platform,CredoReference/edx-platform,kursitet/edx-platform,UXE/local-edx,caesar2164/edx-platform,openfun/edx-platform,carsongee/edx-platform,PepperPD/edx-pepper-platform,BehavioralInsightsTeam/edx-platform,mitocw/edx-platform,shurihell/testasia,shashank971/edx-platform,alexthered/kienhoc-platform,olexiim/edx-platform,procangroup/edx-platform,SravanthiSinha/edx-platform,Livit/Livit.Learn.EdX,devs1991/test_edx_docmode,caesar2164/edx-platform,motion2015/edx-platform,motion2015/edx-platform,mushtaqak/edx-platform,eemirtekin/edx-platform,ovnicraft/edx-platform,WatanabeYasumasa/edx-platform,ampax/edx-platform,inares/edx-platform,Stanford-Online/edx-platform,romain-li/edx-platform,inares/edx-platform,Edraak/circleci-edx-platform,peterm-itr/edx-platform,abdoosh00/edraak,dcosentino/edx-platform,Shrhawk/edx-platform,kxliugang/edx-platform,zofuthan/edx-platform,stvstnfrd/edx-platform,antonve/s4-project-mooc,fly19890211/edx-platform,ampax/edx-platform,kmoocdev2/edx-platform,beni55/edx-platform,jbzdak/edx-platform,AkA84/edx-platform,jazkarta/edx-platform-for-isc,knehez/edx-platform,ZLLab-Mooc/edx-platform,torchingloom/edx-platform,leansoft/edx-platform,RPI-OPENEDX/edx-platform,deepsrijit1105/edx-platform,cognitiveclass/edx-platform,raccoongang/edx-platform,antonve/s4-project-mooc,louyihua/edx-platform,J861449197/edx-platform,kxliugang/edx-platform,praveen-pal/edx-platform,SivilTaram/edx-platform,ak2703/edx-platform,Lektorium-LLC/edx-platform,knehez/edx-platform,zadgroup/edx-platform,etzhou/edx-platform,Lektorium-LLC/edx-platform,valtech-mooc/edx-platform,jjmiranda/edx-platform,jamiefolsom/edx-platform,franosincic/edx-platform,hamzehd/edx-platform,xinjiguaike/edx-platform,shabab12/edx-platform,hamzehd/edx-platform,msegado/edx-platform,arifsetiawan/edx-platform,jswope00/GAI,mahendra-r/edx-platform,franosincic/edx-platform,rismalrv/edx-platform,chrisndodge/edx-platform,CourseTalk/edx-platform,doganov/edx-platform,unicri/edx-platform,jswope00/GAI,Stanford-Online/edx-platform,hastexo/edx-platform,utecuy/edx-platform,nttks/edx-platform,UXE/local-edx,wwj718/edx-platform,vikas1885/test1,abdoosh00/edx-rtl-final,xuxiao19910803/edx-platform,IndonesiaX/edx-platform,zerobatu/edx-platform,ampax/edx-platform-backup,doganov/edx-platform,ZLLab-Mooc/edx-platform,louyihua/edx-platform,vasyarv/edx-platform,yokose-ks/edx-platform,zadgroup/edx-platform,JioEducation/edx-platform,ovnicraft/edx-platform,devs1991/test_edx_docmode,Edraak/circleci-edx-platform,doismellburning/edx-platform,inares/edx-platform,sameetb-cuelogic/edx-platform-test,Shrhawk/edx-platform,morenopc/edx-platform,jolyonb/edx-platform,kxliugang/edx-platform,ovnicraft/edx-platform,shashank971/edx-platform,praveen-pal/edx-platform,LearnEra/LearnEraPlaftform,jbassen/edx-platform,10clouds/edx-platform,xuxiao19910803/edx,prarthitm/edxplatform,defance/edx-platform,UXE/local-edx,doismellburning/edx-platform,chand3040/cloud_that,IITBinterns13/edx-platform-dev,Kalyzee/edx-platform,tiagochiavericosta/edx-platform,don-github/edx-platform,Semi-global/edx-platform,kmoocdev2/edx-platform,playm2mboy/edx-platform,mtlchun/edx,martynovp/edx-platform,vikas1885/test1,cselis86/edx-platform,edx-solutions/edx-platform,franosincic/edx-platform,franosincic/edx-platform,nanolearningllc/edx-platform-cypress,Shrhawk/edx-platform,chauhanhardik/populo,inares/edx-platform,iivic/BoiseStateX,a-parhom/edx-platform,philanthropy-u/edx-platform,hmcmooc/muddx-platform,eestay/edx-platform,Unow/edx-platform,antonve/s4-project-mooc,don-github/edx-platform,kursitet/edx-platform,JCBarahona/edX,atsolakid/edx-platform,a-parhom/edx-platform,vasyarv/edx-platform,edx-solutions/edx-platform,zubair-arbi/edx-platform,apigee/edx-platform,kalebhartje/schoolboost,arifsetiawan/edx-platform,halvertoluke/edx-platform,jazkarta/edx-platform,ovnicraft/edx-platform,olexiim/edx-platform,Softmotions/edx-platform,kamalx/edx-platform,andyzsf/edx,vasyarv/edx-platform,mcgachey/edx-platform,valtech-mooc/edx-platform,shubhdev/openedx,openfun/edx-platform,unicri/edx-platform,chauhanhardik/populo_2,nagyistoce/edx-platform,Semi-global/edx-platform,SravanthiSinha/edx-platform,a-parhom/edx-platform,alexthered/kienhoc-platform,cognitiveclass/edx-platform,miptliot/edx-platform,eduNEXT/edx-platform,JCBarahona/edX,shurihell/testasia,fintech-circle/edx-platform,jonathan-beard/edx-platform,LICEF/edx-platform,hastexo/edx-platform,morenopc/edx-platform,simbs/edx-platform,longmen21/edx-platform,4eek/edx-platform,fintech-circle/edx-platform,solashirai/edx-platform,mjg2203/edx-platform-seas,martynovp/edx-platform,AkA84/edx-platform,kamalx/edx-platform,solashirai/edx-platform,fly19890211/edx-platform,arbrandes/edx-platform,jzoldak/edx-platform,pepeportela/edx-platform,morenopc/edx-platform,xuxiao19910803/edx,UOMx/edx-platform,pelikanchik/edx-platform,Livit/Livit.Learn.EdX,miptliot/edx-platform,pomegranited/edx-platform,abdoosh00/edx-rtl-final,jazztpt/edx-platform,shashank971/edx-platform,chudaol/edx-platform,antoviaque/edx-platform,IITBinterns13/edx-platform-dev,IndonesiaX/edx-platform,sameetb-cuelogic/edx-platform-test,SivilTaram/edx-platform,jswope00/griffinx,Edraak/edx-platform,kmoocdev2/edx-platform,EduPepperPDTesting/pepper2013-testing,IndonesiaX/edx-platform,appliedx/edx-platform,DefyVentures/edx-platform,alexthered/kienhoc-platform,jelugbo/tundex,Softmotions/edx-platform,beni55/edx-platform,analyseuc3m/ANALYSE-v1,syjeon/new_edx,pku9104038/edx-platform,nttks/edx-platform,Lektorium-LLC/edx-platform,nikolas/edx-platform,Endika/edx-platform,edx/edx-platform,mbareta/edx-platform-ft,pabloborrego93/edx-platform,EduPepperPDTesting/pepper2013-testing,antoviaque/edx-platform,cselis86/edx-platform,jjmiranda/edx-platform,zerobatu/edx-platform,simbs/edx-platform,peterm-itr/edx-platform,Endika/edx-platform,bitifirefly/edx-platform,DefyVentures/edx-platform,xinjiguaike/edx-platform,ubc/edx-platform,vasyarv/edx-platform,jazkarta/edx-platform,dcosentino/edx-platform,arbrandes/edx-platform,MakeHer/edx-platform,hkawasaki/kawasaki-aio8-2,doismellburning/edx-platform,Unow/edx-platform,J861449197/edx-platform,gsehub/edx-platform,cpennington/edx-platform,ahmadiga/min_edx,pelikanchik/edx-platform,hamzehd/edx-platform,proversity-org/edx-platform,etzhou/edx-platform,fly19890211/edx-platform,SivilTaram/edx-platform,eduNEXT/edx-platform,tanmaykm/edx-platform,AkA84/edx-platform,jonathan-beard/edx-platform,alu042/edx-platform,ahmadiga/min_edx,appliedx/edx-platform,mahendra-r/edx-platform,gymnasium/edx-platform,jzoldak/edx-platform,xuxiao19910803/edx,ferabra/edx-platform,vasyarv/edx-platform,pepeportela/edx-platform,JCBarahona/edX,polimediaupv/edx-platform,kalebhartje/schoolboost,praveen-pal/edx-platform,ahmadiga/min_edx,waheedahmed/edx-platform,EduPepperPD/pepper2013,mjg2203/edx-platform-seas,mitocw/edx-platform,jazkarta/edx-platform-for-isc,xingyepei/edx-platform,edry/edx-platform,zhenzhai/edx-platform,openfun/edx-platform,hkawasaki/kawasaki-aio8-1,zubair-arbi/edx-platform,torchingloom/edx-platform,mtlchun/edx,philanthropy-u/edx-platform,mcgachey/edx-platform,polimediaupv/edx-platform,dsajkl/123,ubc/edx-platform,jolyonb/edx-platform,nanolearningllc/edx-platform-cypress-2,J861449197/edx-platform,zofuthan/edx-platform,JCBarahona/edX,bitifirefly/edx-platform,devs1991/test_edx_docmode,mcgachey/edx-platform,yokose-ks/edx-platform,y12uc231/edx-platform,andyzsf/edx,hkawasaki/kawasaki-aio8-0,cpennington/edx-platform,mitocw/edx-platform,jamiefolsom/edx-platform,DNFcode/edx-platform,kmoocdev/edx-platform,abdoosh00/edraak,marcore/edx-platform,beni55/edx-platform,jbassen/edx-platform,Softmotions/edx-platform,praveen-pal/edx-platform,longmen21/edx-platform,EduPepperPD/pepper2013,playm2mboy/edx-platform,Livit/Livit.Learn.EdX,tiagochiavericosta/edx-platform,ahmedaljazzar/edx-platform,edx/edx-platform,shubhdev/edxOnBaadal,Kalyzee/edx-platform,nagyistoce/edx-platform,prarthitm/edxplatform,shubhdev/edxOnBaadal,zadgroup/edx-platform,hkawasaki/kawasaki-aio8-0,bigdatauniversity/edx-platform,openfun/edx-platform,OmarIthawi/edx-platform,hmcmooc/muddx-platform,kalebhartje/schoolboost,mushtaqak/edx-platform,knehez/edx-platform,auferack08/edx-platform,knehez/edx-platform,wwj718/ANALYSE,jruiperezv/ANALYSE,nanolearning/edx-platform,SravanthiSinha/edx-platform,CredoReference/edx-platform,rue89-tech/edx-platform,CourseTalk/edx-platform,LICEF/edx-platform,UOMx/edx-platform,nikolas/edx-platform,rue89-tech/edx-platform,adoosii/edx-platform,prarthitm/edxplatform,amir-qayyum-khan/edx-platform,louyihua/edx-platform,sudheerchintala/LearnEraPlatForm,chand3040/cloud_that,beacloudgenius/edx-platform,teltek/edx-platform,wwj718/ANALYSE,Ayub-Khan/edx-platform,PepperPD/edx-pepper-platform,mbareta/edx-platform-ft,edry/edx-platform,rismalrv/edx-platform,pdehaye/theming-edx-platform,dkarakats/edx-platform,edx-solutions/edx-platform,Edraak/circleci-edx-platform,gymnasium/edx-platform,doganov/edx-platform,itsjeyd/edx-platform,bitifirefly/edx-platform,adoosii/edx-platform,synergeticsedx/deployment-wipro,DNFcode/edx-platform,jamesblunt/edx-platform,edry/edx-platform,Ayub-Khan/edx-platform,hkawasaki/kawasaki-aio8-2,lduarte1991/edx-platform,analyseuc3m/ANALYSE-v1,pabloborrego93/edx-platform,peterm-itr/edx-platform,itsjeyd/edx-platform,shurihell/testasia,alu042/edx-platform,bigdatauniversity/edx-platform,Kalyzee/edx-platform,pdehaye/theming-edx-platform,analyseuc3m/ANALYSE-v1,carsongee/edx-platform,caesar2164/edx-platform,dkarakats/edx-platform,LICEF/edx-platform,rationalAgent/edx-platform-custom,beacloudgenius/edx-platform,prarthitm/edxplatform,msegado/edx-platform,hkawasaki/kawasaki-aio8-1,waheedahmed/edx-platform,RPI-OPENEDX/edx-platform,EduPepperPD/pepper2013,mushtaqak/edx-platform,eduNEXT/edx-platform,edx/edx-platform,halvertoluke/edx-platform,pabloborrego93/edx-platform,EduPepperPDTesting/pepper2013-testing,pelikanchik/edx-platform,benpatterson/edx-platform,hkawasaki/kawasaki-aio8-0,bdero/edx-platform,nttks/edx-platform,pomegranited/edx-platform,devs1991/test_edx_docmode,dkarakats/edx-platform,SivilTaram/edx-platform,motion2015/edx-platform,Ayub-Khan/edx-platform,jamiefolsom/edx-platform,edx-solutions/edx-platform,jbzdak/edx-platform,philanthropy-u/edx-platform,Kalyzee/edx-platform,carsongee/edx-platform,edry/edx-platform,Stanford-Online/edx-platform,tanmaykm/edx-platform,valtech-mooc/edx-platform,DefyVentures/edx-platform,MSOpenTech/edx-platform,jamesblunt/edx-platform,nanolearningllc/edx-platform-cypress,torchingloom/edx-platform,Edraak/edx-platform,ferabra/edx-platform,10clouds/edx-platform,ESOedX/edx-platform,shubhdev/edx-platform,morpheby/levelup-by,mushtaqak/edx-platform,vikas1885/test1,Edraak/edx-platform,CourseTalk/edx-platform,defance/edx-platform,mbareta/edx-platform-ft,Edraak/edx-platform,edx/edx-platform,dsajkl/reqiop,stvstnfrd/edx-platform,zubair-arbi/edx-platform,jelugbo/tundex,rhndg/openedx,Endika/edx-platform,sudheerchintala/LearnEraPlatForm,TeachAtTUM/edx-platform,mtlchun/edx,mcgachey/edx-platform,tanmaykm/edx-platform,shubhdev/edx-platform,shurihell/testasia,ferabra/edx-platform,abdoosh00/edx-rtl-final,pomegranited/edx-platform,waheedahmed/edx-platform,SravanthiSinha/edx-platform,hamzehd/edx-platform,syjeon/new_edx,angelapper/edx-platform,IndonesiaX/edx-platform,B-MOOC/edx-platform,xuxiao19910803/edx-platform,playm2mboy/edx-platform,Shrhawk/edx-platform,xuxiao19910803/edx,don-github/edx-platform,nanolearning/edx-platform,mbareta/edx-platform-ft,auferack08/edx-platform,andyzsf/edx,hkawasaki/kawasaki-aio8-2,pelikanchik/edx-platform,adoosii/edx-platform,alu042/edx-platform,jruiperezv/ANALYSE,nttks/jenkins-test,abdoosh00/edraak,edry/edx-platform,naresh21/synergetics-edx-platform,EduPepperPDTesting/pepper2013-testing,wwj718/edx-platform,doismellburning/edx-platform,solashirai/edx-platform,jswope00/GAI,auferack08/edx-platform,olexiim/edx-platform,MakeHer/edx-platform,abdoosh00/edx-rtl-final,motion2015/a3,cyanna/edx-platform,alexthered/kienhoc-platform,Edraak/edraak-platform,procangroup/edx-platform,cecep-edu/edx-platform,openfun/edx-platform,4eek/edx-platform,nttks/jenkins-test,miptliot/edx-platform,proversity-org/edx-platform,tiagochiavericosta/edx-platform,apigee/edx-platform,nikolas/edx-platform,RPI-OPENEDX/edx-platform,IndonesiaX/edx-platform,nanolearningllc/edx-platform-cypress-2,morpheby/levelup-by,gymnasium/edx-platform,SivilTaram/edx-platform,shubhdev/openedx,jazkarta/edx-platform,proversity-org/edx-platform,arbrandes/edx-platform,nanolearningllc/edx-platform-cypress,hkawasaki/kawasaki-aio8-1,vikas1885/test1,fintech-circle/edx-platform,IITBinterns13/edx-platform-dev,y12uc231/edx-platform,cecep-edu/edx-platform | html | ## Code Before:
<%!
from django.core.urlresolvers import reverse
%>
<%def name="make_chapter(chapter)">
<h3><a href="#">${chapter['name']}</a></h3>
<ul>
% for section in chapter['sections']:
<li
% if 'active' in section and section['active']:
class="active"
% endif
>
<a href="${reverse('courseware_section', args=format_url_params([course_name, chapter['name'], section['name']]))}">
<p>${section['name']}</p>
<p class="subtitle">
${section['format']}
% if 'due' in section and section['due']!="":
due ${section['due']}
% endif
</p>
</a>
% endfor
</ul>
</%def>
% for chapter in toc:
${make_chapter(chapter)}
% endfor
## Instruction:
Use inline if-else to cleanup HTML
The result from the normal if-else block has linebreak, which result in
poorly formatted HTML code. This should fix it and make the code looks
cleaner.
## Code After:
<%!
from django.core.urlresolvers import reverse
%>
<%def name="make_chapter(chapter)">
<h3><a href="#">${chapter['name']}</a></h3>
<ul>
% for section in chapter['sections']:
<li${' class="active"' if 'active' in section and section['active'] else ''}>
<a href="${reverse('courseware_section', args=format_url_params([course_name, chapter['name'], section['name']]))}">
<p>${section['name']}</p>
<p class="subtitle">
${section['format']} ${"due " + section['due'] if 'due' in section and section['due'] != '' else ''}
</p>
</a>
% endfor
</ul>
</%def>
% for chapter in toc:
${make_chapter(chapter)}
% endfor
| <%!
from django.core.urlresolvers import reverse
%>
<%def name="make_chapter(chapter)">
<h3><a href="#">${chapter['name']}</a></h3>
<ul>
% for section in chapter['sections']:
- <li
- % if 'active' in section and section['active']:
? ^^ ^
+ <li${' class="active"' if 'active' in section and section['active'] else ''}>
? ++++++ ^^^^^^^^^^^^^^^ ^^^^^^^^^^
- class="active"
- % endif
- >
-
<a href="${reverse('courseware_section', args=format_url_params([course_name, chapter['name'], section['name']]))}">
<p>${section['name']}</p>
<p class="subtitle">
+ ${section['format']} ${"due " + section['due'] if 'due' in section and section['due'] != '' else ''}
- ${section['format']}
-
- % if 'due' in section and section['due']!="":
- due ${section['due']}
- % endif
</p>
</a>
% endfor
</ul>
</%def>
% for chapter in toc:
${make_chapter(chapter)}
% endfor | 13 | 0.393939 | 2 | 11 |
45c27591bb98a2551825f23d917d264564a94ce3 | config/routes.rb | config/routes.rb | Rails.application.routes.draw do
root "home#index"
devise_for :users
end
| Rails.application.routes.draw do
root "home#index"
devise_for :users
resources :notebooks
end
| Add notebooks as a new resource | Add notebooks as a new resource
| Ruby | mit | mrkjlchvz/budget_tracker,mrkjlchvz/budget_tracker | ruby | ## Code Before:
Rails.application.routes.draw do
root "home#index"
devise_for :users
end
## Instruction:
Add notebooks as a new resource
## Code After:
Rails.application.routes.draw do
root "home#index"
devise_for :users
resources :notebooks
end
| Rails.application.routes.draw do
root "home#index"
devise_for :users
+
+ resources :notebooks
end | 2 | 0.4 | 2 | 0 |
000bbaa8154bfafeda8bd4c18884f0f0051cb146 | examples/language_services/package.json | examples/language_services/package.json | {
"name": "json_editor_services",
"version": "0.1.0",
"license": " Apache-2.0",
"dependencies": {
"chevrotain": "*",
"lodash": "~4.17.4",
"xregexp": "^3.1.1"
},
"devDependencies": {
"@types/chai": "^3.4.34",
"@types/lodash": "^4.14.48",
"@types/mocha": "^2.2.37",
"@types/node": "^6.0.59",
"chai": "^3.5.0",
"grunt": "^1.0.1",
"grunt-cli": "~1.2.0",
"grunt-contrib-clean": "^1.0.0",
"grunt-contrib-concat": "^1.0.1",
"grunt-mocha-istanbul": "^5.0.2",
"grunt-run": "^0.6.0",
"grunt-tslint": "~4.0.0",
"grunt-typings": "^0.1.5",
"istanbul": "^0.4.5",
"load-grunt-tasks": "^3.5.2",
"mocha": "^3.2.0",
"tslint": "^4.3.1",
"typescript": "~2.1.4"
},
"scripts": {
"test": "grunt test"
},
"private": true
}
| {
"name": "json_editor_services",
"version": "0.1.0",
"license": " Apache-2.0",
"dependencies": {
"chevrotain": "*",
"lodash": "~4.17.4",
"xregexp": "^3.1.1"
},
"devDependencies": {
"@types/chai": "^3.4.35",
"@types/lodash": "^4.14.57",
"@types/mocha": "^2.2.40",
"@types/node": "^7.0.9",
"chai": "^3.5.0",
"grunt": "^1.0.1",
"grunt-cli": "~1.2.0",
"grunt-contrib-clean": "^1.0.0",
"grunt-contrib-concat": "^1.0.1",
"grunt-mocha-istanbul": "^5.0.2",
"grunt-run": "^0.6.0",
"grunt-tslint": "~4.0.1",
"grunt-typings": "^0.1.5",
"istanbul": "^0.4.5",
"load-grunt-tasks": "^3.5.2",
"mocha": "^3.2.0",
"tslint": "^4.5.1",
"typescript": "~2.2.1"
},
"scripts": {
"test": "grunt test"
},
"private": true
}
| Update example project's dev deps to avoid failing build. | Update example project's dev deps to avoid failing build.
| JSON | apache-2.0 | SAP/chevrotain,SAP/chevrotain,SAP/chevrotain,SAP/chevrotain | json | ## Code Before:
{
"name": "json_editor_services",
"version": "0.1.0",
"license": " Apache-2.0",
"dependencies": {
"chevrotain": "*",
"lodash": "~4.17.4",
"xregexp": "^3.1.1"
},
"devDependencies": {
"@types/chai": "^3.4.34",
"@types/lodash": "^4.14.48",
"@types/mocha": "^2.2.37",
"@types/node": "^6.0.59",
"chai": "^3.5.0",
"grunt": "^1.0.1",
"grunt-cli": "~1.2.0",
"grunt-contrib-clean": "^1.0.0",
"grunt-contrib-concat": "^1.0.1",
"grunt-mocha-istanbul": "^5.0.2",
"grunt-run": "^0.6.0",
"grunt-tslint": "~4.0.0",
"grunt-typings": "^0.1.5",
"istanbul": "^0.4.5",
"load-grunt-tasks": "^3.5.2",
"mocha": "^3.2.0",
"tslint": "^4.3.1",
"typescript": "~2.1.4"
},
"scripts": {
"test": "grunt test"
},
"private": true
}
## Instruction:
Update example project's dev deps to avoid failing build.
## Code After:
{
"name": "json_editor_services",
"version": "0.1.0",
"license": " Apache-2.0",
"dependencies": {
"chevrotain": "*",
"lodash": "~4.17.4",
"xregexp": "^3.1.1"
},
"devDependencies": {
"@types/chai": "^3.4.35",
"@types/lodash": "^4.14.57",
"@types/mocha": "^2.2.40",
"@types/node": "^7.0.9",
"chai": "^3.5.0",
"grunt": "^1.0.1",
"grunt-cli": "~1.2.0",
"grunt-contrib-clean": "^1.0.0",
"grunt-contrib-concat": "^1.0.1",
"grunt-mocha-istanbul": "^5.0.2",
"grunt-run": "^0.6.0",
"grunt-tslint": "~4.0.1",
"grunt-typings": "^0.1.5",
"istanbul": "^0.4.5",
"load-grunt-tasks": "^3.5.2",
"mocha": "^3.2.0",
"tslint": "^4.5.1",
"typescript": "~2.2.1"
},
"scripts": {
"test": "grunt test"
},
"private": true
}
| {
"name": "json_editor_services",
"version": "0.1.0",
"license": " Apache-2.0",
"dependencies": {
"chevrotain": "*",
"lodash": "~4.17.4",
"xregexp": "^3.1.1"
},
"devDependencies": {
- "@types/chai": "^3.4.34",
? ^
+ "@types/chai": "^3.4.35",
? ^
- "@types/lodash": "^4.14.48",
? ^^
+ "@types/lodash": "^4.14.57",
? ^^
- "@types/mocha": "^2.2.37",
? ^^
+ "@types/mocha": "^2.2.40",
? ^^
- "@types/node": "^6.0.59",
? ^ -
+ "@types/node": "^7.0.9",
? ^
"chai": "^3.5.0",
"grunt": "^1.0.1",
"grunt-cli": "~1.2.0",
"grunt-contrib-clean": "^1.0.0",
"grunt-contrib-concat": "^1.0.1",
"grunt-mocha-istanbul": "^5.0.2",
"grunt-run": "^0.6.0",
- "grunt-tslint": "~4.0.0",
? ^
+ "grunt-tslint": "~4.0.1",
? ^
"grunt-typings": "^0.1.5",
"istanbul": "^0.4.5",
"load-grunt-tasks": "^3.5.2",
"mocha": "^3.2.0",
- "tslint": "^4.3.1",
? ^
+ "tslint": "^4.5.1",
? ^
- "typescript": "~2.1.4"
? --
+ "typescript": "~2.2.1"
? ++
},
"scripts": {
"test": "grunt test"
},
"private": true
} | 14 | 0.411765 | 7 | 7 |
5edb079375fb9184327ae7bb9da0cf995a5fe8c9 | .travis.yml | .travis.yml | sudo: false
language: node_js
cache:
- directories:
- node_modules
node_js:
- '0.10'
before_script:
- npm install -g gulp
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
script: gulp ci
| sudo: false
language: node_js
cache:
- directories:
- node_modules
node_js:
- '0.10'
before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
script: ./node_modules/.bin/gulp ci
| Use local gulp instead of global install. | Use local gulp instead of global install.
| YAML | mit | petejohanson/hy-res | yaml | ## Code Before:
sudo: false
language: node_js
cache:
- directories:
- node_modules
node_js:
- '0.10'
before_script:
- npm install -g gulp
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
script: gulp ci
## Instruction:
Use local gulp instead of global install.
## Code After:
sudo: false
language: node_js
cache:
- directories:
- node_modules
node_js:
- '0.10'
before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
script: ./node_modules/.bin/gulp ci
| sudo: false
language: node_js
cache:
- directories:
- node_modules
node_js:
- '0.10'
before_script:
- - npm install -g gulp
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- script: gulp ci
+ script: ./node_modules/.bin/gulp ci | 3 | 0.25 | 1 | 2 |
01af8e8d2a56243de944c3227e306729e2a44086 | src/media/processing/yuyvtoyuv420.cpp | src/media/processing/yuyvtoyuv420.cpp |
YUYVtoYUV420::YUYVtoYUV420(QString id, StatisticsInterface *stats,
std::shared_ptr<HWResourceManager> hwResources) :
Filter(id, "YUYVtoYUV420", stats, hwResources, YUYVVIDEO, YUV420VIDEO)
{}
void YUYVtoYUV420::process()
{
std::unique_ptr<Data> input = getInput();
while(input)
{
uint32_t finalDataSize = input->width*input->height*2;
std::unique_ptr<uchar[]> yuyv_frame(new uchar[finalDataSize]);
yuyv2yuv420_cpu(input->data.get(), yuyv_frame.get(), input->width, input->height);
input->type = YUYVVIDEO;
input->data = std::move(yuyv_frame);
input->data_size = finalDataSize;
sendOutput(std::move(input));
input = getInput();
}
}
void YUYVtoYUV420::yuyv2yuv420_cpu(uint8_t* input, uint8_t* output,
uint16_t width, uint16_t height)
{
}
|
YUYVtoYUV420::YUYVtoYUV420(QString id, StatisticsInterface *stats,
std::shared_ptr<HWResourceManager> hwResources) :
Filter(id, "YUYVtoYUV420", stats, hwResources, YUYVVIDEO, YUV420VIDEO)
{}
void YUYVtoYUV420::process()
{
std::unique_ptr<Data> input = getInput();
while(input)
{
uint32_t finalDataSize = input->width*input->height + input->width*input->height/2;
std::unique_ptr<uchar[]> yuyv_frame(new uchar[finalDataSize]);
yuyv2yuv420_cpu(input->data.get(), yuyv_frame.get(), input->width, input->height);
input->type = YUYVVIDEO;
input->data = std::move(yuyv_frame);
input->data_size = finalDataSize;
sendOutput(std::move(input));
input = getInput();
}
}
void YUYVtoYUV420::yuyv2yuv420_cpu(uint8_t* input, uint8_t* output,
uint16_t width, uint16_t height)
{
// Luma pixels
for(int i = 0; i < width*height; i += 2)
{
output[i] = input[i*2];
output[i + 1] = input[i*2 + 2];
}
}
| Convert luma pixels from YUYV to YUV420 | feature(Processing): Convert luma pixels from YUYV to YUV420
Still working on chroma
| C++ | isc | ultravideo/kvazzup,ultravideo/kvazzup | c++ | ## Code Before:
YUYVtoYUV420::YUYVtoYUV420(QString id, StatisticsInterface *stats,
std::shared_ptr<HWResourceManager> hwResources) :
Filter(id, "YUYVtoYUV420", stats, hwResources, YUYVVIDEO, YUV420VIDEO)
{}
void YUYVtoYUV420::process()
{
std::unique_ptr<Data> input = getInput();
while(input)
{
uint32_t finalDataSize = input->width*input->height*2;
std::unique_ptr<uchar[]> yuyv_frame(new uchar[finalDataSize]);
yuyv2yuv420_cpu(input->data.get(), yuyv_frame.get(), input->width, input->height);
input->type = YUYVVIDEO;
input->data = std::move(yuyv_frame);
input->data_size = finalDataSize;
sendOutput(std::move(input));
input = getInput();
}
}
void YUYVtoYUV420::yuyv2yuv420_cpu(uint8_t* input, uint8_t* output,
uint16_t width, uint16_t height)
{
}
## Instruction:
feature(Processing): Convert luma pixels from YUYV to YUV420
Still working on chroma
## Code After:
YUYVtoYUV420::YUYVtoYUV420(QString id, StatisticsInterface *stats,
std::shared_ptr<HWResourceManager> hwResources) :
Filter(id, "YUYVtoYUV420", stats, hwResources, YUYVVIDEO, YUV420VIDEO)
{}
void YUYVtoYUV420::process()
{
std::unique_ptr<Data> input = getInput();
while(input)
{
uint32_t finalDataSize = input->width*input->height + input->width*input->height/2;
std::unique_ptr<uchar[]> yuyv_frame(new uchar[finalDataSize]);
yuyv2yuv420_cpu(input->data.get(), yuyv_frame.get(), input->width, input->height);
input->type = YUYVVIDEO;
input->data = std::move(yuyv_frame);
input->data_size = finalDataSize;
sendOutput(std::move(input));
input = getInput();
}
}
void YUYVtoYUV420::yuyv2yuv420_cpu(uint8_t* input, uint8_t* output,
uint16_t width, uint16_t height)
{
// Luma pixels
for(int i = 0; i < width*height; i += 2)
{
output[i] = input[i*2];
output[i + 1] = input[i*2 + 2];
}
}
|
YUYVtoYUV420::YUYVtoYUV420(QString id, StatisticsInterface *stats,
std::shared_ptr<HWResourceManager> hwResources) :
Filter(id, "YUYVtoYUV420", stats, hwResources, YUYVVIDEO, YUV420VIDEO)
{}
void YUYVtoYUV420::process()
{
std::unique_ptr<Data> input = getInput();
while(input)
{
- uint32_t finalDataSize = input->width*input->height*2;
+ uint32_t finalDataSize = input->width*input->height + input->width*input->height/2;
? +++++++++++++++ ++++++++++++++
std::unique_ptr<uchar[]> yuyv_frame(new uchar[finalDataSize]);
yuyv2yuv420_cpu(input->data.get(), yuyv_frame.get(), input->width, input->height);
input->type = YUYVVIDEO;
input->data = std::move(yuyv_frame);
input->data_size = finalDataSize;
sendOutput(std::move(input));
input = getInput();
}
}
void YUYVtoYUV420::yuyv2yuv420_cpu(uint8_t* input, uint8_t* output,
uint16_t width, uint16_t height)
{
-
+ // Luma pixels
+ for(int i = 0; i < width*height; i += 2)
+ {
+ output[i] = input[i*2];
+ output[i + 1] = input[i*2 + 2];
+ }
} | 9 | 0.272727 | 7 | 2 |
4c9c5e3eee6b2ce33692f23f28cb4654f3abc09a | spec/controllers/users_controller_spec.rb | spec/controllers/users_controller_spec.rb | require 'rails_helper'
RSpec.describe UsersController, type: :controller do
let(:testuser) { FactoryGirl.create :user }
let(:user_params) { FactoryGirl.attributes_for(:user) }
before :each do
session[:user_id] = testuser.id
end
describe "#new" do
it "renders the :new view" do
get :new
expect(response).to render_template :new
end
end
context "#create" do
it "redirects to the users profile" do
post :create, user: testuser
expect(response).to redirect_to user_path(user.id)
end
it "does not redirect with bad attributes" do
post :create, user: {username: nil , password: "wdw"}
expect(response).to redirect_to new_user_path
end
end
describe "#show" do
it "renders the show template" do
get :show, id: testuser.id
expect(response).to render_template :show
end
end
describe "#current" do
it "renders the current view template" do
get :current, user:
expect(response).to render_template :current
end
end
end
| require 'rails_helper'
RSpec.describe UsersController, type: :controller do
let(:testuser) { FactoryGirl.create :user }
let(:user_params) { FactoryGirl.attributes_for(:user) }
before :each do
session[:user_id] = testuser.id
end
describe "#new" do
it "renders the :new view" do
get :new
expect(response).to render_template :new
end
end
context "#create" do
it "redirects to the users profile" do
expect{post :create, user: FactoryGirl.attributes_for(:user)}.to change(User, :count).by(1)
end
it "does not redirect with bad attributes" do
post :create, user: {username: nil , password: "wdw"}
expect(response).to redirect_to new_user_path
end
end
describe "#show" do
it "renders the show template" do
get :show, id: testuser.id
expect(response).to render_template :show
end
end
describe "#current" do
it "renders the current view template" do
get :current, user: testuser
expect(response).to render_template :current
end
end
end
| Fix User controller spec create method | Fix User controller spec create method
| Ruby | mit | grantziolkowski/caravan,nyc-rock-doves-2015/caravan,grantziolkowski/caravan,nyc-rock-doves-2015/caravan,nyc-rock-doves-2015/caravan,bicyclethief/caravan,bicyclethief/caravan,bicyclethief/caravan,grantziolkowski/caravan | ruby | ## Code Before:
require 'rails_helper'
RSpec.describe UsersController, type: :controller do
let(:testuser) { FactoryGirl.create :user }
let(:user_params) { FactoryGirl.attributes_for(:user) }
before :each do
session[:user_id] = testuser.id
end
describe "#new" do
it "renders the :new view" do
get :new
expect(response).to render_template :new
end
end
context "#create" do
it "redirects to the users profile" do
post :create, user: testuser
expect(response).to redirect_to user_path(user.id)
end
it "does not redirect with bad attributes" do
post :create, user: {username: nil , password: "wdw"}
expect(response).to redirect_to new_user_path
end
end
describe "#show" do
it "renders the show template" do
get :show, id: testuser.id
expect(response).to render_template :show
end
end
describe "#current" do
it "renders the current view template" do
get :current, user:
expect(response).to render_template :current
end
end
end
## Instruction:
Fix User controller spec create method
## Code After:
require 'rails_helper'
RSpec.describe UsersController, type: :controller do
let(:testuser) { FactoryGirl.create :user }
let(:user_params) { FactoryGirl.attributes_for(:user) }
before :each do
session[:user_id] = testuser.id
end
describe "#new" do
it "renders the :new view" do
get :new
expect(response).to render_template :new
end
end
context "#create" do
it "redirects to the users profile" do
expect{post :create, user: FactoryGirl.attributes_for(:user)}.to change(User, :count).by(1)
end
it "does not redirect with bad attributes" do
post :create, user: {username: nil , password: "wdw"}
expect(response).to redirect_to new_user_path
end
end
describe "#show" do
it "renders the show template" do
get :show, id: testuser.id
expect(response).to render_template :show
end
end
describe "#current" do
it "renders the current view template" do
get :current, user: testuser
expect(response).to render_template :current
end
end
end
| require 'rails_helper'
RSpec.describe UsersController, type: :controller do
let(:testuser) { FactoryGirl.create :user }
let(:user_params) { FactoryGirl.attributes_for(:user) }
before :each do
session[:user_id] = testuser.id
end
describe "#new" do
it "renders the :new view" do
get :new
expect(response).to render_template :new
end
end
context "#create" do
it "redirects to the users profile" do
+ expect{post :create, user: FactoryGirl.attributes_for(:user)}.to change(User, :count).by(1)
- post :create, user: testuser
- expect(response).to redirect_to user_path(user.id)
end
it "does not redirect with bad attributes" do
post :create, user: {username: nil , password: "wdw"}
expect(response).to redirect_to new_user_path
end
end
describe "#show" do
it "renders the show template" do
get :show, id: testuser.id
expect(response).to render_template :show
end
end
describe "#current" do
it "renders the current view template" do
- get :current, user:
+ get :current, user: testuser
? +++++++++
expect(response).to render_template :current
end
end
end | 5 | 0.119048 | 2 | 3 |
1089328906118aa10ab9cbc8f28c036ddfb861bb | README.md | README.md |
Provides standardized console commands for PHP applications.
## Installation
Installation requires composer. As there are some dependency conflicts with the
latest drush release it is recommended to install the tool via consolidation/cgr.
To do so, just execute:
composer global require consolidation/cgr
export INSTALL_DIR=$HOME/.composer/global/drunomics/phapp-cli
mkdir -p $INSTALL_DIR && echo "{}" > $INSTALL_DIR/composer.json
composer --working-dir=$INSTALL_DIR config minimum-stability dev
composer --working-dir=$INSTALL_DIR config prefer-stable true
cgr drunomics/phapp-cli
Note: The code gets placed in
~/.composer/global/drunomics/phapp-cli/vendor/drunomics/phapp-cli
and the "phapp" executable is added to the bin-dir (~/.composer/vendor/bin)
automatically. If not done yet, Make sure ~/.composer/vendor/bin is in your
PATH.
## Updating
Re-run
cgr drunomics/phapp-cli
## Usage
Run `phapp list` to show a list of support commands. A few important commands
are highlighted below:
### build
- Build the project as configured in phapp.yml:
phapp build
If no build command configured, phapp will just run a composer install.
- Build a certain branch and commit the build result in `build/{{ branch }}`:
phapp build {{ branch }}
|
Provides standardized console commands for PHP applications.
## Installation
Installation requires composer. As there are some dependency conflicts with the
latest drush release it is recommended to install the tool via consolidation/cgr.
To do so, just execute:
composer global require consolidation/cgr
export INSTALL_DIR=$HOME/.composer/global/drunomics/phapp-cli
mkdir -p $INSTALL_DIR && echo "{}" > $INSTALL_DIR/composer.json
composer --working-dir=$INSTALL_DIR config minimum-stability dev
composer --working-dir=$INSTALL_DIR config prefer-stable true
~/.composer/vendor/bin/cgr drunomics/phapp-cli
Note: The code gets placed in
~/.composer/global/drunomics/phapp-cli/vendor/drunomics/phapp-cli
and the "phapp" executable is added to the bin-dir (~/.composer/vendor/bin)
automatically. If not done yet, Make sure ~/.composer/vendor/bin is in your
PATH.
## Updating
Re-run
cgr drunomics/phapp-cli
## Usage
Run `phapp list` to show a list of support commands. A few important commands
are highlighted below:
### build
- Build the project as configured in phapp.yml:
phapp build
If no build command configured, phapp will just run a composer install.
- Build a certain branch and commit the build result in `build/{{ branch }}`:
phapp build {{ branch }}
| Improve installation instructions to work if the composer bin dir is not in the PATH. | Improve installation instructions to work if the composer bin dir is not in the PATH.
| Markdown | mit | drunomics/phapp-cli | markdown | ## Code Before:
Provides standardized console commands for PHP applications.
## Installation
Installation requires composer. As there are some dependency conflicts with the
latest drush release it is recommended to install the tool via consolidation/cgr.
To do so, just execute:
composer global require consolidation/cgr
export INSTALL_DIR=$HOME/.composer/global/drunomics/phapp-cli
mkdir -p $INSTALL_DIR && echo "{}" > $INSTALL_DIR/composer.json
composer --working-dir=$INSTALL_DIR config minimum-stability dev
composer --working-dir=$INSTALL_DIR config prefer-stable true
cgr drunomics/phapp-cli
Note: The code gets placed in
~/.composer/global/drunomics/phapp-cli/vendor/drunomics/phapp-cli
and the "phapp" executable is added to the bin-dir (~/.composer/vendor/bin)
automatically. If not done yet, Make sure ~/.composer/vendor/bin is in your
PATH.
## Updating
Re-run
cgr drunomics/phapp-cli
## Usage
Run `phapp list` to show a list of support commands. A few important commands
are highlighted below:
### build
- Build the project as configured in phapp.yml:
phapp build
If no build command configured, phapp will just run a composer install.
- Build a certain branch and commit the build result in `build/{{ branch }}`:
phapp build {{ branch }}
## Instruction:
Improve installation instructions to work if the composer bin dir is not in the PATH.
## Code After:
Provides standardized console commands for PHP applications.
## Installation
Installation requires composer. As there are some dependency conflicts with the
latest drush release it is recommended to install the tool via consolidation/cgr.
To do so, just execute:
composer global require consolidation/cgr
export INSTALL_DIR=$HOME/.composer/global/drunomics/phapp-cli
mkdir -p $INSTALL_DIR && echo "{}" > $INSTALL_DIR/composer.json
composer --working-dir=$INSTALL_DIR config minimum-stability dev
composer --working-dir=$INSTALL_DIR config prefer-stable true
~/.composer/vendor/bin/cgr drunomics/phapp-cli
Note: The code gets placed in
~/.composer/global/drunomics/phapp-cli/vendor/drunomics/phapp-cli
and the "phapp" executable is added to the bin-dir (~/.composer/vendor/bin)
automatically. If not done yet, Make sure ~/.composer/vendor/bin is in your
PATH.
## Updating
Re-run
cgr drunomics/phapp-cli
## Usage
Run `phapp list` to show a list of support commands. A few important commands
are highlighted below:
### build
- Build the project as configured in phapp.yml:
phapp build
If no build command configured, phapp will just run a composer install.
- Build a certain branch and commit the build result in `build/{{ branch }}`:
phapp build {{ branch }}
|
Provides standardized console commands for PHP applications.
## Installation
Installation requires composer. As there are some dependency conflicts with the
latest drush release it is recommended to install the tool via consolidation/cgr.
To do so, just execute:
composer global require consolidation/cgr
export INSTALL_DIR=$HOME/.composer/global/drunomics/phapp-cli
mkdir -p $INSTALL_DIR && echo "{}" > $INSTALL_DIR/composer.json
composer --working-dir=$INSTALL_DIR config minimum-stability dev
composer --working-dir=$INSTALL_DIR config prefer-stable true
- cgr drunomics/phapp-cli
+ ~/.composer/vendor/bin/cgr drunomics/phapp-cli
Note: The code gets placed in
~/.composer/global/drunomics/phapp-cli/vendor/drunomics/phapp-cli
and the "phapp" executable is added to the bin-dir (~/.composer/vendor/bin)
automatically. If not done yet, Make sure ~/.composer/vendor/bin is in your
PATH.
## Updating
Re-run
cgr drunomics/phapp-cli
## Usage
Run `phapp list` to show a list of support commands. A few important commands
are highlighted below:
### build
- Build the project as configured in phapp.yml:
phapp build
If no build command configured, phapp will just run a composer install.
- Build a certain branch and commit the build result in `build/{{ branch }}`:
phapp build {{ branch }} | 2 | 0.042553 | 1 | 1 |
cede1de6fb4b1ba8baf27adc748a3cabcc4b5771 | README.md | README.md |
Job placement for everyone!
:no_entry_sign: Alpha quality party time :tada:
|
Job placement for everyone!
:no_entry_sign: Alpha quality party time :tada:
## Image API
One of the things that's queryable in job-board is image names on various
infrastructures, as not all platforms provide a native means to tag and select
images based on arbitrary criteria.
Creating an image reference:
``` bash
curl -s -X POST https://example.com/images\?infra\=gce\&tags\=org:true\&name=floo-flah-trusty-1438203722
```
Updating the image's tags:
``` bash
curl -s -X PUT https://example.com/images\?infra\=gce\&tags\=production:true,org:true\&name=floo-flah-trusty-1438203722
```
Querying for an image via `infra` and `tags`:
``` bash
curl -s https://example.com/images\?infra\=gce\&tags\=production:true,org:true | \
jq -r '.data | .[0] | .name'
# => floo-flah-trusty-1438203722
```
| Add some docs around image managament | Add some docs around image managament
| Markdown | mit | travis-ci/job-board,travis-ci/job-board | markdown | ## Code Before:
Job placement for everyone!
:no_entry_sign: Alpha quality party time :tada:
## Instruction:
Add some docs around image managament
## Code After:
Job placement for everyone!
:no_entry_sign: Alpha quality party time :tada:
## Image API
One of the things that's queryable in job-board is image names on various
infrastructures, as not all platforms provide a native means to tag and select
images based on arbitrary criteria.
Creating an image reference:
``` bash
curl -s -X POST https://example.com/images\?infra\=gce\&tags\=org:true\&name=floo-flah-trusty-1438203722
```
Updating the image's tags:
``` bash
curl -s -X PUT https://example.com/images\?infra\=gce\&tags\=production:true,org:true\&name=floo-flah-trusty-1438203722
```
Querying for an image via `infra` and `tags`:
``` bash
curl -s https://example.com/images\?infra\=gce\&tags\=production:true,org:true | \
jq -r '.data | .[0] | .name'
# => floo-flah-trusty-1438203722
```
|
Job placement for everyone!
:no_entry_sign: Alpha quality party time :tada:
+
+ ## Image API
+
+ One of the things that's queryable in job-board is image names on various
+ infrastructures, as not all platforms provide a native means to tag and select
+ images based on arbitrary criteria.
+
+ Creating an image reference:
+
+ ``` bash
+ curl -s -X POST https://example.com/images\?infra\=gce\&tags\=org:true\&name=floo-flah-trusty-1438203722
+ ```
+
+ Updating the image's tags:
+
+ ``` bash
+ curl -s -X PUT https://example.com/images\?infra\=gce\&tags\=production:true,org:true\&name=floo-flah-trusty-1438203722
+ ```
+
+ Querying for an image via `infra` and `tags`:
+
+ ``` bash
+ curl -s https://example.com/images\?infra\=gce\&tags\=production:true,org:true | \
+ jq -r '.data | .[0] | .name'
+ # => floo-flah-trusty-1438203722
+ ``` | 26 | 6.5 | 26 | 0 |
94562eda04afe8d97df3ebc0008e4b053cb52fae | README.md | README.md | Let's make a peer to peer email system! What could possibly go wrong?
Not related to node.js at all.
The test files are not included by default. You must have GPG installed. Run
the mktest.sh script to generate the test files.
| Let's make a peer to peer email system! What could possibly go wrong?
Not related to node.js at all.
The test files are not included by default. You must have GPG installed. Run
the mktest.sh script to generate the test files.
This requires python3, as it uses the new features int.from_bytes and
int.to_bytes.
| Add note to use python3 in readme.md | Add note to use python3 in readme.md
| Markdown | mit | 5225225/node,5225225/node | markdown | ## Code Before:
Let's make a peer to peer email system! What could possibly go wrong?
Not related to node.js at all.
The test files are not included by default. You must have GPG installed. Run
the mktest.sh script to generate the test files.
## Instruction:
Add note to use python3 in readme.md
## Code After:
Let's make a peer to peer email system! What could possibly go wrong?
Not related to node.js at all.
The test files are not included by default. You must have GPG installed. Run
the mktest.sh script to generate the test files.
This requires python3, as it uses the new features int.from_bytes and
int.to_bytes.
| Let's make a peer to peer email system! What could possibly go wrong?
Not related to node.js at all.
The test files are not included by default. You must have GPG installed. Run
the mktest.sh script to generate the test files.
+
+ This requires python3, as it uses the new features int.from_bytes and
+ int.to_bytes. | 3 | 0.5 | 3 | 0 |
0758423270182ca66c47e5fc78fba73e431fd18d | sass/modules/objects/_bass.modules.objects.StickyFooter.scss | sass/modules/objects/_bass.modules.objects.StickyFooter.scss | .StickyFooterContentWrapper
{
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto; // the bottom margin is the negative value of the footer's height
}
.StickyFooterPush
{
height: $default-footer-height; // '.push' must be the same height as 'footer'
@include padding-trailer(1);
} | $default-footer-height: 200px;
.StickyFooterContentWrapper
{
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto; // the bottom margin is the negative value of the footer's height
}
.StickyFooterPush
{
height: $default-footer-height; // '.push' must be the same height as 'footer'
@include padding-trailer(1);
} | Add default footer height variable | Add default footer height variable
| SCSS | mit | Undistraction/bass,Undistraction/bass,Undistraction/bass | scss | ## Code Before:
.StickyFooterContentWrapper
{
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto; // the bottom margin is the negative value of the footer's height
}
.StickyFooterPush
{
height: $default-footer-height; // '.push' must be the same height as 'footer'
@include padding-trailer(1);
}
## Instruction:
Add default footer height variable
## Code After:
$default-footer-height: 200px;
.StickyFooterContentWrapper
{
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto; // the bottom margin is the negative value of the footer's height
}
.StickyFooterPush
{
height: $default-footer-height; // '.push' must be the same height as 'footer'
@include padding-trailer(1);
} | + $default-footer-height: 200px;
+
.StickyFooterContentWrapper
{
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto; // the bottom margin is the negative value of the footer's height
}
.StickyFooterPush
{
height: $default-footer-height; // '.push' must be the same height as 'footer'
@include padding-trailer(1);
} | 2 | 0.153846 | 2 | 0 |
5f2cf0f1619c106e195bc3c70d7d6da72d5cc170 | src/Data/WorldDataManager.java | src/Data/WorldDataManager.java | package Data;
import java.util.List;
import engine.gridobject.person.Player;
import engine.item.Weapon;
import authoring.PlayerData;
import authoring.WorldData;
public class WorldDataManager {
public WorldDataManager() {}
public void saveMap(WorldData wd, String mapDataKey, Player player, String fileName) {
WorldData worldData = wd;
if (worldData == null) {
System.out.println("worldData is null");
}
PlayerData playerData = worldData.getMap(mapDataKey).getPlayData();
List<Weapon> wList = player.getWeaponList();
System.out.println("weaponlist.size" + wList.size());
String [] weaponListName = new String[wList.size()];
int wCounter = 0;
for (Weapon wep : wList) {
String wepName = wep.toString();
weaponListName[wCounter] = wepName;
wCounter++;
}
worldData.getMap(mapDataKey).getPlayData().setWeapons(weaponListName);
DataManager dm = new DataManager();
dm.setWorldData(fileName, worldData);
dm.saveWorldDataToFile(fileName);
}
}
| package Data;
import java.util.List;
import engine.gridobject.person.Player;
import engine.item.Item;
import engine.item.Weapon;
import authoring.PlayerData;
import authoring.WorldData;
public class WorldDataManager {
public WorldDataManager() {}
public void saveMap(WorldData wd, String mapDataKey, Player player, String fileName) {
WorldData worldData = wd;
if (worldData == null) {
return;
}
PlayerData playerData = worldData.getMap(mapDataKey).getPlayData();
List<Weapon> wList = player.getWeaponList();
String [] weaponListNames = new String[wList.size()];
int wCounter = 0;
for (Weapon wep : wList) {
String wepName = wep.toString();
weaponListNames[wCounter] = wepName;
wCounter++;
}
List<Item> itemList = player.getItems();
String [] itemListNames = new String[itemList.size()];
int iCounter = 0;
for (Item item : itemList) {
String itemName = item.toString();
itemListNames[iCounter] = itemName;
iCounter++;
}
worldData.getMap(mapDataKey).getPlayData().setWeapons(weaponListNames);
worldData.getMap(mapDataKey).getPlayData().setItems(itemListNames);
DataManager dm = new DataManager();
dm.setWorldData(fileName, worldData);
dm.saveWorldDataToFile(fileName);
}
}
| Save items and weapons in PlayerData | Save items and weapons in PlayerData
| Java | mit | bchao/OOGASalad,bewallyt/OOGASalad,DavisTrey/Software-Design-Final-Project,yomikaze/OOGASalad,leeweisberger/RPG-Game-Engine | java | ## Code Before:
package Data;
import java.util.List;
import engine.gridobject.person.Player;
import engine.item.Weapon;
import authoring.PlayerData;
import authoring.WorldData;
public class WorldDataManager {
public WorldDataManager() {}
public void saveMap(WorldData wd, String mapDataKey, Player player, String fileName) {
WorldData worldData = wd;
if (worldData == null) {
System.out.println("worldData is null");
}
PlayerData playerData = worldData.getMap(mapDataKey).getPlayData();
List<Weapon> wList = player.getWeaponList();
System.out.println("weaponlist.size" + wList.size());
String [] weaponListName = new String[wList.size()];
int wCounter = 0;
for (Weapon wep : wList) {
String wepName = wep.toString();
weaponListName[wCounter] = wepName;
wCounter++;
}
worldData.getMap(mapDataKey).getPlayData().setWeapons(weaponListName);
DataManager dm = new DataManager();
dm.setWorldData(fileName, worldData);
dm.saveWorldDataToFile(fileName);
}
}
## Instruction:
Save items and weapons in PlayerData
## Code After:
package Data;
import java.util.List;
import engine.gridobject.person.Player;
import engine.item.Item;
import engine.item.Weapon;
import authoring.PlayerData;
import authoring.WorldData;
public class WorldDataManager {
public WorldDataManager() {}
public void saveMap(WorldData wd, String mapDataKey, Player player, String fileName) {
WorldData worldData = wd;
if (worldData == null) {
return;
}
PlayerData playerData = worldData.getMap(mapDataKey).getPlayData();
List<Weapon> wList = player.getWeaponList();
String [] weaponListNames = new String[wList.size()];
int wCounter = 0;
for (Weapon wep : wList) {
String wepName = wep.toString();
weaponListNames[wCounter] = wepName;
wCounter++;
}
List<Item> itemList = player.getItems();
String [] itemListNames = new String[itemList.size()];
int iCounter = 0;
for (Item item : itemList) {
String itemName = item.toString();
itemListNames[iCounter] = itemName;
iCounter++;
}
worldData.getMap(mapDataKey).getPlayData().setWeapons(weaponListNames);
worldData.getMap(mapDataKey).getPlayData().setItems(itemListNames);
DataManager dm = new DataManager();
dm.setWorldData(fileName, worldData);
dm.saveWorldDataToFile(fileName);
}
}
| package Data;
import java.util.List;
import engine.gridobject.person.Player;
+ import engine.item.Item;
import engine.item.Weapon;
import authoring.PlayerData;
import authoring.WorldData;
public class WorldDataManager {
public WorldDataManager() {}
public void saveMap(WorldData wd, String mapDataKey, Player player, String fileName) {
WorldData worldData = wd;
- if (worldData == null) {
? -
+ if (worldData == null) {
- System.out.println("worldData is null");
+ return;
}
PlayerData playerData = worldData.getMap(mapDataKey).getPlayData();
List<Weapon> wList = player.getWeaponList();
- System.out.println("weaponlist.size" + wList.size());
- String [] weaponListName = new String[wList.size()];
+ String [] weaponListNames = new String[wList.size()];
? +
int wCounter = 0;
for (Weapon wep : wList) {
String wepName = wep.toString();
- weaponListName[wCounter] = wepName;
+ weaponListNames[wCounter] = wepName;
? +
wCounter++;
}
+ List<Item> itemList = player.getItems();
+ String [] itemListNames = new String[itemList.size()];
+ int iCounter = 0;
+ for (Item item : itemList) {
+ String itemName = item.toString();
+ itemListNames[iCounter] = itemName;
+ iCounter++;
-
+ }
? +
- worldData.getMap(mapDataKey).getPlayData().setWeapons(weaponListName);
+ worldData.getMap(mapDataKey).getPlayData().setWeapons(weaponListNames);
? +
+ worldData.getMap(mapDataKey).getPlayData().setItems(itemListNames);
DataManager dm = new DataManager();
dm.setWorldData(fileName, worldData);
dm.saveWorldDataToFile(fileName);
}
} | 22 | 0.594595 | 15 | 7 |
da4f4340a5a07d2a421db5d9325e9c3647b11d96 | application.rb | application.rb | require 'sinatra'
require 'rack-flash'
require 'dotenv'
require 'twilio-ruby'
# Configuration
Dotenv.load
APP_ROOT = Pathname.new(File.expand_path('../', __FILE__))
configure do
set :root, APP_ROOT.to_path
set :views, File.join(Sinatra::Application.root, "app", "views")
end
enable :sessions
use Rack::Flash
# Routing
get '/' do
erb :home
end
post '/arrived_safely' do
@client = Twilio::REST::Client.new(ENV['TWILIO_ACCOUNT_SID'], ENV['TWILIO_AUTH_TOKEN'])
p ENV['CONTACTS_ARRAY']
contacts = Hash[ENV['CONTACTS_ARRAY'].map {|key, value| [key, value]}]
p contacts
#@client.messages.create(
# from: '+12406502723',
# to: "+1#{number}",
# body: "Hi #{name}, it's Ariel. I'm sending you a text from #{location}. I just wanted to let you know I got in safe and sound :) Hope you're doing well! XOXO"
#)
flash[:success] = 'it worked'
rescue => e
flash[:error] = e.message
end
| require 'sinatra'
require 'rack-flash'
require 'dotenv'
require 'twilio-ruby'
require 'json'
# Configuration
Dotenv.load
APP_ROOT = Pathname.new(File.expand_path('../', __FILE__))
configure do
set :root, APP_ROOT.to_path
set :views, File.join(Sinatra::Application.root, "app", "views")
end
enable :sessions
use Rack::Flash
# Routing
get '/' do
@contact_names = JSON.parse(ENV['CONTACTS_ARRAY']).map { |name, number| name }
erb :home
end
post '/arrived_safely' do
client = Twilio::REST::Client.new(ENV['TWILIO_ACCOUNT_SID'], ENV['TWILIO_AUTH_TOKEN'])
contacts = Hash[JSON.parse(ENV['CONTACTS_ARRAY']).map {|key, value| [key, value]}]
location = params[:location]
begin
contacts.each do |name, number|
client.messages.create(
from: '+12406502723',
to: "+1#{number}",
body: "Hi #{name}, it's Ariel. I'm sending you a text from #{location}. I just wanted to let you know I got in safe and sound :) Hope you're doing well! XOXO"
)
end
flash[:success] = "sent a message from #{location}"
rescue => e
flash[:error] = e.message
end
end
| Add in logic to shoot off texts to fam | Add in logic to shoot off texts to fam
| Ruby | mit | afogel/iArrived,afogel/iArrived | ruby | ## Code Before:
require 'sinatra'
require 'rack-flash'
require 'dotenv'
require 'twilio-ruby'
# Configuration
Dotenv.load
APP_ROOT = Pathname.new(File.expand_path('../', __FILE__))
configure do
set :root, APP_ROOT.to_path
set :views, File.join(Sinatra::Application.root, "app", "views")
end
enable :sessions
use Rack::Flash
# Routing
get '/' do
erb :home
end
post '/arrived_safely' do
@client = Twilio::REST::Client.new(ENV['TWILIO_ACCOUNT_SID'], ENV['TWILIO_AUTH_TOKEN'])
p ENV['CONTACTS_ARRAY']
contacts = Hash[ENV['CONTACTS_ARRAY'].map {|key, value| [key, value]}]
p contacts
#@client.messages.create(
# from: '+12406502723',
# to: "+1#{number}",
# body: "Hi #{name}, it's Ariel. I'm sending you a text from #{location}. I just wanted to let you know I got in safe and sound :) Hope you're doing well! XOXO"
#)
flash[:success] = 'it worked'
rescue => e
flash[:error] = e.message
end
## Instruction:
Add in logic to shoot off texts to fam
## Code After:
require 'sinatra'
require 'rack-flash'
require 'dotenv'
require 'twilio-ruby'
require 'json'
# Configuration
Dotenv.load
APP_ROOT = Pathname.new(File.expand_path('../', __FILE__))
configure do
set :root, APP_ROOT.to_path
set :views, File.join(Sinatra::Application.root, "app", "views")
end
enable :sessions
use Rack::Flash
# Routing
get '/' do
@contact_names = JSON.parse(ENV['CONTACTS_ARRAY']).map { |name, number| name }
erb :home
end
post '/arrived_safely' do
client = Twilio::REST::Client.new(ENV['TWILIO_ACCOUNT_SID'], ENV['TWILIO_AUTH_TOKEN'])
contacts = Hash[JSON.parse(ENV['CONTACTS_ARRAY']).map {|key, value| [key, value]}]
location = params[:location]
begin
contacts.each do |name, number|
client.messages.create(
from: '+12406502723',
to: "+1#{number}",
body: "Hi #{name}, it's Ariel. I'm sending you a text from #{location}. I just wanted to let you know I got in safe and sound :) Hope you're doing well! XOXO"
)
end
flash[:success] = "sent a message from #{location}"
rescue => e
flash[:error] = e.message
end
end
| require 'sinatra'
require 'rack-flash'
require 'dotenv'
require 'twilio-ruby'
-
+ require 'json'
# Configuration
Dotenv.load
APP_ROOT = Pathname.new(File.expand_path('../', __FILE__))
configure do
set :root, APP_ROOT.to_path
set :views, File.join(Sinatra::Application.root, "app", "views")
end
enable :sessions
use Rack::Flash
# Routing
get '/' do
+ @contact_names = JSON.parse(ENV['CONTACTS_ARRAY']).map { |name, number| name }
erb :home
end
+
post '/arrived_safely' do
- @client = Twilio::REST::Client.new(ENV['TWILIO_ACCOUNT_SID'], ENV['TWILIO_AUTH_TOKEN'])
? -
+ client = Twilio::REST::Client.new(ENV['TWILIO_ACCOUNT_SID'], ENV['TWILIO_AUTH_TOKEN'])
- p ENV['CONTACTS_ARRAY']
- contacts = Hash[ENV['CONTACTS_ARRAY'].map {|key, value| [key, value]}]
+ contacts = Hash[JSON.parse(ENV['CONTACTS_ARRAY']).map {|key, value| [key, value]}]
? +++++++++++ +
- p contacts
+ location = params[:location]
+ begin
+ contacts.each do |name, number|
- #@client.messages.create(
? ^^
+ client.messages.create(
? ^^^^
- # from: '+12406502723',
? ^
+ from: '+12406502723',
? ^^^^
- # to: "+1#{number}",
? ^
+ to: "+1#{number}",
? ^^^^
- # body: "Hi #{name}, it's Ariel. I'm sending you a text from #{location}. I just wanted to let you know I got in safe and sound :) Hope you're doing well! XOXO"
? ^
+ body: "Hi #{name}, it's Ariel. I'm sending you a text from #{location}. I just wanted to let you know I got in safe and sound :) Hope you're doing well! XOXO"
? ^^^^
- #)
- flash[:success] = 'it worked'
+ )
+ end
+ flash[:success] = "sent a message from #{location}"
- rescue => e
+ rescue => e
? ++
- flash[:error] = e.message
+ flash[:error] = e.message
? ++
+ end
end | 31 | 0.911765 | 18 | 13 |
4798dbaf852a2bb2ac8bd00f4b00b202f88516a5 | .travis.yml | .travis.yml | language: ruby
cache: bundler
rvm:
- 2.1
bundler_args: "--without integration"
before_script:
- bundle exec berks
script:
- bundle exec rake travis
| language: ruby
cache: bundler
rvm:
- 2.1
bundler_args: "--without integration"
before_script:
- bundle exec berks
script:
- bundle exec rake travis
notifications:
slack:
secure: iZxnXG69lc2ud7VGcvA/wsbh/hTKVDCNLZuv2orKz9sp01a/auxkROHsR1W+reXKSqHfihzFCI5z0et6IMkc9DRUKcyVH65z9D0AIqY4ateSO2KqaGJsniksiksXJp8auDc+3wKC4QUIQ0DDtGyQpwcNAPerznp6k5zpkc8hV+8=
| Add Travis notifications to EverTrue’s Slack | Add Travis notifications to EverTrue’s Slack
| YAML | apache-2.0 | evertrue/mcrouter-cookbook | yaml | ## Code Before:
language: ruby
cache: bundler
rvm:
- 2.1
bundler_args: "--without integration"
before_script:
- bundle exec berks
script:
- bundle exec rake travis
## Instruction:
Add Travis notifications to EverTrue’s Slack
## Code After:
language: ruby
cache: bundler
rvm:
- 2.1
bundler_args: "--without integration"
before_script:
- bundle exec berks
script:
- bundle exec rake travis
notifications:
slack:
secure: iZxnXG69lc2ud7VGcvA/wsbh/hTKVDCNLZuv2orKz9sp01a/auxkROHsR1W+reXKSqHfihzFCI5z0et6IMkc9DRUKcyVH65z9D0AIqY4ateSO2KqaGJsniksiksXJp8auDc+3wKC4QUIQ0DDtGyQpwcNAPerznp6k5zpkc8hV+8=
| language: ruby
cache: bundler
rvm:
- 2.1
bundler_args: "--without integration"
before_script:
- bundle exec berks
script:
- bundle exec rake travis
+ notifications:
+ slack:
+ secure: iZxnXG69lc2ud7VGcvA/wsbh/hTKVDCNLZuv2orKz9sp01a/auxkROHsR1W+reXKSqHfihzFCI5z0et6IMkc9DRUKcyVH65z9D0AIqY4ateSO2KqaGJsniksiksXJp8auDc+3wKC4QUIQ0DDtGyQpwcNAPerznp6k5zpkc8hV+8= | 3 | 0.333333 | 3 | 0 |
269021466957575030789fc26e34aea074703dd1 | env/galaxy/host_vars/cvmfs0-tacc0.galaxyproject.org/vars.yml | env/galaxy/host_vars/cvmfs0-tacc0.galaxyproject.org/vars.yml | ---
host_authorized_key_users:
- name: g2main
authorized: "{{ galaxy_team_users }}"
cvmfs_private_keys: "{{ vault_cvmfs_private_keys }}"
cvmfs_repositories:
- repository: main.galaxyproject.org
stratum0: cvmfs0-tacc0.galaxyproject.org
owner: g2main
server_options:
- CVMFS_AUTO_TAG=false
- CVMFS_GARBAGE_COLLECTION=true
- CVMFS_AUTO_GC=false
- CVMFS_IGNORE_XDIR_HARDLINKS=true
- CVMFS_GENERATE_LEGACY_BULK_CHUNKS=false
- CVMFS_VIRTUAL_DIR=true
client_options:
- CVMFS_NFILES=4096
# old docker repo, docker now installed by the `docker` role
host_yum_repositories:
- name: dockerrepo
state: absent
#contents:
# name: Docker Repository
# state: absent
| ---
host_authorized_key_users:
- name: g2main
authorized: "{{ galaxy_team_users + ['usegalaxy_tools_travis_cvmfs0'] }}"
cvmfs_private_keys: "{{ vault_cvmfs_private_keys }}"
cvmfs_repositories:
- repository: main.galaxyproject.org
stratum0: cvmfs0-tacc0.galaxyproject.org
owner: g2main
server_options:
- CVMFS_AUTO_TAG=false
- CVMFS_GARBAGE_COLLECTION=true
- CVMFS_AUTO_GC=false
- CVMFS_IGNORE_XDIR_HARDLINKS=true
- CVMFS_GENERATE_LEGACY_BULK_CHUNKS=false
- CVMFS_VIRTUAL_DIR=true
client_options:
- CVMFS_NFILES=4096
# old docker repo, docker now installed by the `docker` role
host_yum_repositories:
- name: dockerrepo
state: absent
#contents:
# name: Docker Repository
# state: absent
| Fix access for usegalaxy-tools to main.galaxyproject.org CVMFS repo | Fix access for usegalaxy-tools to main.galaxyproject.org CVMFS repo
| YAML | mit | galaxyproject/infrastructure-playbook,galaxyproject/infrastructure-playbook | yaml | ## Code Before:
---
host_authorized_key_users:
- name: g2main
authorized: "{{ galaxy_team_users }}"
cvmfs_private_keys: "{{ vault_cvmfs_private_keys }}"
cvmfs_repositories:
- repository: main.galaxyproject.org
stratum0: cvmfs0-tacc0.galaxyproject.org
owner: g2main
server_options:
- CVMFS_AUTO_TAG=false
- CVMFS_GARBAGE_COLLECTION=true
- CVMFS_AUTO_GC=false
- CVMFS_IGNORE_XDIR_HARDLINKS=true
- CVMFS_GENERATE_LEGACY_BULK_CHUNKS=false
- CVMFS_VIRTUAL_DIR=true
client_options:
- CVMFS_NFILES=4096
# old docker repo, docker now installed by the `docker` role
host_yum_repositories:
- name: dockerrepo
state: absent
#contents:
# name: Docker Repository
# state: absent
## Instruction:
Fix access for usegalaxy-tools to main.galaxyproject.org CVMFS repo
## Code After:
---
host_authorized_key_users:
- name: g2main
authorized: "{{ galaxy_team_users + ['usegalaxy_tools_travis_cvmfs0'] }}"
cvmfs_private_keys: "{{ vault_cvmfs_private_keys }}"
cvmfs_repositories:
- repository: main.galaxyproject.org
stratum0: cvmfs0-tacc0.galaxyproject.org
owner: g2main
server_options:
- CVMFS_AUTO_TAG=false
- CVMFS_GARBAGE_COLLECTION=true
- CVMFS_AUTO_GC=false
- CVMFS_IGNORE_XDIR_HARDLINKS=true
- CVMFS_GENERATE_LEGACY_BULK_CHUNKS=false
- CVMFS_VIRTUAL_DIR=true
client_options:
- CVMFS_NFILES=4096
# old docker repo, docker now installed by the `docker` role
host_yum_repositories:
- name: dockerrepo
state: absent
#contents:
# name: Docker Repository
# state: absent
| ---
host_authorized_key_users:
- name: g2main
- authorized: "{{ galaxy_team_users }}"
+ authorized: "{{ galaxy_team_users + ['usegalaxy_tools_travis_cvmfs0'] }}"
cvmfs_private_keys: "{{ vault_cvmfs_private_keys }}"
cvmfs_repositories:
- repository: main.galaxyproject.org
stratum0: cvmfs0-tacc0.galaxyproject.org
owner: g2main
server_options:
- CVMFS_AUTO_TAG=false
- CVMFS_GARBAGE_COLLECTION=true
- CVMFS_AUTO_GC=false
- CVMFS_IGNORE_XDIR_HARDLINKS=true
- CVMFS_GENERATE_LEGACY_BULK_CHUNKS=false
- CVMFS_VIRTUAL_DIR=true
client_options:
- CVMFS_NFILES=4096
# old docker repo, docker now installed by the `docker` role
host_yum_repositories:
- name: dockerrepo
state: absent
#contents:
# name: Docker Repository
# state: absent | 2 | 0.066667 | 1 | 1 |
1a4a8ba0b2280b2d20d4373afdf59615eda5d4f1 | packages/tr/transformers-except.yaml | packages/tr/transformers-except.yaml | homepage: http://github.com/tmcgilchrist/transformers-either/
changelog-type: ''
hash: 6c12ef8e632a10440968cd541e75074bd6ef4b5ff4012677f8f8189d7b2d0df6
test-bench-deps: {}
maintainer: Tim McGilchrist <timmcgil@gmail.com>
synopsis: An Except monad transformer with
changelog: ''
basic-deps:
exceptions: ! '>=0.6 && <0.11'
base: ! '>=4.8 && <5'
text: ==1.2.*
transformers: ! '>=0.4 && <0.6'
all-versions:
- 0.1.1
author: Tim McGilchrist <timmcgil@gmail.com>
latest: 0.1.1
description-type: haddock
description: Extra pieces for working with Except
license-name: BSD-3-Clause
| homepage: http://github.com/tmcgilchrist/transformers-either/
changelog-type: ''
hash: 2ff895fd65ec9e45cbe839ef5b66e26b7d9f3fe561148993293a41e14491e625
test-bench-deps: {}
maintainer: Tim McGilchrist <timmcgil@gmail.com>
synopsis: 'An Except monad transformer with '
changelog: ''
basic-deps:
exceptions: '>=0.6 && <0.11'
base: '>=4.8 && <5'
text: ==1.2.*
transformers: '>=0.4 && <0.6'
all-versions:
- 0.1.1
- 0.1.2
author: Tim McGilchrist <timmcgil@gmail.com>
latest: 0.1.2
description-type: haddock
description: Extra pieces for working with Except
license-name: BSD-3-Clause
| Update from Hackage at 2021-07-12T12:24:42Z | Update from Hackage at 2021-07-12T12:24:42Z
| YAML | mit | commercialhaskell/all-cabal-metadata | yaml | ## Code Before:
homepage: http://github.com/tmcgilchrist/transformers-either/
changelog-type: ''
hash: 6c12ef8e632a10440968cd541e75074bd6ef4b5ff4012677f8f8189d7b2d0df6
test-bench-deps: {}
maintainer: Tim McGilchrist <timmcgil@gmail.com>
synopsis: An Except monad transformer with
changelog: ''
basic-deps:
exceptions: ! '>=0.6 && <0.11'
base: ! '>=4.8 && <5'
text: ==1.2.*
transformers: ! '>=0.4 && <0.6'
all-versions:
- 0.1.1
author: Tim McGilchrist <timmcgil@gmail.com>
latest: 0.1.1
description-type: haddock
description: Extra pieces for working with Except
license-name: BSD-3-Clause
## Instruction:
Update from Hackage at 2021-07-12T12:24:42Z
## Code After:
homepage: http://github.com/tmcgilchrist/transformers-either/
changelog-type: ''
hash: 2ff895fd65ec9e45cbe839ef5b66e26b7d9f3fe561148993293a41e14491e625
test-bench-deps: {}
maintainer: Tim McGilchrist <timmcgil@gmail.com>
synopsis: 'An Except monad transformer with '
changelog: ''
basic-deps:
exceptions: '>=0.6 && <0.11'
base: '>=4.8 && <5'
text: ==1.2.*
transformers: '>=0.4 && <0.6'
all-versions:
- 0.1.1
- 0.1.2
author: Tim McGilchrist <timmcgil@gmail.com>
latest: 0.1.2
description-type: haddock
description: Extra pieces for working with Except
license-name: BSD-3-Clause
| homepage: http://github.com/tmcgilchrist/transformers-either/
changelog-type: ''
- hash: 6c12ef8e632a10440968cd541e75074bd6ef4b5ff4012677f8f8189d7b2d0df6
+ hash: 2ff895fd65ec9e45cbe839ef5b66e26b7d9f3fe561148993293a41e14491e625
test-bench-deps: {}
maintainer: Tim McGilchrist <timmcgil@gmail.com>
- synopsis: An Except monad transformer with
+ synopsis: 'An Except monad transformer with '
? + ++
changelog: ''
basic-deps:
- exceptions: ! '>=0.6 && <0.11'
? --
+ exceptions: '>=0.6 && <0.11'
- base: ! '>=4.8 && <5'
? --
+ base: '>=4.8 && <5'
text: ==1.2.*
- transformers: ! '>=0.4 && <0.6'
? --
+ transformers: '>=0.4 && <0.6'
all-versions:
- 0.1.1
+ - 0.1.2
author: Tim McGilchrist <timmcgil@gmail.com>
- latest: 0.1.1
? ^
+ latest: 0.1.2
? ^
description-type: haddock
description: Extra pieces for working with Except
license-name: BSD-3-Clause | 13 | 0.684211 | 7 | 6 |
17ffea8e3d9c10a3997f491d1143d66c0e629d09 | src/modules/App/Routes.jsx | src/modules/App/Routes.jsx | import React, { Component } from "react";
export default Routes
| import React, { Component } from "react";
import {
Router,
Route,
IndexRoute,
hashHistory
} from "react-router";
import HomeView from '~/views/HomeView';
import ContentView from '~/views/ContentView';
import SettingsView from '~/views/SettingsView';
const Routes = () => {
return (
<Provider store={store}>
<Router history={hashHistory}>
<Route exact path="/" component={HomeView} />
<Route path='content' component={ContentView}/>
<Route path='settings' component={SettingsView}></Route>
</Router>
</Provider>
)
}
export default Routes
| Add routes incase future switch | feat: Add routes incase future switch
| JSX | mit | AdamSalma/Lurka,AdamSalma/Lurka | jsx | ## Code Before:
import React, { Component } from "react";
export default Routes
## Instruction:
feat: Add routes incase future switch
## Code After:
import React, { Component } from "react";
import {
Router,
Route,
IndexRoute,
hashHistory
} from "react-router";
import HomeView from '~/views/HomeView';
import ContentView from '~/views/ContentView';
import SettingsView from '~/views/SettingsView';
const Routes = () => {
return (
<Provider store={store}>
<Router history={hashHistory}>
<Route exact path="/" component={HomeView} />
<Route path='content' component={ContentView}/>
<Route path='settings' component={SettingsView}></Route>
</Router>
</Provider>
)
}
export default Routes
| import React, { Component } from "react";
+ import {
+ Router,
+ Route,
+ IndexRoute,
+ hashHistory
+ } from "react-router";
+
+ import HomeView from '~/views/HomeView';
+ import ContentView from '~/views/ContentView';
+ import SettingsView from '~/views/SettingsView';
+
+ const Routes = () => {
+ return (
+ <Provider store={store}>
+ <Router history={hashHistory}>
+ <Route exact path="/" component={HomeView} />
+ <Route path='content' component={ContentView}/>
+ <Route path='settings' component={SettingsView}></Route>
+ </Router>
+ </Provider>
+ )
+ }
export default Routes | 22 | 5.5 | 22 | 0 |
84a749066ae09acf10c5c50f6a8b2b141bc6eaf5 | src/sphinx/whats_new/index.rst | src/sphinx/whats_new/index.rst | .. _whats_new:
Migration guides
================
.. toctree::
:maxdepth: 1
3.0
2.3
2.2
| .. _whats_new:
What's New
==========
.. toctree::
:maxdepth: 1
3.0
2.3
2.2
| Fix What's New page title | Fix What's New page title
| reStructuredText | apache-2.0 | gatling/gatling,gatling/gatling,gatling/gatling,gatling/gatling,gatling/gatling | restructuredtext | ## Code Before:
.. _whats_new:
Migration guides
================
.. toctree::
:maxdepth: 1
3.0
2.3
2.2
## Instruction:
Fix What's New page title
## Code After:
.. _whats_new:
What's New
==========
.. toctree::
:maxdepth: 1
3.0
2.3
2.2
| .. _whats_new:
- Migration guides
+ What's New
- ================
? ------
+ ==========
.. toctree::
:maxdepth: 1
3.0
2.3
2.2 | 4 | 0.363636 | 2 | 2 |
8e27c440046653588342200c5e39be017d6aab3b | coprocess/proto/coprocess_object.proto | coprocess/proto/coprocess_object.proto | syntax = "proto3";
import "coprocess_mini_request_object.proto";
import "coprocess_session_state.proto";
import "coprocess_common.proto";
package coprocess;
message Object {
HookType hook_type = 1;
string hook_name = 2;
MiniRequestObject request = 3;
SessionState session = 4;
map<string, string> metadata = 5;
map<string, string> spec = 6;
}
service Dispatcher {
rpc Dispatch (Object) returns (Object) {}
}
| syntax = "proto3";
import "coprocess_mini_request_object.proto";
import "coprocess_session_state.proto";
import "coprocess_common.proto";
package coprocess;
message Object {
HookType hook_type = 1;
string hook_name = 2;
MiniRequestObject request = 3;
SessionState session = 4;
map<string, string> metadata = 5;
map<string, string> spec = 6;
}
message Event {
string payload = 1;
}
message EventReply {}
service Dispatcher {
rpc Dispatch (Object) returns (Object) {}
rpc DispatchEvent (Event) returns (EventReply) {}
}
| Update gRPC service definition to include DispatchEvent. | Update gRPC service definition to include DispatchEvent.
| Protocol Buffer | mpl-2.0 | nebolsin/tyk,mvdan/tyk,mvdan/tyk,mvdan/tyk,nebolsin/tyk,mvdan/tyk,lonelycode/tyk,nebolsin/tyk,nebolsin/tyk,nebolsin/tyk,mvdan/tyk,mvdan/tyk,nebolsin/tyk,nebolsin/tyk,nebolsin/tyk,mvdan/tyk,mvdan/tyk,lonelycode/tyk,lonelycode/tyk | protocol-buffer | ## Code Before:
syntax = "proto3";
import "coprocess_mini_request_object.proto";
import "coprocess_session_state.proto";
import "coprocess_common.proto";
package coprocess;
message Object {
HookType hook_type = 1;
string hook_name = 2;
MiniRequestObject request = 3;
SessionState session = 4;
map<string, string> metadata = 5;
map<string, string> spec = 6;
}
service Dispatcher {
rpc Dispatch (Object) returns (Object) {}
}
## Instruction:
Update gRPC service definition to include DispatchEvent.
## Code After:
syntax = "proto3";
import "coprocess_mini_request_object.proto";
import "coprocess_session_state.proto";
import "coprocess_common.proto";
package coprocess;
message Object {
HookType hook_type = 1;
string hook_name = 2;
MiniRequestObject request = 3;
SessionState session = 4;
map<string, string> metadata = 5;
map<string, string> spec = 6;
}
message Event {
string payload = 1;
}
message EventReply {}
service Dispatcher {
rpc Dispatch (Object) returns (Object) {}
rpc DispatchEvent (Event) returns (EventReply) {}
}
| syntax = "proto3";
import "coprocess_mini_request_object.proto";
import "coprocess_session_state.proto";
import "coprocess_common.proto";
package coprocess;
message Object {
HookType hook_type = 1;
string hook_name = 2;
MiniRequestObject request = 3;
SessionState session = 4;
map<string, string> metadata = 5;
map<string, string> spec = 6;
}
+ message Event {
+ string payload = 1;
+ }
+
+ message EventReply {}
+
service Dispatcher {
rpc Dispatch (Object) returns (Object) {}
+ rpc DispatchEvent (Event) returns (EventReply) {}
} | 7 | 0.35 | 7 | 0 |
5ae0b1f646f284303e00215b9e36e1be59bba9d5 | app/lib/application_responder.rb | app/lib/application_responder.rb | class ApplicationResponder < ActionController::Responder
# Redirects resources to the collection path (index action) instead
# of the resource path (show action) for POST/PUT/DELETE requests.
# include Responders::CollectionResponder
def to_json
display resource
end
end
| class ApplicationResponder < ActionController::Responder
# Redirects resources to the collection path (index action) instead
# of the resource path (show action) for POST/PUT/DELETE requests.
# include Responders::CollectionResponder
def format
request.format.symbol
end
def respond
display resource
end
end
| Fix application responder to use request format for response | Fix application responder to use request format for response
| Ruby | apache-2.0 | the-rocci-project/keystorm,Misenko/keystorm,dudoslav/keystorm,Misenko/keystorm,dudoslav/keystorm,the-rocci-project/keystorm | ruby | ## Code Before:
class ApplicationResponder < ActionController::Responder
# Redirects resources to the collection path (index action) instead
# of the resource path (show action) for POST/PUT/DELETE requests.
# include Responders::CollectionResponder
def to_json
display resource
end
end
## Instruction:
Fix application responder to use request format for response
## Code After:
class ApplicationResponder < ActionController::Responder
# Redirects resources to the collection path (index action) instead
# of the resource path (show action) for POST/PUT/DELETE requests.
# include Responders::CollectionResponder
def format
request.format.symbol
end
def respond
display resource
end
end
| class ApplicationResponder < ActionController::Responder
# Redirects resources to the collection path (index action) instead
# of the resource path (show action) for POST/PUT/DELETE requests.
# include Responders::CollectionResponder
- def to_json
+ def format
+ request.format.symbol
+ end
+
+ def respond
display resource
end
end | 6 | 0.75 | 5 | 1 |
45d87720bd8dc657c8b67259dc708c34dbe45184 | app/Components/Validation/Sirius/SiriusValidatorFactory.php | app/Components/Validation/Sirius/SiriusValidatorFactory.php | <?php namespace App\Components\Validation\Sirius;
use App\Components\Validation\FactoryInterface;
use Sirius\Validation\Validator;
/**
* A Sirius Validator factory
*
* @author Benjamin Ulmer
* @link http://github.com/remluben/slim-boilerplate
*/
class SiriusValidatorFactory implements FactoryInterface
{
/**
* @param array $formData
* @param array $rules
* @param array $messages
*
* @return \App\Components\Validation\ValidatorInterface
*/
public function make(array $formData, array $rules, array $messages = array())
{
$validator = new Validator;
foreach($rules as $field => $rules) {
if(!is_array($rules)) {
$rules = array($rules => null);
}
foreach($rules as $key => $value) {
if(is_string($key)) { // real rule name
$rule = $key;
$options = $value;
}
else { // otherwise the key is not the rule name, but the value is. No options specified
$rule = $value;
$options = null;
}
$messages = isset($messages[$field]) && isset($messages[$field][$rule]) ?
$messages[$field][$rule] : null;
$validator->add($field, $rule, $options, $messages);
}
}
$validator->validate($formData);
return new SiriusValidatorAdapter($validator);
}
} | <?php namespace App\Components\Validation\Sirius;
use App\Components\Validation\FactoryInterface;
use Sirius\Validation\Validator;
/**
* A Sirius Validator factory
*
* @author Benjamin Ulmer
* @link http://github.com/remluben/slim-boilerplate
*/
class SiriusValidatorFactory implements FactoryInterface
{
/**
* @param array $formData
* @param array $rules
* @param array $messages
*
* @return \App\Components\Validation\ValidatorInterface
*/
public function make(array $formData, array $rules, array $messages = array())
{
$validator = new Validator;
foreach($rules as $field => $rules) {
if(!is_array($rules)) {
$rules = array($rules => null);
}
foreach($rules as $key => $value) {
if(is_string($key)) { // real rule name
$rule = $key;
$options = $value;
}
else { // otherwise the key is not the rule name, but the value is. No options specified
$rule = $value;
$options = null;
}
$ruleMessages = isset($messages[$field]) && isset($messages[$field][$rule]) ?
$messages[$field][$rule] : null;
$validator->add($field, $rule, $options, $ruleMessages);
}
}
$validator->validate($formData);
return new SiriusValidatorAdapter($validator);
}
}
| Fix a bug when providing messages for validation rules in Factory class | Fix a bug when providing messages for validation rules in Factory class
| PHP | mit | remluben/slim-boilerplate,remluben/slim-boilerplate | php | ## Code Before:
<?php namespace App\Components\Validation\Sirius;
use App\Components\Validation\FactoryInterface;
use Sirius\Validation\Validator;
/**
* A Sirius Validator factory
*
* @author Benjamin Ulmer
* @link http://github.com/remluben/slim-boilerplate
*/
class SiriusValidatorFactory implements FactoryInterface
{
/**
* @param array $formData
* @param array $rules
* @param array $messages
*
* @return \App\Components\Validation\ValidatorInterface
*/
public function make(array $formData, array $rules, array $messages = array())
{
$validator = new Validator;
foreach($rules as $field => $rules) {
if(!is_array($rules)) {
$rules = array($rules => null);
}
foreach($rules as $key => $value) {
if(is_string($key)) { // real rule name
$rule = $key;
$options = $value;
}
else { // otherwise the key is not the rule name, but the value is. No options specified
$rule = $value;
$options = null;
}
$messages = isset($messages[$field]) && isset($messages[$field][$rule]) ?
$messages[$field][$rule] : null;
$validator->add($field, $rule, $options, $messages);
}
}
$validator->validate($formData);
return new SiriusValidatorAdapter($validator);
}
}
## Instruction:
Fix a bug when providing messages for validation rules in Factory class
## Code After:
<?php namespace App\Components\Validation\Sirius;
use App\Components\Validation\FactoryInterface;
use Sirius\Validation\Validator;
/**
* A Sirius Validator factory
*
* @author Benjamin Ulmer
* @link http://github.com/remluben/slim-boilerplate
*/
class SiriusValidatorFactory implements FactoryInterface
{
/**
* @param array $formData
* @param array $rules
* @param array $messages
*
* @return \App\Components\Validation\ValidatorInterface
*/
public function make(array $formData, array $rules, array $messages = array())
{
$validator = new Validator;
foreach($rules as $field => $rules) {
if(!is_array($rules)) {
$rules = array($rules => null);
}
foreach($rules as $key => $value) {
if(is_string($key)) { // real rule name
$rule = $key;
$options = $value;
}
else { // otherwise the key is not the rule name, but the value is. No options specified
$rule = $value;
$options = null;
}
$ruleMessages = isset($messages[$field]) && isset($messages[$field][$rule]) ?
$messages[$field][$rule] : null;
$validator->add($field, $rule, $options, $ruleMessages);
}
}
$validator->validate($formData);
return new SiriusValidatorAdapter($validator);
}
}
| <?php namespace App\Components\Validation\Sirius;
use App\Components\Validation\FactoryInterface;
use Sirius\Validation\Validator;
/**
* A Sirius Validator factory
*
* @author Benjamin Ulmer
* @link http://github.com/remluben/slim-boilerplate
*/
class SiriusValidatorFactory implements FactoryInterface
{
/**
* @param array $formData
* @param array $rules
* @param array $messages
*
* @return \App\Components\Validation\ValidatorInterface
*/
public function make(array $formData, array $rules, array $messages = array())
{
$validator = new Validator;
foreach($rules as $field => $rules) {
if(!is_array($rules)) {
$rules = array($rules => null);
}
foreach($rules as $key => $value) {
if(is_string($key)) { // real rule name
$rule = $key;
$options = $value;
}
else { // otherwise the key is not the rule name, but the value is. No options specified
$rule = $value;
$options = null;
}
- $messages = isset($messages[$field]) && isset($messages[$field][$rule]) ?
? ^
+ $ruleMessages = isset($messages[$field]) && isset($messages[$field][$rule]) ?
? ^^^^^
$messages[$field][$rule] : null;
- $validator->add($field, $rule, $options, $messages);
? ^
+ $validator->add($field, $rule, $options, $ruleMessages);
? ^^^^^
}
}
$validator->validate($formData);
return new SiriusValidatorAdapter($validator);
}
} | 4 | 0.075472 | 2 | 2 |
fbc42057c647e4e42825b0b4e33d69e5967901f0 | cid/locals/thread_local.py | cid/locals/thread_local.py | from threading import local
from django.conf import settings
from .base import build_cid
_thread_locals = local()
def set_cid(cid):
"""Set the correlation id for the current request."""
setattr(_thread_locals, 'CID', cid)
def get_cid():
"""Return the currently set correlation id (if any).
If no correlation id has been set and ``CID_GENERATE`` is enabled
in the settings, a new correlation id is set and returned.
FIXME (dbaty): in version 2, just `return getattr(_thread_locals, 'CID', None)`
We want the simplest thing here and let `generate_new_cid` do the job.
"""
cid = getattr(_thread_locals, 'CID', None)
if cid is None and getattr(settings, 'CID_GENERATE', False):
cid = build_cid()
set_cid(cid)
return cid
| from threading import local
from django.conf import settings
from .base import build_cid
_thread_locals = local()
def set_cid(cid):
"""Set the correlation id for the current request."""
setattr(_thread_locals, 'CID', cid)
def get_cid():
"""Return the currently set correlation id (if any).
If no correlation id has been set and ``CID_GENERATE`` is enabled
in the settings, a new correlation id is set and returned.
"""
cid = getattr(_thread_locals, 'CID', None)
if cid is None and getattr(settings, 'CID_GENERATE', False):
cid = build_cid()
set_cid(cid)
return cid
| Remove ancient FIXME in `get_cid()` | Remove ancient FIXME in `get_cid()`
Maybe I had a great idea in mind when I wrote the comment. Or maybe it
was just a vague thought. I guess we'll never know.
| Python | bsd-3-clause | snowball-one/cid | python | ## Code Before:
from threading import local
from django.conf import settings
from .base import build_cid
_thread_locals = local()
def set_cid(cid):
"""Set the correlation id for the current request."""
setattr(_thread_locals, 'CID', cid)
def get_cid():
"""Return the currently set correlation id (if any).
If no correlation id has been set and ``CID_GENERATE`` is enabled
in the settings, a new correlation id is set and returned.
FIXME (dbaty): in version 2, just `return getattr(_thread_locals, 'CID', None)`
We want the simplest thing here and let `generate_new_cid` do the job.
"""
cid = getattr(_thread_locals, 'CID', None)
if cid is None and getattr(settings, 'CID_GENERATE', False):
cid = build_cid()
set_cid(cid)
return cid
## Instruction:
Remove ancient FIXME in `get_cid()`
Maybe I had a great idea in mind when I wrote the comment. Or maybe it
was just a vague thought. I guess we'll never know.
## Code After:
from threading import local
from django.conf import settings
from .base import build_cid
_thread_locals = local()
def set_cid(cid):
"""Set the correlation id for the current request."""
setattr(_thread_locals, 'CID', cid)
def get_cid():
"""Return the currently set correlation id (if any).
If no correlation id has been set and ``CID_GENERATE`` is enabled
in the settings, a new correlation id is set and returned.
"""
cid = getattr(_thread_locals, 'CID', None)
if cid is None and getattr(settings, 'CID_GENERATE', False):
cid = build_cid()
set_cid(cid)
return cid
| from threading import local
from django.conf import settings
from .base import build_cid
_thread_locals = local()
def set_cid(cid):
"""Set the correlation id for the current request."""
setattr(_thread_locals, 'CID', cid)
def get_cid():
"""Return the currently set correlation id (if any).
If no correlation id has been set and ``CID_GENERATE`` is enabled
in the settings, a new correlation id is set and returned.
-
- FIXME (dbaty): in version 2, just `return getattr(_thread_locals, 'CID', None)`
- We want the simplest thing here and let `generate_new_cid` do the job.
"""
cid = getattr(_thread_locals, 'CID', None)
if cid is None and getattr(settings, 'CID_GENERATE', False):
cid = build_cid()
set_cid(cid)
return cid | 3 | 0.103448 | 0 | 3 |
4c61f1d202c53d62bbbcecefc5671819cced05cf | patches/common/net/minecraft/src/CompressedStreamTools.java.patch | patches/common/net/minecraft/src/CompressedStreamTools.java.patch | --- ../src_base/common/net/minecraft/src/CompressedStreamTools.java
+++ ../src_work/common/net/minecraft/src/CompressedStreamTools.java
@@ -155,7 +155,6 @@
}
}
- @SideOnly(Side.CLIENT)
public static NBTTagCompound read(File par0File) throws IOException
{
if (!par0File.exists())
| --- ../src_base/common/net/minecraft/src/CompressedStreamTools.java
+++ ../src_work/common/net/minecraft/src/CompressedStreamTools.java
@@ -140,7 +140,6 @@
NBTBase.writeNamedTag(par0NBTTagCompound, par1DataOutput);
}
- @SideOnly(Side.CLIENT)
public static void write(NBTTagCompound par0NBTTagCompound, File par1File) throws IOException
{
DataOutputStream var2 = new DataOutputStream(new FileOutputStream(par1File));
@@ -155,7 +154,6 @@
}
}
- @SideOnly(Side.CLIENT)
public static NBTTagCompound read(File par0File) throws IOException
{
if (!par0File.exists())
| Remove @SideOnly flag for function now required on the server | Remove @SideOnly flag for function now required on the server
| Diff | lgpl-2.1 | jdpadrnos/MinecraftForge,Ghostlyr/MinecraftForge,luacs1998/MinecraftForge,dmf444/MinecraftForge,RainWarrior/MinecraftForge,Theerapak/MinecraftForge,shadekiller666/MinecraftForge,simon816/MinecraftForge,ThiagoGarciaAlves/MinecraftForge,karlthepagan/MinecraftForge,blay09/MinecraftForge,CrafterKina/MinecraftForge,bonii-xx/MinecraftForge,Vorquel/MinecraftForge,fcjailybo/MinecraftForge,Zaggy1024/MinecraftForge,mickkay/MinecraftForge,brubo1/MinecraftForge,Mathe172/MinecraftForge | diff | ## Code Before:
--- ../src_base/common/net/minecraft/src/CompressedStreamTools.java
+++ ../src_work/common/net/minecraft/src/CompressedStreamTools.java
@@ -155,7 +155,6 @@
}
}
- @SideOnly(Side.CLIENT)
public static NBTTagCompound read(File par0File) throws IOException
{
if (!par0File.exists())
## Instruction:
Remove @SideOnly flag for function now required on the server
## Code After:
--- ../src_base/common/net/minecraft/src/CompressedStreamTools.java
+++ ../src_work/common/net/minecraft/src/CompressedStreamTools.java
@@ -140,7 +140,6 @@
NBTBase.writeNamedTag(par0NBTTagCompound, par1DataOutput);
}
- @SideOnly(Side.CLIENT)
public static void write(NBTTagCompound par0NBTTagCompound, File par1File) throws IOException
{
DataOutputStream var2 = new DataOutputStream(new FileOutputStream(par1File));
@@ -155,7 +154,6 @@
}
}
- @SideOnly(Side.CLIENT)
public static NBTTagCompound read(File par0File) throws IOException
{
if (!par0File.exists())
| --- ../src_base/common/net/minecraft/src/CompressedStreamTools.java
+++ ../src_work/common/net/minecraft/src/CompressedStreamTools.java
+ @@ -140,7 +140,6 @@
+ NBTBase.writeNamedTag(par0NBTTagCompound, par1DataOutput);
+ }
+
+ - @SideOnly(Side.CLIENT)
+ public static void write(NBTTagCompound par0NBTTagCompound, File par1File) throws IOException
+ {
+ DataOutputStream var2 = new DataOutputStream(new FileOutputStream(par1File));
- @@ -155,7 +155,6 @@
? ^
+ @@ -155,7 +154,6 @@
? ^
}
}
- @SideOnly(Side.CLIENT)
public static NBTTagCompound read(File par0File) throws IOException
{
if (!par0File.exists()) | 10 | 1 | 9 | 1 |
f37718c1533dadb9945ac70882f08c50e0598fad | broadcast.rb | broadcast.rb | begin
require "android"
rescue LoadError
require "mock_android"
end
require "erb"
class Broadcast < Sinatra::Base
DROID = Android.new
set :views, File.join(APP_DIR, "views")
set :public, File.join(APP_DIR, "public")
get '/' do
@temp = DROID.batteryGetTemperature
get_location_coordinates
erb :"index.html"
end
get "/snapshot" do
content_type 'image/png'
img_path = File.join APP_DIR, "snapshots", "latest.png"
DROID.cameraCapturePicture img_path
File.read(img_path).to_blob
end
def get_location_coordinates
result = DROID.getLastKnownLocation["result"]
location_data = result["gps"] || result["passive"]
@latitude, @longitude = location_data["latitude"], location_data["longitude"]
!!@longitude
end
end
| begin
require "android"
rescue LoadError
require "mock_android"
end
require "erb"
class Broadcast < Sinatra::Base
DROID = Android.new
set :views, File.join(APP_DIR, "views")
set :public, File.join(APP_DIR, "public")
get '/' do
set_location_coordinates
set_temp
set_status
erb :"index.html"
end
get "/snapshot.jpg" do
content_type 'image/png'
img_path = File.join APP_DIR, "snapshots", "latest.jpg"
DROID.cameraCapturePicture img_path
File.read(img_path)
end
def set_temp
@temp = DROID.batteryGetTemperature["result"].to_f / 10
end
def set_status
map = {
"1" => "unknown",
"2" => "charging",
"3" => "discharging",
"4" => "not charging",
"5" => "full"
}
result = DROID.batteryGetStatus["result"].to_s
@status = map[result]
end
def set_location_coordinates
result = DROID.getLastKnownLocation["result"]
location_data = result["gps"] || result["passive"]
@latitude, @longitude = location_data["latitude"], location_data["longitude"]
!!@longitude
end
end
| Improve ability to retreive battery temp, battery status, snapshot. | Improve ability to retreive battery temp, battery status, snapshot.
| Ruby | mit | mleone/broadcast,mleone/broadcast | ruby | ## Code Before:
begin
require "android"
rescue LoadError
require "mock_android"
end
require "erb"
class Broadcast < Sinatra::Base
DROID = Android.new
set :views, File.join(APP_DIR, "views")
set :public, File.join(APP_DIR, "public")
get '/' do
@temp = DROID.batteryGetTemperature
get_location_coordinates
erb :"index.html"
end
get "/snapshot" do
content_type 'image/png'
img_path = File.join APP_DIR, "snapshots", "latest.png"
DROID.cameraCapturePicture img_path
File.read(img_path).to_blob
end
def get_location_coordinates
result = DROID.getLastKnownLocation["result"]
location_data = result["gps"] || result["passive"]
@latitude, @longitude = location_data["latitude"], location_data["longitude"]
!!@longitude
end
end
## Instruction:
Improve ability to retreive battery temp, battery status, snapshot.
## Code After:
begin
require "android"
rescue LoadError
require "mock_android"
end
require "erb"
class Broadcast < Sinatra::Base
DROID = Android.new
set :views, File.join(APP_DIR, "views")
set :public, File.join(APP_DIR, "public")
get '/' do
set_location_coordinates
set_temp
set_status
erb :"index.html"
end
get "/snapshot.jpg" do
content_type 'image/png'
img_path = File.join APP_DIR, "snapshots", "latest.jpg"
DROID.cameraCapturePicture img_path
File.read(img_path)
end
def set_temp
@temp = DROID.batteryGetTemperature["result"].to_f / 10
end
def set_status
map = {
"1" => "unknown",
"2" => "charging",
"3" => "discharging",
"4" => "not charging",
"5" => "full"
}
result = DROID.batteryGetStatus["result"].to_s
@status = map[result]
end
def set_location_coordinates
result = DROID.getLastKnownLocation["result"]
location_data = result["gps"] || result["passive"]
@latitude, @longitude = location_data["latitude"], location_data["longitude"]
!!@longitude
end
end
| begin
require "android"
rescue LoadError
require "mock_android"
end
require "erb"
class Broadcast < Sinatra::Base
-
DROID = Android.new
set :views, File.join(APP_DIR, "views")
set :public, File.join(APP_DIR, "public")
get '/' do
- @temp = DROID.batteryGetTemperature
- get_location_coordinates
? ^
+ set_location_coordinates
? ^
+ set_temp
+ set_status
erb :"index.html"
end
- get "/snapshot" do
+ get "/snapshot.jpg" do
? ++++
content_type 'image/png'
- img_path = File.join APP_DIR, "snapshots", "latest.png"
? -
+ img_path = File.join APP_DIR, "snapshots", "latest.jpg"
? +
DROID.cameraCapturePicture img_path
- File.read(img_path).to_blob
? --------
+ File.read(img_path)
end
+ def set_temp
+ @temp = DROID.batteryGetTemperature["result"].to_f / 10
+ end
+
+ def set_status
+ map = {
+ "1" => "unknown",
+ "2" => "charging",
+ "3" => "discharging",
+ "4" => "not charging",
+ "5" => "full"
+ }
+
+ result = DROID.batteryGetStatus["result"].to_s
+ @status = map[result]
+ end
+
- def get_location_coordinates
? ^
+ def set_location_coordinates
? ^
result = DROID.getLastKnownLocation["result"]
location_data = result["gps"] || result["passive"]
@latitude, @longitude = location_data["latitude"], location_data["longitude"]
!!@longitude
end
end | 31 | 0.885714 | 24 | 7 |
82432618a623f8b7f4ed84f4249457cd2752d3bf | src/templates/choropleths/choropleth_view.html | src/templates/choropleths/choropleth_view.html | {% extends "_layout.html" %}
{% load compressed %}
{% block page_title %}{{ choropleth.name }}{% endblock page_title %}
{% block head %}
{% compressed_js 'map-vendor' %}
{% compressed_js 'map' %}
{% endblock head %}
{% block header %}{{ choropleth.name }}{% endblock header %}
{% block control-btns %}
{% if choropleth.owner.id == user.id %}
<a href="{% url 'choropleths:choropleth-edit' choropleth.id %}">
<button class="btn btn-default btn-sm"><span class="glyphicon glyphicon-edit"></span> Edit</button>
</a>
{% endif %}
{% if choropleth.dataset.published or choropleth.owner == user %}
<a href="{% url 'datasets:dataset-detail' choropleth.dataset_id %}">
<button class="btn btn-default btn-sm"><span class="glyphicon glyphicon-book"></span> Dataset</button>
</a>
{% endif %}
{% endblock control-btns %}
{% block content %}
{% with noHorizontalRule=True %}
{{ block.super }}
{% endwith %}
<div class="col-sm-12" id="choropleth-wrapper">
<form ng-controller="ViewController" ng-init="init({{ choropleth.id }})">
{% include 'partials/choropleth.html' %}
<markdown description="choropleth.description"></markdown>
</form>
</div>
{% endblock content %}
| {% extends "_layout.html" %}
{% load compressed %}
{% block page_title %}{{ choropleth.name }}{% endblock page_title %}
{% block head %}
{% compressed_js 'map-vendor' %}
{% compressed_js 'map' %}
{% endblock head %}
{% block header %}{{ choropleth.name }}{% endblock header %}
{% block control-btns %}
{% if choropleth.dataset.published or choropleth.owner == user %}
<a href="{% url 'datasets:dataset-detail' choropleth.dataset_id %}">
<button class="btn btn-default btn-sm"><span class="glyphicon glyphicon-book"></span> Dataset</button>
</a>
{% endif %}
{% if choropleth.owner.id == user.id %}
<a href="{% url 'choropleths:choropleth-edit' choropleth.id %}">
<button class="btn btn-default btn-sm"><span class="glyphicon glyphicon-edit"></span> Edit</button>
</a>
{% endif %}
{% endblock control-btns %}
{% block content %}
{% with noHorizontalRule=True %}
{{ block.super }}
{% endwith %}
<div class="col-sm-12" id="choropleth-wrapper">
<form ng-controller="ViewController" ng-init="init({{ choropleth.id }})">
{% include 'partials/choropleth.html' %}
<markdown description="choropleth.description"></markdown>
</form>
</div>
{% endblock content %}
| Move edit button to conform to the styling of other choropleth pages. | Move edit button to conform to the styling of other choropleth pages.
git-svn-id: d73fdb991549f9d1a0affa567d55bb0fdbd453f3@8046 f04a3889-0f81-4131-97fb-bc517d1f583d
| HTML | bsd-3-clause | unt-libraries/texas-choropleth,unt-libraries/texas-choropleth,damonkelley/texas-choropleth,unt-libraries/texas-choropleth,damonkelley/texas-choropleth,damonkelley/texas-choropleth,unt-libraries/texas-choropleth,damonkelley/texas-choropleth | html | ## Code Before:
{% extends "_layout.html" %}
{% load compressed %}
{% block page_title %}{{ choropleth.name }}{% endblock page_title %}
{% block head %}
{% compressed_js 'map-vendor' %}
{% compressed_js 'map' %}
{% endblock head %}
{% block header %}{{ choropleth.name }}{% endblock header %}
{% block control-btns %}
{% if choropleth.owner.id == user.id %}
<a href="{% url 'choropleths:choropleth-edit' choropleth.id %}">
<button class="btn btn-default btn-sm"><span class="glyphicon glyphicon-edit"></span> Edit</button>
</a>
{% endif %}
{% if choropleth.dataset.published or choropleth.owner == user %}
<a href="{% url 'datasets:dataset-detail' choropleth.dataset_id %}">
<button class="btn btn-default btn-sm"><span class="glyphicon glyphicon-book"></span> Dataset</button>
</a>
{% endif %}
{% endblock control-btns %}
{% block content %}
{% with noHorizontalRule=True %}
{{ block.super }}
{% endwith %}
<div class="col-sm-12" id="choropleth-wrapper">
<form ng-controller="ViewController" ng-init="init({{ choropleth.id }})">
{% include 'partials/choropleth.html' %}
<markdown description="choropleth.description"></markdown>
</form>
</div>
{% endblock content %}
## Instruction:
Move edit button to conform to the styling of other choropleth pages.
git-svn-id: d73fdb991549f9d1a0affa567d55bb0fdbd453f3@8046 f04a3889-0f81-4131-97fb-bc517d1f583d
## Code After:
{% extends "_layout.html" %}
{% load compressed %}
{% block page_title %}{{ choropleth.name }}{% endblock page_title %}
{% block head %}
{% compressed_js 'map-vendor' %}
{% compressed_js 'map' %}
{% endblock head %}
{% block header %}{{ choropleth.name }}{% endblock header %}
{% block control-btns %}
{% if choropleth.dataset.published or choropleth.owner == user %}
<a href="{% url 'datasets:dataset-detail' choropleth.dataset_id %}">
<button class="btn btn-default btn-sm"><span class="glyphicon glyphicon-book"></span> Dataset</button>
</a>
{% endif %}
{% if choropleth.owner.id == user.id %}
<a href="{% url 'choropleths:choropleth-edit' choropleth.id %}">
<button class="btn btn-default btn-sm"><span class="glyphicon glyphicon-edit"></span> Edit</button>
</a>
{% endif %}
{% endblock control-btns %}
{% block content %}
{% with noHorizontalRule=True %}
{{ block.super }}
{% endwith %}
<div class="col-sm-12" id="choropleth-wrapper">
<form ng-controller="ViewController" ng-init="init({{ choropleth.id }})">
{% include 'partials/choropleth.html' %}
<markdown description="choropleth.description"></markdown>
</form>
</div>
{% endblock content %}
| {% extends "_layout.html" %}
{% load compressed %}
{% block page_title %}{{ choropleth.name }}{% endblock page_title %}
{% block head %}
{% compressed_js 'map-vendor' %}
{% compressed_js 'map' %}
{% endblock head %}
{% block header %}{{ choropleth.name }}{% endblock header %}
{% block control-btns %}
+ {% if choropleth.dataset.published or choropleth.owner == user %}
+ <a href="{% url 'datasets:dataset-detail' choropleth.dataset_id %}">
+ <button class="btn btn-default btn-sm"><span class="glyphicon glyphicon-book"></span> Dataset</button>
+ </a>
+ {% endif %}
+
{% if choropleth.owner.id == user.id %}
-
<a href="{% url 'choropleths:choropleth-edit' choropleth.id %}">
<button class="btn btn-default btn-sm"><span class="glyphicon glyphicon-edit"></span> Edit</button>
</a>
-
- {% endif %}
-
- {% if choropleth.dataset.published or choropleth.owner == user %}
-
- <a href="{% url 'datasets:dataset-detail' choropleth.dataset_id %}">
- <button class="btn btn-default btn-sm"><span class="glyphicon glyphicon-book"></span> Dataset</button>
- </a>
-
{% endif %}
{% endblock control-btns %}
{% block content %}
{% with noHorizontalRule=True %}
{{ block.super }}
{% endwith %}
<div class="col-sm-12" id="choropleth-wrapper">
<form ng-controller="ViewController" ng-init="init({{ choropleth.id }})">
{% include 'partials/choropleth.html' %}
<markdown description="choropleth.description"></markdown>
</form>
</div>
{% endblock content %}
| 16 | 0.326531 | 6 | 10 |
a77b838e6c1c279afdabf906696d2869de53b2b2 | package.json | package.json | {
"name": "shopify-cartjs",
"description": "A Javascript library to power cart management for Shopify themes.",
"version": "0.0.1",
"author": "Gavin Ballard",
"url": "http://cartjs.org",
"main": "./dist/cart.js",
"licenses": [
{
"type": "MIT",
"url": "https://github.com/discolabs/cartjs/blob/master/LICENSE"
}
],
"repository": {
"type": "git",
"url": "https://github.com/discolabs/cartjs.git"
},
"devDependencies": {
"grunt": "~0.4.5",
"grunt-cli": "~0.1.13",
"grunt-contrib-clean": "~0.6.0",
"grunt-contrib-concat": "~0.4.0",
"grunt-contrib-copy": "~0.5.0",
"grunt-contrib-coffee": "~0.10.1",
"grunt-contrib-compress": "~0.11.0",
"grunt-contrib-less": "~0.11.1",
"grunt-contrib-uglify": "~0.5.0",
"grunt-contrib-watch": "~0.6.1",
"grunt-exec": "~0.4.5",
"grunt-terraform": "gavinballard/grunt-terraform",
"rivets": "~0.6.10"
}
}
| {
"name": "shopify-cartjs",
"description": "A Javascript library to power cart management for Shopify themes.",
"version": "0.0.1",
"author": "Gavin Ballard",
"url": "http://cartjs.org",
"main": "./dist/cart.js",
"licenses": [
{
"type": "MIT",
"url": "https://github.com/discolabs/cartjs/blob/master/LICENSE"
}
],
"repository": {
"type": "git",
"url": "https://github.com/discolabs/cartjs.git"
},
"devDependencies": {
"grunt": "~0.4.5",
"grunt-cli": "~0.1.13",
"grunt-contrib-clean": "~0.6.0",
"grunt-contrib-concat": "~0.4.0",
"grunt-contrib-copy": "~0.5.0",
"grunt-contrib-coffee": "~0.10.1",
"grunt-contrib-compress": "~0.11.0",
"grunt-contrib-less": "~0.11.1",
"grunt-contrib-uglify": "~0.5.0",
"grunt-contrib-watch": "~0.6.1",
"grunt-exec": "~0.4.5",
"grunt-terraform": "~0.1.0",
"rivets": "~0.6.10"
}
}
| Use the published npm version of `grunt-terraform` instead of pulling directly from GitHub. | Use the published npm version of `grunt-terraform` instead of pulling directly from GitHub. | JSON | mit | michaelrshannon/cartjs,luisvillasenor/cartjs,discolabs/cartjs,discolabs/cartjs,michaelrshannon/cartjs | json | ## Code Before:
{
"name": "shopify-cartjs",
"description": "A Javascript library to power cart management for Shopify themes.",
"version": "0.0.1",
"author": "Gavin Ballard",
"url": "http://cartjs.org",
"main": "./dist/cart.js",
"licenses": [
{
"type": "MIT",
"url": "https://github.com/discolabs/cartjs/blob/master/LICENSE"
}
],
"repository": {
"type": "git",
"url": "https://github.com/discolabs/cartjs.git"
},
"devDependencies": {
"grunt": "~0.4.5",
"grunt-cli": "~0.1.13",
"grunt-contrib-clean": "~0.6.0",
"grunt-contrib-concat": "~0.4.0",
"grunt-contrib-copy": "~0.5.0",
"grunt-contrib-coffee": "~0.10.1",
"grunt-contrib-compress": "~0.11.0",
"grunt-contrib-less": "~0.11.1",
"grunt-contrib-uglify": "~0.5.0",
"grunt-contrib-watch": "~0.6.1",
"grunt-exec": "~0.4.5",
"grunt-terraform": "gavinballard/grunt-terraform",
"rivets": "~0.6.10"
}
}
## Instruction:
Use the published npm version of `grunt-terraform` instead of pulling directly from GitHub.
## Code After:
{
"name": "shopify-cartjs",
"description": "A Javascript library to power cart management for Shopify themes.",
"version": "0.0.1",
"author": "Gavin Ballard",
"url": "http://cartjs.org",
"main": "./dist/cart.js",
"licenses": [
{
"type": "MIT",
"url": "https://github.com/discolabs/cartjs/blob/master/LICENSE"
}
],
"repository": {
"type": "git",
"url": "https://github.com/discolabs/cartjs.git"
},
"devDependencies": {
"grunt": "~0.4.5",
"grunt-cli": "~0.1.13",
"grunt-contrib-clean": "~0.6.0",
"grunt-contrib-concat": "~0.4.0",
"grunt-contrib-copy": "~0.5.0",
"grunt-contrib-coffee": "~0.10.1",
"grunt-contrib-compress": "~0.11.0",
"grunt-contrib-less": "~0.11.1",
"grunt-contrib-uglify": "~0.5.0",
"grunt-contrib-watch": "~0.6.1",
"grunt-exec": "~0.4.5",
"grunt-terraform": "~0.1.0",
"rivets": "~0.6.10"
}
}
| {
"name": "shopify-cartjs",
"description": "A Javascript library to power cart management for Shopify themes.",
"version": "0.0.1",
"author": "Gavin Ballard",
"url": "http://cartjs.org",
"main": "./dist/cart.js",
"licenses": [
{
"type": "MIT",
"url": "https://github.com/discolabs/cartjs/blob/master/LICENSE"
}
],
"repository": {
"type": "git",
"url": "https://github.com/discolabs/cartjs.git"
},
"devDependencies": {
"grunt": "~0.4.5",
"grunt-cli": "~0.1.13",
"grunt-contrib-clean": "~0.6.0",
"grunt-contrib-concat": "~0.4.0",
"grunt-contrib-copy": "~0.5.0",
"grunt-contrib-coffee": "~0.10.1",
"grunt-contrib-compress": "~0.11.0",
"grunt-contrib-less": "~0.11.1",
"grunt-contrib-uglify": "~0.5.0",
"grunt-contrib-watch": "~0.6.1",
"grunt-exec": "~0.4.5",
- "grunt-terraform": "gavinballard/grunt-terraform",
+ "grunt-terraform": "~0.1.0",
"rivets": "~0.6.10"
}
} | 2 | 0.060606 | 1 | 1 |
cc8cc05480e85c9a66450f1655083e87d00ba3f4 | usersettings/shortcuts.py | usersettings/shortcuts.py | from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
def get_usersettings_model():
"""
Returns the ``UserSettings`` model that is active in this project.
"""
from django.db.models import get_model
try:
app_label, model_name = settings.USERSETTINGS_MODEL.split('.')
except ValueError:
raise ImproperlyConfigured('USERSETTINGS_MODEL must be of the '
'form "app_label.model_name"')
usersettings_model = get_model(app_label, model_name)
if usersettings_model is None:
raise ImproperlyConfigured('USERSETTINGS_MODEL refers to model "%s" that has '
'not been installed' % settings.USERSETTINGS_MODEL)
return usersettings_model
def get_current_usersettings():
"""
Returns the current ``UserSettings`` based on
the SITE_ID in the project's settings
"""
USERSETTINGS_MODEL = get_usersettings_model()
current_usersettings = USERSETTINGS_MODEL.objects.get_current()
return current_usersettings
| from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
def get_usersettings_model():
"""
Returns the ``UserSettings`` model that is active in this project.
"""
from django.db.models import get_model
try:
app_label, model_name = settings.USERSETTINGS_MODEL.split('.')
except ValueError:
raise ImproperlyConfigured('USERSETTINGS_MODEL must be of the '
'form "app_label.model_name"')
usersettings_model = get_model(app_label, model_name)
if usersettings_model is None:
raise ImproperlyConfigured('USERSETTINGS_MODEL refers to model "%s" that has '
'not been installed' % settings.USERSETTINGS_MODEL)
return usersettings_model
def get_current_usersettings():
"""
Returns the current ``UserSettings`` based on
the SITE_ID in the project's settings
"""
USERSETTINGS_MODEL = get_usersettings_model()
try:
current_usersettings = USERSETTINGS_MODEL.objects.get_current()
except USERSETTINGS_MODEL.DoesNotExist:
current_usersettings = None
return current_usersettings
| Update 'get_current_usersettings' to catch 'DoesNotExist' error | Update 'get_current_usersettings' to catch 'DoesNotExist' error
| Python | bsd-3-clause | mishbahr/django-usersettings2,mishbahr/django-usersettings2 | python | ## Code Before:
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
def get_usersettings_model():
"""
Returns the ``UserSettings`` model that is active in this project.
"""
from django.db.models import get_model
try:
app_label, model_name = settings.USERSETTINGS_MODEL.split('.')
except ValueError:
raise ImproperlyConfigured('USERSETTINGS_MODEL must be of the '
'form "app_label.model_name"')
usersettings_model = get_model(app_label, model_name)
if usersettings_model is None:
raise ImproperlyConfigured('USERSETTINGS_MODEL refers to model "%s" that has '
'not been installed' % settings.USERSETTINGS_MODEL)
return usersettings_model
def get_current_usersettings():
"""
Returns the current ``UserSettings`` based on
the SITE_ID in the project's settings
"""
USERSETTINGS_MODEL = get_usersettings_model()
current_usersettings = USERSETTINGS_MODEL.objects.get_current()
return current_usersettings
## Instruction:
Update 'get_current_usersettings' to catch 'DoesNotExist' error
## Code After:
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
def get_usersettings_model():
"""
Returns the ``UserSettings`` model that is active in this project.
"""
from django.db.models import get_model
try:
app_label, model_name = settings.USERSETTINGS_MODEL.split('.')
except ValueError:
raise ImproperlyConfigured('USERSETTINGS_MODEL must be of the '
'form "app_label.model_name"')
usersettings_model = get_model(app_label, model_name)
if usersettings_model is None:
raise ImproperlyConfigured('USERSETTINGS_MODEL refers to model "%s" that has '
'not been installed' % settings.USERSETTINGS_MODEL)
return usersettings_model
def get_current_usersettings():
"""
Returns the current ``UserSettings`` based on
the SITE_ID in the project's settings
"""
USERSETTINGS_MODEL = get_usersettings_model()
try:
current_usersettings = USERSETTINGS_MODEL.objects.get_current()
except USERSETTINGS_MODEL.DoesNotExist:
current_usersettings = None
return current_usersettings
| from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
def get_usersettings_model():
"""
Returns the ``UserSettings`` model that is active in this project.
"""
from django.db.models import get_model
try:
app_label, model_name = settings.USERSETTINGS_MODEL.split('.')
except ValueError:
raise ImproperlyConfigured('USERSETTINGS_MODEL must be of the '
'form "app_label.model_name"')
usersettings_model = get_model(app_label, model_name)
if usersettings_model is None:
raise ImproperlyConfigured('USERSETTINGS_MODEL refers to model "%s" that has '
'not been installed' % settings.USERSETTINGS_MODEL)
return usersettings_model
def get_current_usersettings():
"""
Returns the current ``UserSettings`` based on
the SITE_ID in the project's settings
"""
USERSETTINGS_MODEL = get_usersettings_model()
+ try:
- current_usersettings = USERSETTINGS_MODEL.objects.get_current()
+ current_usersettings = USERSETTINGS_MODEL.objects.get_current()
? ++++
+ except USERSETTINGS_MODEL.DoesNotExist:
+ current_usersettings = None
return current_usersettings | 5 | 0.166667 | 4 | 1 |
173c38c674e2976120834dc2eec041de42b7b559 | lib/spree/sunspot/filter_support.rb | lib/spree/sunspot/filter_support.rb | require 'spree/sunspot/search'
module Spree
module Sunspot
module FilterSupport
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def filter_support(options = {})
additional_params = options[:additional_params_method]
class_eval <<-EOV
include Spree::Sunspot::FilterSupport::InstanceMethods
helper_method :render_filter
EOV
end
end
module InstanceMethods
def filter
params.merge(self.send(:additional_filter_params)) if self.respond_to?(:additional_filter_params)
@searcher = Spree::Config.searcher_class.new(params)
@products = @searcher.retrieve_products
respond_with(@products)
end
def filter_url_options
object = instance_variable_get('@'+controller_name.singularize)
if object
case controller_name
when "products"
hash_for_product_path(object)
when "taxons"
hash_for_taxon_short_path(object)
end
else
{}
end
end
def render_filter
filter_params = Spree::Sunspot::Setup.filters.collect{|filter| filter.parse(params)}
render :partial => 'spree/shared/filter', :locals => { :filter_params => filter_params }
end
end
end
end
end
| require 'spree/sunspot/search'
module Spree
module Sunspot
module FilterSupport
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def filter_support(options = {})
additional_params = options[:additional_params_method]
class_eval <<-EOV
include Spree::Sunspot::FilterSupport::InstanceMethods
helper_method :render_filter
EOV
end
end
module InstanceMethods
def filter
params.merge(self.send(:additional_filter_params)) if self.respond_to?(:additional_filter_params)
@searcher = Spree::Config.searcher_class.new(params)
@products = @searcher.retrieve_products
respond_with(@products)
end
def filter_url_options
object = instance_variable_get('@'+controller_name.singularize)
if object
case controller_name
when "products"
hash_for_product_path(object)
when "taxons"
hash_for_taxon_short_path(object)
end
else
{}
end
end
end
module Helpers
def render_filter
filter_params = Spree::Sunspot::Setup.filters.collect{|filter| filter.parse(params)}
render :partial => 'spree/shared/filter', :locals => { :filter_params => filter_params }
end
end
end
end
end
| Add back the Helpers module | Add back the Helpers module
| Ruby | bsd-3-clause | five18pm/spree-sunspot,five18pm/spree-sunspot | ruby | ## Code Before:
require 'spree/sunspot/search'
module Spree
module Sunspot
module FilterSupport
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def filter_support(options = {})
additional_params = options[:additional_params_method]
class_eval <<-EOV
include Spree::Sunspot::FilterSupport::InstanceMethods
helper_method :render_filter
EOV
end
end
module InstanceMethods
def filter
params.merge(self.send(:additional_filter_params)) if self.respond_to?(:additional_filter_params)
@searcher = Spree::Config.searcher_class.new(params)
@products = @searcher.retrieve_products
respond_with(@products)
end
def filter_url_options
object = instance_variable_get('@'+controller_name.singularize)
if object
case controller_name
when "products"
hash_for_product_path(object)
when "taxons"
hash_for_taxon_short_path(object)
end
else
{}
end
end
def render_filter
filter_params = Spree::Sunspot::Setup.filters.collect{|filter| filter.parse(params)}
render :partial => 'spree/shared/filter', :locals => { :filter_params => filter_params }
end
end
end
end
end
## Instruction:
Add back the Helpers module
## Code After:
require 'spree/sunspot/search'
module Spree
module Sunspot
module FilterSupport
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def filter_support(options = {})
additional_params = options[:additional_params_method]
class_eval <<-EOV
include Spree::Sunspot::FilterSupport::InstanceMethods
helper_method :render_filter
EOV
end
end
module InstanceMethods
def filter
params.merge(self.send(:additional_filter_params)) if self.respond_to?(:additional_filter_params)
@searcher = Spree::Config.searcher_class.new(params)
@products = @searcher.retrieve_products
respond_with(@products)
end
def filter_url_options
object = instance_variable_get('@'+controller_name.singularize)
if object
case controller_name
when "products"
hash_for_product_path(object)
when "taxons"
hash_for_taxon_short_path(object)
end
else
{}
end
end
end
module Helpers
def render_filter
filter_params = Spree::Sunspot::Setup.filters.collect{|filter| filter.parse(params)}
render :partial => 'spree/shared/filter', :locals => { :filter_params => filter_params }
end
end
end
end
end
| require 'spree/sunspot/search'
module Spree
module Sunspot
module FilterSupport
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def filter_support(options = {})
additional_params = options[:additional_params_method]
class_eval <<-EOV
include Spree::Sunspot::FilterSupport::InstanceMethods
helper_method :render_filter
EOV
end
end
module InstanceMethods
def filter
params.merge(self.send(:additional_filter_params)) if self.respond_to?(:additional_filter_params)
@searcher = Spree::Config.searcher_class.new(params)
@products = @searcher.retrieve_products
respond_with(@products)
end
def filter_url_options
object = instance_variable_get('@'+controller_name.singularize)
if object
case controller_name
when "products"
hash_for_product_path(object)
when "taxons"
hash_for_taxon_short_path(object)
end
else
{}
end
end
+ end
+ module Helpers
def render_filter
filter_params = Spree::Sunspot::Setup.filters.collect{|filter| filter.parse(params)}
render :partial => 'spree/shared/filter', :locals => { :filter_params => filter_params }
end
end
end
end
end | 2 | 0.040816 | 2 | 0 |
a878ff8221fce9ac339c7af238ed429b3da931e9 | documentation/src/test/java/extensions/ExpectToFailExtension.java | documentation/src/test/java/extensions/ExpectToFailExtension.java | /*
* Copyright 2015-2016 the original author or authors.
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution and is available at
*
* http://www.eclipse.org/legal/epl-v10.html
*/
package extensions;
import org.junit.gen5.api.Assertions;
import org.junit.gen5.api.extension.AfterEachExtensionPoint;
import org.junit.gen5.api.extension.ExceptionHandlerExtensionPoint;
import org.junit.gen5.api.extension.ExtensionContext.Namespace;
import org.junit.gen5.api.extension.ExtensionContext.Store;
import org.junit.gen5.api.extension.TestExtensionContext;
import org.opentest4j.AssertionFailedError;
public class ExpectToFailExtension implements ExceptionHandlerExtensionPoint, AfterEachExtensionPoint {
@Override
public void handleException(TestExtensionContext context, Throwable throwable) throws Throwable {
if (throwable instanceof AssertionFailedError) {
getExceptionStore(context).put("exception", throwable);
return;
}
throw throwable;
}
private Store getExceptionStore(TestExtensionContext context) {
return context.getStore(Namespace.of(context));
}
@Override
public void afterEach(TestExtensionContext context) throws Exception {
if (getExceptionStore(context).get("exception") == null)
Assertions.fail("Test should have failed");
}
}
| /*
* Copyright 2015-2016 the original author or authors.
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution and is available at
*
* http://www.eclipse.org/legal/epl-v10.html
*/
package extensions;
import static org.junit.gen5.api.Assertions.assertNotNull;
import org.junit.gen5.api.extension.AfterEachExtensionPoint;
import org.junit.gen5.api.extension.ExceptionHandlerExtensionPoint;
import org.junit.gen5.api.extension.ExtensionContext.Namespace;
import org.junit.gen5.api.extension.ExtensionContext.Store;
import org.junit.gen5.api.extension.TestExtensionContext;
import org.opentest4j.AssertionFailedError;
public class ExpectToFailExtension implements ExceptionHandlerExtensionPoint, AfterEachExtensionPoint {
@Override
public void handleException(TestExtensionContext context, Throwable throwable) throws Throwable {
if (throwable instanceof AssertionFailedError) {
getExceptionStore(context).put("exception", throwable);
return;
}
throw throwable;
}
@Override
public void afterEach(TestExtensionContext context) throws Exception {
assertNotNull(getExceptionStore(context).get("exception"), "Test should have failed");
}
private Store getExceptionStore(TestExtensionContext context) {
return context.getStore(Namespace.of(context));
}
}
| Use assertNotNull instead of `if` | Use assertNotNull instead of `if`
| Java | epl-1.0 | marcphilipp/junit5,junit-team/junit-lambda,marcphilipp/junit-lambda,sbrannen/junit-lambda | java | ## Code Before:
/*
* Copyright 2015-2016 the original author or authors.
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution and is available at
*
* http://www.eclipse.org/legal/epl-v10.html
*/
package extensions;
import org.junit.gen5.api.Assertions;
import org.junit.gen5.api.extension.AfterEachExtensionPoint;
import org.junit.gen5.api.extension.ExceptionHandlerExtensionPoint;
import org.junit.gen5.api.extension.ExtensionContext.Namespace;
import org.junit.gen5.api.extension.ExtensionContext.Store;
import org.junit.gen5.api.extension.TestExtensionContext;
import org.opentest4j.AssertionFailedError;
public class ExpectToFailExtension implements ExceptionHandlerExtensionPoint, AfterEachExtensionPoint {
@Override
public void handleException(TestExtensionContext context, Throwable throwable) throws Throwable {
if (throwable instanceof AssertionFailedError) {
getExceptionStore(context).put("exception", throwable);
return;
}
throw throwable;
}
private Store getExceptionStore(TestExtensionContext context) {
return context.getStore(Namespace.of(context));
}
@Override
public void afterEach(TestExtensionContext context) throws Exception {
if (getExceptionStore(context).get("exception") == null)
Assertions.fail("Test should have failed");
}
}
## Instruction:
Use assertNotNull instead of `if`
## Code After:
/*
* Copyright 2015-2016 the original author or authors.
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution and is available at
*
* http://www.eclipse.org/legal/epl-v10.html
*/
package extensions;
import static org.junit.gen5.api.Assertions.assertNotNull;
import org.junit.gen5.api.extension.AfterEachExtensionPoint;
import org.junit.gen5.api.extension.ExceptionHandlerExtensionPoint;
import org.junit.gen5.api.extension.ExtensionContext.Namespace;
import org.junit.gen5.api.extension.ExtensionContext.Store;
import org.junit.gen5.api.extension.TestExtensionContext;
import org.opentest4j.AssertionFailedError;
public class ExpectToFailExtension implements ExceptionHandlerExtensionPoint, AfterEachExtensionPoint {
@Override
public void handleException(TestExtensionContext context, Throwable throwable) throws Throwable {
if (throwable instanceof AssertionFailedError) {
getExceptionStore(context).put("exception", throwable);
return;
}
throw throwable;
}
@Override
public void afterEach(TestExtensionContext context) throws Exception {
assertNotNull(getExceptionStore(context).get("exception"), "Test should have failed");
}
private Store getExceptionStore(TestExtensionContext context) {
return context.getStore(Namespace.of(context));
}
}
| /*
* Copyright 2015-2016 the original author or authors.
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution and is available at
*
* http://www.eclipse.org/legal/epl-v10.html
*/
package extensions;
- import org.junit.gen5.api.Assertions;
+ import static org.junit.gen5.api.Assertions.assertNotNull;
? +++++++ ++++++++++++++
+
import org.junit.gen5.api.extension.AfterEachExtensionPoint;
import org.junit.gen5.api.extension.ExceptionHandlerExtensionPoint;
import org.junit.gen5.api.extension.ExtensionContext.Namespace;
import org.junit.gen5.api.extension.ExtensionContext.Store;
import org.junit.gen5.api.extension.TestExtensionContext;
import org.opentest4j.AssertionFailedError;
public class ExpectToFailExtension implements ExceptionHandlerExtensionPoint, AfterEachExtensionPoint {
@Override
public void handleException(TestExtensionContext context, Throwable throwable) throws Throwable {
if (throwable instanceof AssertionFailedError) {
getExceptionStore(context).put("exception", throwable);
return;
}
throw throwable;
}
+ @Override
+ public void afterEach(TestExtensionContext context) throws Exception {
+ assertNotNull(getExceptionStore(context).get("exception"), "Test should have failed");
+ }
+
private Store getExceptionStore(TestExtensionContext context) {
return context.getStore(Namespace.of(context));
}
-
- @Override
- public void afterEach(TestExtensionContext context) throws Exception {
- if (getExceptionStore(context).get("exception") == null)
- Assertions.fail("Test should have failed");
- }
} | 14 | 0.341463 | 7 | 7 |
159340d083d68c6d991e0a8c7604e864570ca584 | Package.swift | Package.swift | import PackageDescription
let package = Package(
name: "SwiftServer",
targets: [
Target(
name: "examples",
dependencies: [.Target(name: "HTTP")]),
Target(
name: "HTTP",
dependencies: [.Target(name: "utils")])
]
)
| import PackageDescription
let package = Package(
name: "SwiftServer",
targets: [
Target(
name: "HTTP",
dependencies: [.Target(name: "utils"), .Target(name: "libc")]),
Target(
name: "utils",
dependencies: [.Target(name: "libc")]),
Target(
name: "examples",
dependencies: [.Target(name: "HTTP")])
]
)
| Add libc to Target list | Add libc to Target list
| Swift | bsd-3-clause | tmn/swift-http-server,tmn/swift-http-server | swift | ## Code Before:
import PackageDescription
let package = Package(
name: "SwiftServer",
targets: [
Target(
name: "examples",
dependencies: [.Target(name: "HTTP")]),
Target(
name: "HTTP",
dependencies: [.Target(name: "utils")])
]
)
## Instruction:
Add libc to Target list
## Code After:
import PackageDescription
let package = Package(
name: "SwiftServer",
targets: [
Target(
name: "HTTP",
dependencies: [.Target(name: "utils"), .Target(name: "libc")]),
Target(
name: "utils",
dependencies: [.Target(name: "libc")]),
Target(
name: "examples",
dependencies: [.Target(name: "HTTP")])
]
)
| import PackageDescription
let package = Package(
name: "SwiftServer",
targets: [
Target(
+ name: "HTTP",
+ dependencies: [.Target(name: "utils"), .Target(name: "libc")]),
+ Target(
+ name: "utils",
+ dependencies: [.Target(name: "libc")]),
+ Target(
name: "examples",
- dependencies: [.Target(name: "HTTP")]),
? -
+ dependencies: [.Target(name: "HTTP")])
- Target(
- name: "HTTP",
- dependencies: [.Target(name: "utils")])
]
) | 11 | 0.846154 | 7 | 4 |
6569018de7658bddf1ea1afd7d65b79009df1485 | .travis.yml | .travis.yml | install:
- pip install pbs
- python provision.py --travis
cache: apt
language: python
python:
- "2.7"
# command to run tests
script:
- source /srv/zulip-venv/bin/activate && env PATH=$PATH:/srv/zulip-venv/bin ./tools/test-all
sudo: required
services:
- docker
addons:
postgresql: "9.3"
| install:
- pip install pbs
- python provision.py --travis
cache:
- apt: false
language: python
python:
- "2.7"
# command to run tests
script:
- source /srv/zulip-venv/bin/activate && env PATH=$PATH:/srv/zulip-venv/bin ./tools/test-all
sudo: required
services:
- docker
addons:
postgresql: "9.3"
| Disable apt caching in Travis CI configuration. | Disable apt caching in Travis CI configuration.
Apparently it isn't supposed to work reliably with the container-based
infrastructure that we're using and empirically it's causing build
failures.
Thanks to @mijime for tracking this down.
| YAML | apache-2.0 | joyhchen/zulip,jrowan/zulip,synicalsyntax/zulip,timabbott/zulip,KingxBanana/zulip,jackrzhang/zulip,andersk/zulip,Diptanshu8/zulip,Frouk/zulip,amanharitsh123/zulip,ashwinirudrappa/zulip,jainayush975/zulip,rishig/zulip,SmartPeople/zulip,zulip/zulip,grave-w-grave/zulip,zacps/zulip,KingxBanana/zulip,KingxBanana/zulip,ahmadassaf/zulip,hackerkid/zulip,dwrpayne/zulip,Vallher/zulip,Jianchun1/zulip,isht3/zulip,Galexrt/zulip,isht3/zulip,jainayush975/zulip,timabbott/zulip,susansls/zulip,ryansnowboarder/zulip,esander91/zulip,ashwinirudrappa/zulip,peiwei/zulip,hackerkid/zulip,christi3k/zulip,j831/zulip,Jianchun1/zulip,SmartPeople/zulip,dattatreya303/zulip,vakila/zulip,cosmicAsymmetry/zulip,vakila/zulip,peguin40/zulip,gkotian/zulip,SmartPeople/zulip,AZtheAsian/zulip,jackrzhang/zulip,christi3k/zulip,dhcrzf/zulip,rishig/zulip,alliejones/zulip,dattatreya303/zulip,synicalsyntax/zulip,Frouk/zulip,alliejones/zulip,Vallher/zulip,mohsenSy/zulip,verma-varsha/zulip,sonali0901/zulip,amyliu345/zulip,ryanbackman/zulip,rishig/zulip,arpith/zulip,peguin40/zulip,jrowan/zulip,krtkmj/zulip,verma-varsha/zulip,grave-w-grave/zulip,ryanbackman/zulip,punchagan/zulip,dawran6/zulip,Diptanshu8/zulip,reyha/zulip,amanharitsh123/zulip,amanharitsh123/zulip,verma-varsha/zulip,AZtheAsian/zulip,AZtheAsian/zulip,vikas-parashar/zulip,mahim97/zulip,krtkmj/zulip,ryansnowboarder/zulip,Jianchun1/zulip,Juanvulcano/zulip,atomic-labs/zulip,krtkmj/zulip,amyliu345/zulip,calvinleenyc/zulip,rishig/zulip,karamcnair/zulip,sharmaeklavya2/zulip,karamcnair/zulip,hackerkid/zulip,j831/zulip,dawran6/zulip,Vallher/zulip,andersk/zulip,atomic-labs/zulip,vikas-parashar/zulip,dhcrzf/zulip,ryansnowboarder/zulip,SmartPeople/zulip,cosmicAsymmetry/zulip,vaidap/zulip,rishig/zulip,Galexrt/zulip,ashwinirudrappa/zulip,PhilSk/zulip,kou/zulip,brainwane/zulip,Diptanshu8/zulip,amyliu345/zulip,mohsenSy/zulip,KingxBanana/zulip,TigorC/zulip,krtkmj/zulip,zacps/zulip,SmartPeople/zulip,mahim97/zulip,ryansnowboarder/zulip,ashwinirudrappa/zulip,jrowan/zulip,jphilipsen05/zulip,aakash-cr7/zulip,blaze225/zulip,atomic-labs/zulip,shubhamdhama/zulip,esander91/zulip,calvinleenyc/zulip,atomic-labs/zulip,vaidap/zulip,umkay/zulip,timabbott/zulip,souravbadami/zulip,mohsenSy/zulip,showell/zulip,souravbadami/zulip,AZtheAsian/zulip,Frouk/zulip,andersk/zulip,brockwhittaker/zulip,brockwhittaker/zulip,ryanbackman/zulip,aakash-cr7/zulip,jackrzhang/zulip,dawran6/zulip,hackerkid/zulip,karamcnair/zulip,dattatreya303/zulip,samatdav/zulip,vakila/zulip,umkay/zulip,sharmaeklavya2/zulip,Vallher/zulip,alliejones/zulip,shubhamdhama/zulip,ashwinirudrappa/zulip,andersk/zulip,zulip/zulip,calvinleenyc/zulip,vaidap/zulip,umkay/zulip,sonali0901/zulip,jphilipsen05/zulip,dhcrzf/zulip,grave-w-grave/zulip,tommyip/zulip,dhcrzf/zulip,vakila/zulip,j831/zulip,grave-w-grave/zulip,blaze225/zulip,TigorC/zulip,vabs22/zulip,karamcnair/zulip,joyhchen/zulip,hackerkid/zulip,samatdav/zulip,shubhamdhama/zulip,Vallher/zulip,verma-varsha/zulip,shubhamdhama/zulip,kou/zulip,sup95/zulip,PhilSk/zulip,brockwhittaker/zulip,joyhchen/zulip,dhcrzf/zulip,PhilSk/zulip,mahim97/zulip,cosmicAsymmetry/zulip,christi3k/zulip,ashwinirudrappa/zulip,synicalsyntax/zulip,joyhchen/zulip,JPJPJPOPOP/zulip,amanharitsh123/zulip,paxapy/zulip,alliejones/zulip,niftynei/zulip,jrowan/zulip,zacps/zulip,vikas-parashar/zulip,Diptanshu8/zulip,PhilSk/zulip,peguin40/zulip,susansls/zulip,PhilSk/zulip,samatdav/zulip,mohsenSy/zulip,amanharitsh123/zulip,karamcnair/zulip,dhcrzf/zulip,peiwei/zulip,jphilipsen05/zulip,vabs22/zulip,gkotian/zulip,Frouk/zulip,sup95/zulip,krtkmj/zulip,umkay/zulip,zacps/zulip,samatdav/zulip,jackrzhang/zulip,punchagan/zulip,blaze225/zulip,TigorC/zulip,peiwei/zulip,susansls/zulip,aakash-cr7/zulip,gkotian/zulip,JPJPJPOPOP/zulip,samatdav/zulip,tommyip/zulip,paxapy/zulip,tommyip/zulip,niftynei/zulip,tommyip/zulip,peguin40/zulip,Juanvulcano/zulip,Jianchun1/zulip,ahmadassaf/zulip,aakash-cr7/zulip,amanharitsh123/zulip,karamcnair/zulip,Diptanshu8/zulip,sup95/zulip,susansls/zulip,vaidap/zulip,showell/zulip,aakash-cr7/zulip,dhcrzf/zulip,samatdav/zulip,Juanvulcano/zulip,isht3/zulip,brockwhittaker/zulip,ahmadassaf/zulip,isht3/zulip,Vallher/zulip,zulip/zulip,jainayush975/zulip,atomic-labs/zulip,cosmicAsymmetry/zulip,andersk/zulip,vakila/zulip,j831/zulip,showell/zulip,sonali0901/zulip,amyliu345/zulip,gkotian/zulip,reyha/zulip,zulip/zulip,esander91/zulip,ahmadassaf/zulip,susansls/zulip,dattatreya303/zulip,sonali0901/zulip,peiwei/zulip,Juanvulcano/zulip,vabs22/zulip,arpith/zulip,sharmaeklavya2/zulip,blaze225/zulip,joyhchen/zulip,jainayush975/zulip,peiwei/zulip,eeshangarg/zulip,grave-w-grave/zulip,shubhamdhama/zulip,Frouk/zulip,AZtheAsian/zulip,synicalsyntax/zulip,vaidap/zulip,punchagan/zulip,dwrpayne/zulip,peguin40/zulip,jainayush975/zulip,calvinleenyc/zulip,mahim97/zulip,Jianchun1/zulip,dawran6/zulip,andersk/zulip,punchagan/zulip,synicalsyntax/zulip,paxapy/zulip,JPJPJPOPOP/zulip,sonali0901/zulip,krtkmj/zulip,ahmadassaf/zulip,ahmadassaf/zulip,mahim97/zulip,vaidap/zulip,ashwinirudrappa/zulip,sup95/zulip,dattatreya303/zulip,jphilipsen05/zulip,vabs22/zulip,Juanvulcano/zulip,reyha/zulip,KingxBanana/zulip,Frouk/zulip,gkotian/zulip,amyliu345/zulip,christi3k/zulip,vakila/zulip,sharmaeklavya2/zulip,brainwane/zulip,ryanbackman/zulip,rht/zulip,peiwei/zulip,Juanvulcano/zulip,tommyip/zulip,timabbott/zulip,rht/zulip,Galexrt/zulip,brainwane/zulip,dawran6/zulip,vakila/zulip,blaze225/zulip,JPJPJPOPOP/zulip,sharmaeklavya2/zulip,reyha/zulip,TigorC/zulip,sonali0901/zulip,esander91/zulip,jackrzhang/zulip,eeshangarg/zulip,Vallher/zulip,JPJPJPOPOP/zulip,timabbott/zulip,dwrpayne/zulip,paxapy/zulip,aakash-cr7/zulip,showell/zulip,verma-varsha/zulip,shubhamdhama/zulip,dwrpayne/zulip,souravbadami/zulip,niftynei/zulip,ryansnowboarder/zulip,dwrpayne/zulip,alliejones/zulip,PhilSk/zulip,paxapy/zulip,esander91/zulip,arpith/zulip,dwrpayne/zulip,atomic-labs/zulip,rht/zulip,jackrzhang/zulip,eeshangarg/zulip,christi3k/zulip,ryanbackman/zulip,arpith/zulip,KingxBanana/zulip,rishig/zulip,dwrpayne/zulip,esander91/zulip,jrowan/zulip,grave-w-grave/zulip,alliejones/zulip,vikas-parashar/zulip,dattatreya303/zulip,paxapy/zulip,andersk/zulip,Diptanshu8/zulip,souravbadami/zulip,kou/zulip,timabbott/zulip,vikas-parashar/zulip,rht/zulip,eeshangarg/zulip,ahmadassaf/zulip,niftynei/zulip,dawran6/zulip,calvinleenyc/zulip,synicalsyntax/zulip,niftynei/zulip,Galexrt/zulip,gkotian/zulip,reyha/zulip,krtkmj/zulip,Galexrt/zulip,shubhamdhama/zulip,ryanbackman/zulip,brainwane/zulip,timabbott/zulip,j831/zulip,punchagan/zulip,zulip/zulip,vikas-parashar/zulip,hackerkid/zulip,jackrzhang/zulip,peiwei/zulip,AZtheAsian/zulip,mahim97/zulip,rht/zulip,JPJPJPOPOP/zulip,amyliu345/zulip,isht3/zulip,umkay/zulip,umkay/zulip,souravbadami/zulip,zulip/zulip,ryansnowboarder/zulip,calvinleenyc/zulip,brainwane/zulip,umkay/zulip,hackerkid/zulip,alliejones/zulip,souravbadami/zulip,sharmaeklavya2/zulip,brainwane/zulip,cosmicAsymmetry/zulip,brockwhittaker/zulip,tommyip/zulip,atomic-labs/zulip,eeshangarg/zulip,blaze225/zulip,eeshangarg/zulip,showell/zulip,rht/zulip,kou/zulip,esander91/zulip,vabs22/zulip,zulip/zulip,eeshangarg/zulip,gkotian/zulip,christi3k/zulip,Jianchun1/zulip,karamcnair/zulip,zacps/zulip,verma-varsha/zulip,TigorC/zulip,joyhchen/zulip,isht3/zulip,brockwhittaker/zulip,Galexrt/zulip,kou/zulip,Galexrt/zulip,kou/zulip,rht/zulip,peguin40/zulip,niftynei/zulip,punchagan/zulip,showell/zulip,mohsenSy/zulip,sup95/zulip,jainayush975/zulip,synicalsyntax/zulip,kou/zulip,showell/zulip,jphilipsen05/zulip,zacps/zulip,rishig/zulip,arpith/zulip,SmartPeople/zulip,punchagan/zulip,cosmicAsymmetry/zulip,TigorC/zulip,sup95/zulip,jrowan/zulip,Frouk/zulip,mohsenSy/zulip,tommyip/zulip,j831/zulip,susansls/zulip,vabs22/zulip,ryansnowboarder/zulip,jphilipsen05/zulip,reyha/zulip,arpith/zulip,brainwane/zulip | yaml | ## Code Before:
install:
- pip install pbs
- python provision.py --travis
cache: apt
language: python
python:
- "2.7"
# command to run tests
script:
- source /srv/zulip-venv/bin/activate && env PATH=$PATH:/srv/zulip-venv/bin ./tools/test-all
sudo: required
services:
- docker
addons:
postgresql: "9.3"
## Instruction:
Disable apt caching in Travis CI configuration.
Apparently it isn't supposed to work reliably with the container-based
infrastructure that we're using and empirically it's causing build
failures.
Thanks to @mijime for tracking this down.
## Code After:
install:
- pip install pbs
- python provision.py --travis
cache:
- apt: false
language: python
python:
- "2.7"
# command to run tests
script:
- source /srv/zulip-venv/bin/activate && env PATH=$PATH:/srv/zulip-venv/bin ./tools/test-all
sudo: required
services:
- docker
addons:
postgresql: "9.3"
| install:
- pip install pbs
- python provision.py --travis
- cache: apt
? ----
+ cache:
+ - apt: false
language: python
python:
- "2.7"
# command to run tests
script:
- source /srv/zulip-venv/bin/activate && env PATH=$PATH:/srv/zulip-venv/bin ./tools/test-all
sudo: required
services:
- docker
addons:
postgresql: "9.3" | 3 | 0.2 | 2 | 1 |
cdeb247928b2a9490e2de8c1eed0988b732a25a5 | .github/workflows/rust.yml | .github/workflows/rust.yml | name: Rust
on:
push:
pull_request:
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Check bootstrap
run: ./bootstrap.sh && git diff --exit-code
- name: Run tests
run: cargo test --all
| name: Rust
on:
push:
pull_request:
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Check bootstrap
run: ./bootstrap.sh && git diff --exit-code
- name: Run tests
run: cargo test --all
- name: Run tests with all features
run: cargo test --all --all-features
| Test with --trace in GitHub Actions | Test with --trace in GitHub Actions
| YAML | mit | kevinmehall/rust-peg,kevinmehall/rust-peg | yaml | ## Code Before:
name: Rust
on:
push:
pull_request:
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Check bootstrap
run: ./bootstrap.sh && git diff --exit-code
- name: Run tests
run: cargo test --all
## Instruction:
Test with --trace in GitHub Actions
## Code After:
name: Rust
on:
push:
pull_request:
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Check bootstrap
run: ./bootstrap.sh && git diff --exit-code
- name: Run tests
run: cargo test --all
- name: Run tests with all features
run: cargo test --all --all-features
| name: Rust
on:
push:
pull_request:
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Check bootstrap
run: ./bootstrap.sh && git diff --exit-code
- name: Run tests
run: cargo test --all
+ - name: Run tests with all features
+ run: cargo test --all --all-features | 2 | 0.1 | 2 | 0 |
04b4bd6f20a7072a8cca67a8b79e68d9636ebd39 | maps.php | maps.php | <?php
class maps extends Script
{
public function run()
{
switch (strtolower($this->matches[1])) {
case 'hybridmap':
$this->type = 'hybrid';
break;
case 'satellitemap':
$this->type = 'satellite';
break;
case 'terrainmap':
$this->type = 'terrain';
break;
default:
$this->type = 'roadmap';
break;
}
return $this->send('http://maps.google.com/maps/api/staticmap?markers=' . rawurlencode($this->matches[2]) . '&size=640x640&maptype=' . $this->type . '&sensor=false&format=png', 'image');
}
}
| <?php
class maps extends Script
{
protected $helpMessage = "'map LOCATION': Returns a roadmap\n"
."'satellitemap LOCATION': Returns a satellitemap\n"
."'hybridmap LOCATION': Returns a hybridmap"
."'terrainmap LOCATION': Returns a terrainmap";
protected $description = 'Returns a map of the given location';
public function run()
{
switch (strtolower($this->matches[1])) {
case 'hybridmap':
$this->type = 'hybrid';
break;
case 'satellitemap':
$this->type = 'satellite';
break;
case 'terrainmap':
$this->type = 'terrain';
break;
default:
$this->type = 'roadmap';
break;
}
return $this->send('http://maps.google.com/maps/api/staticmap?markers=' . rawurlencode($this->matches[2]) . '&size=640x640&maptype=' . $this->type . '&sensor=false&format=png', 'image');
}
}
| Complete the information for the help-plugin | Complete the information for the help-plugin
| PHP | mit | Detlefff/Detlefff-Maps | php | ## Code Before:
<?php
class maps extends Script
{
public function run()
{
switch (strtolower($this->matches[1])) {
case 'hybridmap':
$this->type = 'hybrid';
break;
case 'satellitemap':
$this->type = 'satellite';
break;
case 'terrainmap':
$this->type = 'terrain';
break;
default:
$this->type = 'roadmap';
break;
}
return $this->send('http://maps.google.com/maps/api/staticmap?markers=' . rawurlencode($this->matches[2]) . '&size=640x640&maptype=' . $this->type . '&sensor=false&format=png', 'image');
}
}
## Instruction:
Complete the information for the help-plugin
## Code After:
<?php
class maps extends Script
{
protected $helpMessage = "'map LOCATION': Returns a roadmap\n"
."'satellitemap LOCATION': Returns a satellitemap\n"
."'hybridmap LOCATION': Returns a hybridmap"
."'terrainmap LOCATION': Returns a terrainmap";
protected $description = 'Returns a map of the given location';
public function run()
{
switch (strtolower($this->matches[1])) {
case 'hybridmap':
$this->type = 'hybrid';
break;
case 'satellitemap':
$this->type = 'satellite';
break;
case 'terrainmap':
$this->type = 'terrain';
break;
default:
$this->type = 'roadmap';
break;
}
return $this->send('http://maps.google.com/maps/api/staticmap?markers=' . rawurlencode($this->matches[2]) . '&size=640x640&maptype=' . $this->type . '&sensor=false&format=png', 'image');
}
}
| <?php
class maps extends Script
{
+ protected $helpMessage = "'map LOCATION': Returns a roadmap\n"
+ ."'satellitemap LOCATION': Returns a satellitemap\n"
+ ."'hybridmap LOCATION': Returns a hybridmap"
+ ."'terrainmap LOCATION': Returns a terrainmap";
+ protected $description = 'Returns a map of the given location';
+
public function run()
{
switch (strtolower($this->matches[1])) {
case 'hybridmap':
$this->type = 'hybrid';
break;
case 'satellitemap':
$this->type = 'satellite';
break;
case 'terrainmap':
$this->type = 'terrain';
break;
default:
$this->type = 'roadmap';
break;
}
return $this->send('http://maps.google.com/maps/api/staticmap?markers=' . rawurlencode($this->matches[2]) . '&size=640x640&maptype=' . $this->type . '&sensor=false&format=png', 'image');
}
} | 6 | 0.26087 | 6 | 0 |
91fa1a8eec10b83aa5142d9519a3759b4e310cff | bluebottle/test/factory_models/accounts.py | bluebottle/test/factory_models/accounts.py | from builtins import object
import factory
from django.contrib.auth.models import Group
from bluebottle.members.models import Member
class BlueBottleUserFactory(factory.DjangoModelFactory):
class Meta(object):
model = Member
username = factory.Faker('email')
email = factory.Faker('email')
first_name = factory.Sequence(lambda f: u'user_{0}'.format(f))
last_name = factory.Sequence(lambda l: u'user_{0}'.format(l))
is_active = True
is_staff = False
is_superuser = False
@classmethod
def _create(cls, model_class, *args, **kwargs):
user = super(BlueBottleUserFactory, cls)._create(model_class, *args, **kwargs)
# ensure the raw password gets set after the initial save
password = kwargs.pop("password", None)
if password:
user.set_password(password)
user.save()
return user
class GroupFactory(factory.DjangoModelFactory):
class Meta(object):
model = Group
name = factory.Sequence(lambda n: u'group_{0}'.format(n))
| from builtins import object
import factory
from django.contrib.auth.models import Group
from bluebottle.members.models import Member
class BlueBottleUserFactory(factory.DjangoModelFactory):
class Meta(object):
model = Member
username = factory.Sequence(lambda n: u'user_{0}'.format(n))
email = factory.Sequence(lambda o: u'user_{0}@onepercentclub.com'.format(o))
first_name = factory.Sequence(lambda f: u'user_{0}'.format(f))
last_name = factory.Sequence(lambda l: u'user_{0}'.format(l))
is_active = True
is_staff = False
is_superuser = False
@classmethod
def _create(cls, model_class, *args, **kwargs):
user = super(BlueBottleUserFactory, cls)._create(model_class, *args, **kwargs)
# ensure the raw password gets set after the initial save
password = kwargs.pop("password", None)
if password:
user.set_password(password)
user.save()
return user
class GroupFactory(factory.DjangoModelFactory):
class Meta(object):
model = Group
name = factory.Sequence(lambda n: u'group_{0}'.format(n))
| Fix duplicate users during tests | Fix duplicate users during tests
| Python | bsd-3-clause | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | python | ## Code Before:
from builtins import object
import factory
from django.contrib.auth.models import Group
from bluebottle.members.models import Member
class BlueBottleUserFactory(factory.DjangoModelFactory):
class Meta(object):
model = Member
username = factory.Faker('email')
email = factory.Faker('email')
first_name = factory.Sequence(lambda f: u'user_{0}'.format(f))
last_name = factory.Sequence(lambda l: u'user_{0}'.format(l))
is_active = True
is_staff = False
is_superuser = False
@classmethod
def _create(cls, model_class, *args, **kwargs):
user = super(BlueBottleUserFactory, cls)._create(model_class, *args, **kwargs)
# ensure the raw password gets set after the initial save
password = kwargs.pop("password", None)
if password:
user.set_password(password)
user.save()
return user
class GroupFactory(factory.DjangoModelFactory):
class Meta(object):
model = Group
name = factory.Sequence(lambda n: u'group_{0}'.format(n))
## Instruction:
Fix duplicate users during tests
## Code After:
from builtins import object
import factory
from django.contrib.auth.models import Group
from bluebottle.members.models import Member
class BlueBottleUserFactory(factory.DjangoModelFactory):
class Meta(object):
model = Member
username = factory.Sequence(lambda n: u'user_{0}'.format(n))
email = factory.Sequence(lambda o: u'user_{0}@onepercentclub.com'.format(o))
first_name = factory.Sequence(lambda f: u'user_{0}'.format(f))
last_name = factory.Sequence(lambda l: u'user_{0}'.format(l))
is_active = True
is_staff = False
is_superuser = False
@classmethod
def _create(cls, model_class, *args, **kwargs):
user = super(BlueBottleUserFactory, cls)._create(model_class, *args, **kwargs)
# ensure the raw password gets set after the initial save
password = kwargs.pop("password", None)
if password:
user.set_password(password)
user.save()
return user
class GroupFactory(factory.DjangoModelFactory):
class Meta(object):
model = Group
name = factory.Sequence(lambda n: u'group_{0}'.format(n))
| from builtins import object
import factory
from django.contrib.auth.models import Group
from bluebottle.members.models import Member
class BlueBottleUserFactory(factory.DjangoModelFactory):
class Meta(object):
model = Member
- username = factory.Faker('email')
- email = factory.Faker('email')
+ username = factory.Sequence(lambda n: u'user_{0}'.format(n))
+ email = factory.Sequence(lambda o: u'user_{0}@onepercentclub.com'.format(o))
first_name = factory.Sequence(lambda f: u'user_{0}'.format(f))
last_name = factory.Sequence(lambda l: u'user_{0}'.format(l))
is_active = True
is_staff = False
is_superuser = False
@classmethod
def _create(cls, model_class, *args, **kwargs):
user = super(BlueBottleUserFactory, cls)._create(model_class, *args, **kwargs)
# ensure the raw password gets set after the initial save
password = kwargs.pop("password", None)
if password:
user.set_password(password)
user.save()
return user
class GroupFactory(factory.DjangoModelFactory):
class Meta(object):
model = Group
name = factory.Sequence(lambda n: u'group_{0}'.format(n)) | 4 | 0.111111 | 2 | 2 |
c1e8b8673d289e514e8044384c37f532357f24dd | composer.json | composer.json | {
"name": "flancer32/sample_mage2_module",
"description": "Magento 2 module sample (with development environment).",
"require": {
"magento/framework": "0.1.*"
},
"type": "magento2-module",
"version": "0.1.0",
"extra": {
"map": [
[
"src/*",
"Flancer32/Sample"
]
]
},
"authors": [
{
"name": "Alex Gusev",
"email": "flancer64@gmail.com",
"role": "Developer"
}
]
} | {
"name": "flancer32/sample_mage2_module",
"description": "Magento 2 module sample (with development environment).",
"require": {
"magento/framework": "~1.0.0"
},
"type": "magento2-module",
"extra": {
"map": [
[
"src/*",
"Flancer32/Sample"
]
]
},
"authors": [
{
"name": "Alex Gusev",
"email": "flancer64@gmail.com",
"role": "Developer"
}
]
} | Create sample module for M2 | Create sample module for M2
| JSON | mit | flancer32/sample_mage2_module,flancer32/sample_mage2_module | json | ## Code Before:
{
"name": "flancer32/sample_mage2_module",
"description": "Magento 2 module sample (with development environment).",
"require": {
"magento/framework": "0.1.*"
},
"type": "magento2-module",
"version": "0.1.0",
"extra": {
"map": [
[
"src/*",
"Flancer32/Sample"
]
]
},
"authors": [
{
"name": "Alex Gusev",
"email": "flancer64@gmail.com",
"role": "Developer"
}
]
}
## Instruction:
Create sample module for M2
## Code After:
{
"name": "flancer32/sample_mage2_module",
"description": "Magento 2 module sample (with development environment).",
"require": {
"magento/framework": "~1.0.0"
},
"type": "magento2-module",
"extra": {
"map": [
[
"src/*",
"Flancer32/Sample"
]
]
},
"authors": [
{
"name": "Alex Gusev",
"email": "flancer64@gmail.com",
"role": "Developer"
}
]
} | {
"name": "flancer32/sample_mage2_module",
"description": "Magento 2 module sample (with development environment).",
"require": {
- "magento/framework": "0.1.*"
? ^^^
+ "magento/framework": "~1.0.0"
? +++ ^
},
"type": "magento2-module",
- "version": "0.1.0",
"extra": {
"map": [
[
"src/*",
"Flancer32/Sample"
]
]
},
"authors": [
{
"name": "Alex Gusev",
"email": "flancer64@gmail.com",
"role": "Developer"
}
]
} | 3 | 0.125 | 1 | 2 |
38352d9cbad0108ce02bce03736f40de2ada45d9 | index.js | index.js | 'use strict';
/**
* Module dependencies.
*/
var domToReact = require('./lib/dom-to-react');
var htmlToDOM;
/**
* Detect environment.
*/
/** Client (Browser). */
if (typeof window !== 'undefined' && this === window) {
htmlToDOM = require('./lib/html-to-dom-client');
/** Server (Node). */
} else {
htmlToDOM = require('./lib/html-to-dom-server');
}
/**
* Convert HTML to React.
*
* @param {String} html - The HTML.
* @param {Object} [options] - The additional options.
* @param {Function} [options.replace] - The replace method.
* @return {ReactElement|Array}
*/
module.exports = function(html, options) {
return domToReact(htmlToDOM(html), options);
};
| ;(function(factory) {
// CommonJS
if (typeof exports === 'object' && typeof module !== 'undefined') {
module.exports = factory();
// RequireJS (AMD)
} else if (typeof define === 'function' && define.amd) {
define([], factory());
// Browser (script tag)
} else {
var root;
if (typeof window !== 'undefined') {
root = window;
} else if (typeof global !== 'undefined') {
root = global;
} else if (typeof self !== 'undefined') {
root = self;
} else {
// works provided we're not in strict mode
root = this;
}
// define namespace
root.HTMLReactParser = factory();
}
})(function() {
var domToReact = require('./lib/dom-to-react');
var htmlToDOM;
// client (browser)
if (typeof window !== 'undefined' && this === window) {
htmlToDOM = require('./lib/html-to-dom-client');
// server (node)
} else {
htmlToDOM = require('./lib/html-to-dom-server');
}
/**
* Convert HTML string to React elements.
*
* @param {String} html - The HTML.
* @param {Object} [options] - The additional options.
* @param {Function} [options.replace] - The replace method.
* @return {ReactElement|Array}
*/
function HTMLReactParser(html, options) {
return domToReact(htmlToDOM(html), options);
}
// source
return HTMLReactParser;
});
| Make package UMD (Univeral Module Definition) compatible | Make package UMD (Univeral Module Definition) compatible
Wrap main logic so that it can be loaded by CommonJS (node and
bundlers like webpack), AMD (RequireJS), and browser script.
UMD template:
https://github.com/ForbesLindesay/umd/blob/master/template.js
| JavaScript | mit | remarkablemark/html-react-parser,remarkablemark/html-react-parser,remarkablemark/html-react-parser | javascript | ## Code Before:
'use strict';
/**
* Module dependencies.
*/
var domToReact = require('./lib/dom-to-react');
var htmlToDOM;
/**
* Detect environment.
*/
/** Client (Browser). */
if (typeof window !== 'undefined' && this === window) {
htmlToDOM = require('./lib/html-to-dom-client');
/** Server (Node). */
} else {
htmlToDOM = require('./lib/html-to-dom-server');
}
/**
* Convert HTML to React.
*
* @param {String} html - The HTML.
* @param {Object} [options] - The additional options.
* @param {Function} [options.replace] - The replace method.
* @return {ReactElement|Array}
*/
module.exports = function(html, options) {
return domToReact(htmlToDOM(html), options);
};
## Instruction:
Make package UMD (Univeral Module Definition) compatible
Wrap main logic so that it can be loaded by CommonJS (node and
bundlers like webpack), AMD (RequireJS), and browser script.
UMD template:
https://github.com/ForbesLindesay/umd/blob/master/template.js
## Code After:
;(function(factory) {
// CommonJS
if (typeof exports === 'object' && typeof module !== 'undefined') {
module.exports = factory();
// RequireJS (AMD)
} else if (typeof define === 'function' && define.amd) {
define([], factory());
// Browser (script tag)
} else {
var root;
if (typeof window !== 'undefined') {
root = window;
} else if (typeof global !== 'undefined') {
root = global;
} else if (typeof self !== 'undefined') {
root = self;
} else {
// works provided we're not in strict mode
root = this;
}
// define namespace
root.HTMLReactParser = factory();
}
})(function() {
var domToReact = require('./lib/dom-to-react');
var htmlToDOM;
// client (browser)
if (typeof window !== 'undefined' && this === window) {
htmlToDOM = require('./lib/html-to-dom-client');
// server (node)
} else {
htmlToDOM = require('./lib/html-to-dom-server');
}
/**
* Convert HTML string to React elements.
*
* @param {String} html - The HTML.
* @param {Object} [options] - The additional options.
* @param {Function} [options.replace] - The replace method.
* @return {ReactElement|Array}
*/
function HTMLReactParser(html, options) {
return domToReact(htmlToDOM(html), options);
}
// source
return HTMLReactParser;
});
| - 'use strict';
+ ;(function(factory) {
+ // CommonJS
+ if (typeof exports === 'object' && typeof module !== 'undefined') {
+ module.exports = factory();
- /**
- * Module dependencies.
- */
- var domToReact = require('./lib/dom-to-react');
- var htmlToDOM;
- /**
- * Detect environment.
- */
+ // RequireJS (AMD)
+ } else if (typeof define === 'function' && define.amd) {
+ define([], factory());
- /** Client (Browser). */
- if (typeof window !== 'undefined' && this === window) {
- htmlToDOM = require('./lib/html-to-dom-client');
+ // Browser (script tag)
+ } else {
+ var root;
+ if (typeof window !== 'undefined') {
+ root = window;
+ } else if (typeof global !== 'undefined') {
+ root = global;
+ } else if (typeof self !== 'undefined') {
+ root = self;
+ } else {
+ // works provided we're not in strict mode
+ root = this;
+ }
+ // define namespace
+ root.HTMLReactParser = factory();
+ }
- /** Server (Node). */
- } else {
- htmlToDOM = require('./lib/html-to-dom-server');
- }
- /**
- * Convert HTML to React.
- *
+ })(function() {
+
+ var domToReact = require('./lib/dom-to-react');
+ var htmlToDOM;
+
+ // client (browser)
+ if (typeof window !== 'undefined' && this === window) {
+ htmlToDOM = require('./lib/html-to-dom-client');
+
+ // server (node)
+ } else {
+ htmlToDOM = require('./lib/html-to-dom-server');
+ }
+
+ /**
+ * Convert HTML string to React elements.
+ *
- * @param {String} html - The HTML.
+ * @param {String} html - The HTML.
? ++++
- * @param {Object} [options] - The additional options.
+ * @param {Object} [options] - The additional options.
? ++++
- * @param {Function} [options.replace] - The replace method.
+ * @param {Function} [options.replace] - The replace method.
? ++++
- * @return {ReactElement|Array}
+ * @return {ReactElement|Array}
? ++++
- */
- module.exports = function(html, options) {
+ */
+ function HTMLReactParser(html, options) {
- return domToReact(htmlToDOM(html), options);
+ return domToReact(htmlToDOM(html), options);
? ++++
+ }
+
+ // source
+ return HTMLReactParser;
+
- };
+ });
? +
| 80 | 2.5 | 53 | 27 |
5c3d35defe614ed0ce8d4938eddbe95fb3764c7f | examples/websocket_streamgraph.html | examples/websocket_streamgraph.html | <!doctype html>
<!--[if lt IE 7]> <html class='no-js lt-ie9 lt-ie8 lt-ie7' lang=''> <![endif]-->
<!--[if IE 7]> <html class='no-js lt-ie9 lt-ie8' lang=''> <![endif]-->
<!--[if IE 8]> <html class='no-js lt-ie9' lang=''> <![endif]-->
<!--[if gt IE 8]><!-->
<html class='no-js' lang=''>
<!--<![endif]-->
<head>
<title>Websocket streamgraph</title>
<script src='../node_modules/d3/build/d3.min.js'></script>
<script src='../build/proteic.js'></script>
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">
</head <body>
<div id='chart'></div>
<script>
var data = {
endpoint: 'ws://192.168.3.32:3000/streamgraph'
};
var dataSource = new proteic.WebsocketDatasource(data);
//No draw() call, since it is connected to a endpoint and data is automaticaly drawn.
//Chart uses #chart selector by default
swimlane = new proteic.Streamgraph(dataSource);
//Start streaming
dataSource.start();
</script>
</body>
</html> | <!doctype html>
<!--[if lt IE 7]> <html class='no-js lt-ie9 lt-ie8 lt-ie7' lang=''> <![endif]-->
<!--[if IE 7]> <html class='no-js lt-ie9 lt-ie8' lang=''> <![endif]-->
<!--[if IE 8]> <html class='no-js lt-ie9' lang=''> <![endif]-->
<!--[if gt IE 8]><!-->
<html class='no-js' lang=''>
<!--<![endif]-->
<head>
<title>Websocket streamgraph</title>
<script src='../node_modules/d3/build/d3.min.js'></script>
<script src='../build/proteic.js'></script>
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">
</head <body>
<div id='chart'></div>
<script>
var data = {
endpoint: 'ws://192.168.3.32:3000/streamgraph'
};
var dataSource = new proteic.WebsocketDatasource(data);
//No draw() call, since it is connected to a endpoint and data is automaticaly drawn.
//Chart uses #chart selector by default
swimlane = new proteic.Streamgraph(dataSource, {
xAxisFormat: '%m/%d/%y',
xAxisLabel: 'Date'
});
//Start streaming
dataSource.start();
</script>
</body>
</html> | Change xAxisFormat in streamgraph example | Change xAxisFormat in streamgraph example
| HTML | apache-2.0 | proteus-h2020/proteus-charts,proteus-h2020/proteic,proteus-h2020/proteic,proteus-h2020/proteic | html | ## Code Before:
<!doctype html>
<!--[if lt IE 7]> <html class='no-js lt-ie9 lt-ie8 lt-ie7' lang=''> <![endif]-->
<!--[if IE 7]> <html class='no-js lt-ie9 lt-ie8' lang=''> <![endif]-->
<!--[if IE 8]> <html class='no-js lt-ie9' lang=''> <![endif]-->
<!--[if gt IE 8]><!-->
<html class='no-js' lang=''>
<!--<![endif]-->
<head>
<title>Websocket streamgraph</title>
<script src='../node_modules/d3/build/d3.min.js'></script>
<script src='../build/proteic.js'></script>
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">
</head <body>
<div id='chart'></div>
<script>
var data = {
endpoint: 'ws://192.168.3.32:3000/streamgraph'
};
var dataSource = new proteic.WebsocketDatasource(data);
//No draw() call, since it is connected to a endpoint and data is automaticaly drawn.
//Chart uses #chart selector by default
swimlane = new proteic.Streamgraph(dataSource);
//Start streaming
dataSource.start();
</script>
</body>
</html>
## Instruction:
Change xAxisFormat in streamgraph example
## Code After:
<!doctype html>
<!--[if lt IE 7]> <html class='no-js lt-ie9 lt-ie8 lt-ie7' lang=''> <![endif]-->
<!--[if IE 7]> <html class='no-js lt-ie9 lt-ie8' lang=''> <![endif]-->
<!--[if IE 8]> <html class='no-js lt-ie9' lang=''> <![endif]-->
<!--[if gt IE 8]><!-->
<html class='no-js' lang=''>
<!--<![endif]-->
<head>
<title>Websocket streamgraph</title>
<script src='../node_modules/d3/build/d3.min.js'></script>
<script src='../build/proteic.js'></script>
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">
</head <body>
<div id='chart'></div>
<script>
var data = {
endpoint: 'ws://192.168.3.32:3000/streamgraph'
};
var dataSource = new proteic.WebsocketDatasource(data);
//No draw() call, since it is connected to a endpoint and data is automaticaly drawn.
//Chart uses #chart selector by default
swimlane = new proteic.Streamgraph(dataSource, {
xAxisFormat: '%m/%d/%y',
xAxisLabel: 'Date'
});
//Start streaming
dataSource.start();
</script>
</body>
</html> | <!doctype html>
<!--[if lt IE 7]> <html class='no-js lt-ie9 lt-ie8 lt-ie7' lang=''> <![endif]-->
<!--[if IE 7]> <html class='no-js lt-ie9 lt-ie8' lang=''> <![endif]-->
<!--[if IE 8]> <html class='no-js lt-ie9' lang=''> <![endif]-->
<!--[if gt IE 8]><!-->
<html class='no-js' lang=''>
<!--<![endif]-->
<head>
<title>Websocket streamgraph</title>
<script src='../node_modules/d3/build/d3.min.js'></script>
<script src='../build/proteic.js'></script>
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">
</head <body>
<div id='chart'></div>
<script>
var data = {
endpoint: 'ws://192.168.3.32:3000/streamgraph'
};
var dataSource = new proteic.WebsocketDatasource(data);
//No draw() call, since it is connected to a endpoint and data is automaticaly drawn.
//Chart uses #chart selector by default
- swimlane = new proteic.Streamgraph(dataSource);
? ^^
+ swimlane = new proteic.Streamgraph(dataSource, {
? ^^^
+ xAxisFormat: '%m/%d/%y',
+ xAxisLabel: 'Date'
+ });
//Start streaming
dataSource.start();
</script>
</body>
</html> | 5 | 0.147059 | 4 | 1 |
4ed91668e9785c3c8831dc1272d165622cf54854 | ci/appveyor.yml | ci/appveyor.yml | environment:
test_profile: default
matrix:
- java_version: 1.6.0
- java_version: 1.7.0
- java_version: 1.8.0
test_profile: short
platform: x64
install:
- ps: .\ci\appveyor.ps1
build_script:
- ps: |
$env:JAVA_HOME="$($env:JAVA_8_HOME)"
mvn install -DskipTests=true -D"maven.javadoc.skip"=true -B -V
test_script:
- ps: |
$env:JAVA_HOME="$($env:JAVA_PLATFORM_HOME)"
mvn -B -D"ccm.java.home"="$($env:JAVA_8_HOME)" -D"ccm.maxNumberOfNodes"=1 -D"cassandra.version"=$($env:cassandra_version) test -P $($env:test_profile)
on_finish:
- ps: .\ci\uploadtests.ps1
cache:
- C:\Users\appveyor\.m2
- C:\Users\appveyor\.ccm\repository
- C:\Users\appveyor\deps -> .\ci\appveyor.ps1
| environment:
test_profile: default
matrix:
- java_version: 1.6.0
- java_version: 1.7.0
- java_version: 1.8.0
test_profile: short
platform: x64
install:
- ps: .\ci\appveyor.ps1
build_script:
- "set \"JAVA_HOME=%JAVA_8_HOME%\" && mvn install -DskipTests=true -D\"maven.javadoc.skip\"=true -B -V"
test_script:
- "set \"JAVA_HOME=%JAVA_PLATFORM_HOME%\" && mvn -B -D\"ccm.java.home\"=\"%JAVA_8_HOME%\" -D\"ccm.maxNumberOfNodes\"=1 -D\"cassandra.version\"=%cassandra_version% test -P %test_profile%"
on_finish:
- ps: .\ci\uploadtests.ps1
cache:
- C:\Users\appveyor\.m2
- C:\Users\appveyor\.ccm\repository
- C:\Users\appveyor\deps -> .\ci\appveyor.ps1
| Switch from Powershell back to Cmd for Appveyor builds | Switch from Powershell back to Cmd for Appveyor builds
Powershell errors out if anything is printed on stderr, which is pretty
common since there are negative tests that produce stderr.
| YAML | apache-2.0 | tolbertam/java-driver,tolbertam/java-driver,tolbertam/java-driver | yaml | ## Code Before:
environment:
test_profile: default
matrix:
- java_version: 1.6.0
- java_version: 1.7.0
- java_version: 1.8.0
test_profile: short
platform: x64
install:
- ps: .\ci\appveyor.ps1
build_script:
- ps: |
$env:JAVA_HOME="$($env:JAVA_8_HOME)"
mvn install -DskipTests=true -D"maven.javadoc.skip"=true -B -V
test_script:
- ps: |
$env:JAVA_HOME="$($env:JAVA_PLATFORM_HOME)"
mvn -B -D"ccm.java.home"="$($env:JAVA_8_HOME)" -D"ccm.maxNumberOfNodes"=1 -D"cassandra.version"=$($env:cassandra_version) test -P $($env:test_profile)
on_finish:
- ps: .\ci\uploadtests.ps1
cache:
- C:\Users\appveyor\.m2
- C:\Users\appveyor\.ccm\repository
- C:\Users\appveyor\deps -> .\ci\appveyor.ps1
## Instruction:
Switch from Powershell back to Cmd for Appveyor builds
Powershell errors out if anything is printed on stderr, which is pretty
common since there are negative tests that produce stderr.
## Code After:
environment:
test_profile: default
matrix:
- java_version: 1.6.0
- java_version: 1.7.0
- java_version: 1.8.0
test_profile: short
platform: x64
install:
- ps: .\ci\appveyor.ps1
build_script:
- "set \"JAVA_HOME=%JAVA_8_HOME%\" && mvn install -DskipTests=true -D\"maven.javadoc.skip\"=true -B -V"
test_script:
- "set \"JAVA_HOME=%JAVA_PLATFORM_HOME%\" && mvn -B -D\"ccm.java.home\"=\"%JAVA_8_HOME%\" -D\"ccm.maxNumberOfNodes\"=1 -D\"cassandra.version\"=%cassandra_version% test -P %test_profile%"
on_finish:
- ps: .\ci\uploadtests.ps1
cache:
- C:\Users\appveyor\.m2
- C:\Users\appveyor\.ccm\repository
- C:\Users\appveyor\deps -> .\ci\appveyor.ps1
| environment:
test_profile: default
matrix:
- java_version: 1.6.0
- java_version: 1.7.0
- java_version: 1.8.0
test_profile: short
platform: x64
install:
- ps: .\ci\appveyor.ps1
build_script:
- - ps: |
- $env:JAVA_HOME="$($env:JAVA_8_HOME)"
- mvn install -DskipTests=true -D"maven.javadoc.skip"=true -B -V
+ - "set \"JAVA_HOME=%JAVA_8_HOME%\" && mvn install -DskipTests=true -D\"maven.javadoc.skip\"=true -B -V"
? + ++++ +++++++++++++++++++++++++++ ++ + + +
test_script:
- - ps: |
- $env:JAVA_HOME="$($env:JAVA_PLATFORM_HOME)"
- mvn -B -D"ccm.java.home"="$($env:JAVA_8_HOME)" -D"ccm.maxNumberOfNodes"=1 -D"cassandra.version"=$($env:cassandra_version) test -P $($env:test_profile)
? ^^^^^^^ ^ ^^^^^^^ ^ ^^^^^^^ ^
+ - "set \"JAVA_HOME=%JAVA_PLATFORM_HOME%\" && mvn -B -D\"ccm.java.home\"=\"%JAVA_8_HOME%\" -D\"ccm.maxNumberOfNodes\"=1 -D\"cassandra.version\"=%cassandra_version% test -P %test_profile%"
? + ++++ ++++++++++++++++++++++++++++++++++ ++ + + + ^ ^^ + + + + ^ ^ ^ ^^
on_finish:
- ps: .\ci\uploadtests.ps1
cache:
- C:\Users\appveyor\.m2
- C:\Users\appveyor\.ccm\repository
- C:\Users\appveyor\deps -> .\ci\appveyor.ps1 | 8 | 0.333333 | 2 | 6 |
c3b456fe7e506c0624a8a815310892b033e30b9c | README.md | README.md |
Generate 3D logo by three.js.
|
Generate 3D logo by three.js.
## Demo
http://ohbarye.github.io/3D-logo-generator/
| Add link to sample site | Add link to sample site | Markdown | mit | mogiken/3D-logo-generator,mogiken/3D-logo-generator,ohbarye/3D-logo-generator,ohbarye/3D-logo-generator | markdown | ## Code Before:
Generate 3D logo by three.js.
## Instruction:
Add link to sample site
## Code After:
Generate 3D logo by three.js.
## Demo
http://ohbarye.github.io/3D-logo-generator/
|
Generate 3D logo by three.js.
+
+ ## Demo
+ http://ohbarye.github.io/3D-logo-generator/ | 3 | 1.5 | 3 | 0 |
48ae58c5b68531dfa6c306301f39ce043941c83f | README.md | README.md |
Theme based on [Long Haul](http://github.com/brianmaierjr/long-haul), by [@brianmaierjr](https://twitter.com/brianmaierjr).
|
Theme based on [Long Haul](http://github.com/brianmaierjr/long-haul), by [@brianmaierjr](https://twitter.com/brianmaierjr).
## Run
Inside a Docker container:
```console
$ docker run --rm \
-v $PWD:/srv/jekyll \
-p 4000:4000 \
jekyll/jekyll \
jekyll serve --drafts
```
## Compile CSS files
It is necessary to re-compile CSS files inside `assets/css/` after every modification to SCSS assets.
Required dependencies:
* `node` (>=v13.0.0)
* `ruby`, `ruby-dev` (>=2.3.0)
Steps:
1. `gem install bundler`
2. `bundle install`
3. `npm install`
4. `bundle exec npx gulp sass` (or `bundle exec $(npm bin)/gulp sass`)
| Add instructions for running Jekyll and re-compiling CSS | Add instructions for running Jekyll and re-compiling CSS
| Markdown | mit | antoineco/blog,antoineco/blog,antoineco/blog | markdown | ## Code Before:
Theme based on [Long Haul](http://github.com/brianmaierjr/long-haul), by [@brianmaierjr](https://twitter.com/brianmaierjr).
## Instruction:
Add instructions for running Jekyll and re-compiling CSS
## Code After:
Theme based on [Long Haul](http://github.com/brianmaierjr/long-haul), by [@brianmaierjr](https://twitter.com/brianmaierjr).
## Run
Inside a Docker container:
```console
$ docker run --rm \
-v $PWD:/srv/jekyll \
-p 4000:4000 \
jekyll/jekyll \
jekyll serve --drafts
```
## Compile CSS files
It is necessary to re-compile CSS files inside `assets/css/` after every modification to SCSS assets.
Required dependencies:
* `node` (>=v13.0.0)
* `ruby`, `ruby-dev` (>=2.3.0)
Steps:
1. `gem install bundler`
2. `bundle install`
3. `npm install`
4. `bundle exec npx gulp sass` (or `bundle exec $(npm bin)/gulp sass`)
|
Theme based on [Long Haul](http://github.com/brianmaierjr/long-haul), by [@brianmaierjr](https://twitter.com/brianmaierjr).
+
+ ## Run
+
+ Inside a Docker container:
+
+ ```console
+ $ docker run --rm \
+ -v $PWD:/srv/jekyll \
+ -p 4000:4000 \
+ jekyll/jekyll \
+ jekyll serve --drafts
+ ```
+
+ ## Compile CSS files
+
+ It is necessary to re-compile CSS files inside `assets/css/` after every modification to SCSS assets.
+
+ Required dependencies:
+ * `node` (>=v13.0.0)
+ * `ruby`, `ruby-dev` (>=2.3.0)
+
+ Steps:
+ 1. `gem install bundler`
+ 2. `bundle install`
+ 3. `npm install`
+ 4. `bundle exec npx gulp sass` (or `bundle exec $(npm bin)/gulp sass`) | 26 | 13 | 26 | 0 |
0ce3ff83086d18c0e8bcbf126513959e0f11ce14 | assets/css/common.css | assets/css/common.css | * {
margin: 0;
padding: 0;
}
.site-footer{
position:relative;
margin-top:40px;
padding:40px 0;
font-size:12px;
line-height:1.5;
color:#777;
border-top:2px solid #eee
}
.site-footer .octicon-mark-github {
position: absolute;
left: 50%;
color: #ccc;
} | * {
margin: 0;
padding: 0;
}
.site-footer{
position:relative;
margin-top:40px;
padding:40px 0;
font-size:12px;
line-height:1.5;
color:#777;
border-top:2px solid #eee
}
.site-footer .octicon-mark-github {
position: absolute;
left: 50%;
color: #ccc;
}
.site-footer .octicon-mark-github:hover {
color:#bbb;
} | Add hover on bottom icon | Add hover on bottom icon
| CSS | apache-2.0 | DEL-R/del-r.github.io,CarlosMChica/carlosmchica.github.io,jonwd7/jonwd7.github.io,colin78/colin78.github.io,coderlindacheng/coderlindacheng.github.io,gosibodu/gosibodu.github.io,cloud-pi/cloud-pi.github.io,CarlosMChica/carlosmchica.github.io,DONGChuan/Yummy-Jekyll,Z-Beatles/Z-Beatles.github.io,rahulkr7370/rahulkr7370.github.io,DEL-R/del-r.github.io,crunchyrobot/crunchyrobot.github.io,MeetMET-PeerLab/MeetMET-PeerLab.github.io,gosibodu/gosibodu.github.io,CarlosMChica/carlosmchica.github.io,bjholmes23/bjholmes23.github.io,crunchyrobot/crunchyrobot.github.io,amorri40/amorri40.github.io,jstify/jstify.github.io,msolters/msolters.github.io,crunchyrobot/crunchyrobot.github.io,coderlindacheng/coderlindacheng.github.io,UFreedom/UFreedom.github.io,msolters/msolters.github.io,jstify/jstify.github.io,talenguyen/talenguyen.github.io,Z-Beatles/Z-Beatles.github.io,colin78/colin78.github.io,JonathanMortier/jonathanmortier.github.io,coderlindacheng/coderlindacheng.github.io,gosibodu/gosibodu.github.io,dmateusp/dmateusp.github.io,MeetMET-PeerLab/MeetMET-PeerLab.github.io,DEL-R/del-r.github.io,DONGChuan/Yummy-Jekyll,Z-Beatles/Z-Beatles.github.io,jonwd7/jonwd7.github.io,msolters/msolters.github.io,bjholmes23/bjholmes23.github.io,UFreedom/UFreedom.github.io,dmateusp/dmateusp.github.io,MeetMET-PeerLab/MeetMET-PeerLab.github.io,rahulkr7370/rahulkr7370.github.io,colin78/colin78.github.io,DONGChuan/Yummy-Jekyll,bjholmes23/bjholmes23.github.io,talenguyen/talenguyen.github.io,jonwd7/jonwd7.github.io,amorri40/amorri40.github.io,rahulkr7370/rahulkr7370.github.io,cloud-pi/cloud-pi.github.io,JonathanMortier/jonathanmortier.github.io,jstify/jstify.github.io,UFreedom/UFreedom.github.io,JonathanMortier/jonathanmortier.github.io,colin78/colin78.github.io,cloud-pi/cloud-pi.github.io,dmateusp/dmateusp.github.io,amorri40/amorri40.github.io | css | ## Code Before:
* {
margin: 0;
padding: 0;
}
.site-footer{
position:relative;
margin-top:40px;
padding:40px 0;
font-size:12px;
line-height:1.5;
color:#777;
border-top:2px solid #eee
}
.site-footer .octicon-mark-github {
position: absolute;
left: 50%;
color: #ccc;
}
## Instruction:
Add hover on bottom icon
## Code After:
* {
margin: 0;
padding: 0;
}
.site-footer{
position:relative;
margin-top:40px;
padding:40px 0;
font-size:12px;
line-height:1.5;
color:#777;
border-top:2px solid #eee
}
.site-footer .octicon-mark-github {
position: absolute;
left: 50%;
color: #ccc;
}
.site-footer .octicon-mark-github:hover {
color:#bbb;
} | * {
margin: 0;
padding: 0;
}
.site-footer{
position:relative;
margin-top:40px;
padding:40px 0;
font-size:12px;
line-height:1.5;
color:#777;
border-top:2px solid #eee
}
.site-footer .octicon-mark-github {
position: absolute;
left: 50%;
color: #ccc;
}
+
+ .site-footer .octicon-mark-github:hover {
+ color:#bbb;
+ } | 4 | 0.2 | 4 | 0 |
a3fcb3f9467fbec459d0487e7bc9b0d208b97346 | src/radium_protocol/src/message.rs | src/radium_protocol/src/message.rs | use std::io;
use byteorder::WriteBytesExt;
use super::{MessageType, WriteTo};
use super::messages::{AddEntry, EntryExpired, Entry, RemoveEntry};
pub enum Message {
Ping,
AddEntry(AddEntry),
RemoveEntry(RemoveEntry),
EntryExpired(EntryExpired),
#[doc(hidden)]
__NonExhaustive,
}
impl Message {
pub fn message_type(&self) -> MessageType {
match self {
&Message::Ping => MessageType::Ping,
&Message::AddEntry(_) => MessageType::AddEntry,
&Message::RemoveEntry(_) => MessageType::RemoveEntry,
_ => panic!("invalid Message")
}
}
pub fn is_command(&self) -> bool {
self.message_type().is_command()
}
pub fn write_to<W: io::Write>(&self, target: &mut W) -> io::Result<()> {
target.write_u8(self.message_type().into())?;
match self {
&Message::Ping => Ok(()),
&Message::RemoveEntry(ref cmd) => cmd.write_to(target),
&Message::AddEntry(ref cmd) => cmd.write_to(target),
_ => panic!("invalid Message")
}
}
}
#[cfg(test)]
mod test {
use super::*;
#[test]
fn test_ping() {
let cmd = Message::Ping;
let mut vec = Vec::new();
assert!(cmd.write_to(&mut vec).is_ok());
assert_eq!(vec![0], vec);
}
} | use std::io;
use byteorder::WriteBytesExt;
use super::{MessageType, WriteTo};
use super::messages::{AddEntry, EntryExpired, RemoveEntry};
pub enum Message {
Ping,
AddEntry(AddEntry),
RemoveEntry(RemoveEntry),
EntryExpired(EntryExpired),
#[doc(hidden)]
__NonExhaustive,
}
impl Message {
pub fn message_type(&self) -> MessageType {
match self {
&Message::Ping => MessageType::Ping,
&Message::AddEntry(_) => MessageType::AddEntry,
&Message::RemoveEntry(_) => MessageType::RemoveEntry,
&Message::EntryExpired(_) => MessageType::EntryExpired,
_ => panic!("invalid Message")
}
}
pub fn is_command(&self) -> bool {
self.message_type().is_command()
}
}
impl WriteTo for Message {
fn write_to<W: io::Write>(&self, target: &mut W) -> io::Result<()> {
target.write_u8(self.message_type().into())?;
match self {
&Message::Ping => Ok(()),
&Message::RemoveEntry(ref msg) => msg.write_to(target),
&Message::AddEntry(ref msg) => msg.write_to(target),
&Message::EntryExpired(ref msg) => msg.write_to(target),
_ => panic!("invalid Message")
}
}
}
#[cfg(test)]
mod test {
use super::*;
#[test]
fn test_ping() {
let cmd = Message::Ping;
let mut vec = Vec::new();
assert!(cmd.write_to(&mut vec).is_ok());
assert_eq!(vec![0], vec);
}
} | Move write_to to trait implementation | Move write_to to trait implementation
| Rust | mit | bash/radium,bash/radium,bash/radium | rust | ## Code Before:
use std::io;
use byteorder::WriteBytesExt;
use super::{MessageType, WriteTo};
use super::messages::{AddEntry, EntryExpired, Entry, RemoveEntry};
pub enum Message {
Ping,
AddEntry(AddEntry),
RemoveEntry(RemoveEntry),
EntryExpired(EntryExpired),
#[doc(hidden)]
__NonExhaustive,
}
impl Message {
pub fn message_type(&self) -> MessageType {
match self {
&Message::Ping => MessageType::Ping,
&Message::AddEntry(_) => MessageType::AddEntry,
&Message::RemoveEntry(_) => MessageType::RemoveEntry,
_ => panic!("invalid Message")
}
}
pub fn is_command(&self) -> bool {
self.message_type().is_command()
}
pub fn write_to<W: io::Write>(&self, target: &mut W) -> io::Result<()> {
target.write_u8(self.message_type().into())?;
match self {
&Message::Ping => Ok(()),
&Message::RemoveEntry(ref cmd) => cmd.write_to(target),
&Message::AddEntry(ref cmd) => cmd.write_to(target),
_ => panic!("invalid Message")
}
}
}
#[cfg(test)]
mod test {
use super::*;
#[test]
fn test_ping() {
let cmd = Message::Ping;
let mut vec = Vec::new();
assert!(cmd.write_to(&mut vec).is_ok());
assert_eq!(vec![0], vec);
}
}
## Instruction:
Move write_to to trait implementation
## Code After:
use std::io;
use byteorder::WriteBytesExt;
use super::{MessageType, WriteTo};
use super::messages::{AddEntry, EntryExpired, RemoveEntry};
pub enum Message {
Ping,
AddEntry(AddEntry),
RemoveEntry(RemoveEntry),
EntryExpired(EntryExpired),
#[doc(hidden)]
__NonExhaustive,
}
impl Message {
pub fn message_type(&self) -> MessageType {
match self {
&Message::Ping => MessageType::Ping,
&Message::AddEntry(_) => MessageType::AddEntry,
&Message::RemoveEntry(_) => MessageType::RemoveEntry,
&Message::EntryExpired(_) => MessageType::EntryExpired,
_ => panic!("invalid Message")
}
}
pub fn is_command(&self) -> bool {
self.message_type().is_command()
}
}
impl WriteTo for Message {
fn write_to<W: io::Write>(&self, target: &mut W) -> io::Result<()> {
target.write_u8(self.message_type().into())?;
match self {
&Message::Ping => Ok(()),
&Message::RemoveEntry(ref msg) => msg.write_to(target),
&Message::AddEntry(ref msg) => msg.write_to(target),
&Message::EntryExpired(ref msg) => msg.write_to(target),
_ => panic!("invalid Message")
}
}
}
#[cfg(test)]
mod test {
use super::*;
#[test]
fn test_ping() {
let cmd = Message::Ping;
let mut vec = Vec::new();
assert!(cmd.write_to(&mut vec).is_ok());
assert_eq!(vec![0], vec);
}
} | use std::io;
use byteorder::WriteBytesExt;
use super::{MessageType, WriteTo};
- use super::messages::{AddEntry, EntryExpired, Entry, RemoveEntry};
? -------
+ use super::messages::{AddEntry, EntryExpired, RemoveEntry};
pub enum Message {
Ping,
AddEntry(AddEntry),
RemoveEntry(RemoveEntry),
EntryExpired(EntryExpired),
#[doc(hidden)]
__NonExhaustive,
}
impl Message {
pub fn message_type(&self) -> MessageType {
match self {
&Message::Ping => MessageType::Ping,
&Message::AddEntry(_) => MessageType::AddEntry,
&Message::RemoveEntry(_) => MessageType::RemoveEntry,
+ &Message::EntryExpired(_) => MessageType::EntryExpired,
_ => panic!("invalid Message")
}
}
pub fn is_command(&self) -> bool {
self.message_type().is_command()
}
+ }
+ impl WriteTo for Message {
- pub fn write_to<W: io::Write>(&self, target: &mut W) -> io::Result<()> {
? ----
+ fn write_to<W: io::Write>(&self, target: &mut W) -> io::Result<()> {
target.write_u8(self.message_type().into())?;
match self {
&Message::Ping => Ok(()),
- &Message::RemoveEntry(ref cmd) => cmd.write_to(target),
? - ^ - ^
+ &Message::RemoveEntry(ref msg) => msg.write_to(target),
? ^^ ^^
- &Message::AddEntry(ref cmd) => cmd.write_to(target),
? - ^ - ^
+ &Message::AddEntry(ref msg) => msg.write_to(target),
? ^^ ^^
+ &Message::EntryExpired(ref msg) => msg.write_to(target),
_ => panic!("invalid Message")
}
}
}
#[cfg(test)]
mod test {
use super::*;
#[test]
fn test_ping() {
let cmd = Message::Ping;
let mut vec = Vec::new();
assert!(cmd.write_to(&mut vec).is_ok());
assert_eq!(vec![0], vec);
}
} | 12 | 0.226415 | 8 | 4 |
a5969b1155042bd3c0d71d79e8b1c5b376f958b1 | README.md | README.md | 

| 

| Update of Travis CI badge | Update of Travis CI badge
| Markdown | apache-2.0 | HRVBand/hrv-lib | markdown | ## Code Before:


## Instruction:
Update of Travis CI badge
## Code After:


| - 
+ 
 | 2 | 1 | 1 | 1 |
b824cf09000b099574723c6f24cbcf3d532c66fd | app/views/blacklight_cornell_requests/request/document_delivery.html.haml | app/views/blacklight_cornell_requests/request/document_delivery.html.haml |
-title = the_vernaculator('title_display', 'title_vern_display')
-subtitle = the_vernaculator('subtitle_display', 'subtitle_vern_display')
= render :partial => 'shared/back_to_item'
%h2 ScanIt
%div.well
%h3.item-title-request.blacklight-title_display=title
%div.request-author
=show_presenter(@document).field_value 'title_responsibility_display'
%p
Click the button below to go to the ScanIt form and place your request.
.clearfix
-if @alternate_request_options and @alternate_request_options.count >= 2
%a{:href => BlacklightCornellRequests::Request::DOCUMENT_DELIVERY_URL, :title =>'Submit ScanIt Request',:class => 'btn btn-danger pull-left', :target => '_blank'}
Go to ScanIt
= render :partial => 'shared/request_options'
-else
%a{:href => BlacklightCornellRequests::Request::DOCUMENT_DELIVERY_URL, :title =>'Submit ScanIt Request',:class => 'btn btn-danger pull-left', :target => '_blank'}
Go to ScanIt
%div.accordion-heading.request-options.pull-left.form-alternative-action
or
=link_to 'Ask a Librarian','http://ask.library.cornell.edu'
for help.
|
-title = the_vernaculator('title_display', 'title_vern_display')
-subtitle = the_vernaculator('subtitle_display', 'subtitle_vern_display')
= render :partial => 'shared/back_to_item'
%h2 ScanIt
%div.well
%h3.item-title-request.blacklight-title_display=title
%div.request-author
=show_presenter(@document).field_value 'title_responsibility_display'
%p
Click the button below to go to the ScanIt form and place your request.
.clearfix
-if @alternate_request_options and @alternate_request_options.count >= 2
%a{:href => @scanit_link, :title =>'Submit ScanIt Request',:class => 'btn btn-danger pull-left', :target => '_blank'}
Go to ScanIt
= render :partial => 'shared/request_options'
-else
%a{:href => @scanit_link, :title =>'Submit ScanIt Request',:class => 'btn btn-danger pull-left', :target => '_blank'}
Go to ScanIt
%div.accordion-heading.request-options.pull-left.form-alternative-action
or
=link_to 'Ask a Librarian','http://ask.library.cornell.edu'
for help.
| Replace DOCUMENT_DELIVERY_URL with scanit_link for the button Go to ScanIt | Replace DOCUMENT_DELIVERY_URL with scanit_link for the button Go to ScanIt
| Haml | mit | cul-it/blacklight-cornell-requests,cul-it/blacklight-cornell-requests,cul-it/blacklight-cornell-requests | haml | ## Code Before:
-title = the_vernaculator('title_display', 'title_vern_display')
-subtitle = the_vernaculator('subtitle_display', 'subtitle_vern_display')
= render :partial => 'shared/back_to_item'
%h2 ScanIt
%div.well
%h3.item-title-request.blacklight-title_display=title
%div.request-author
=show_presenter(@document).field_value 'title_responsibility_display'
%p
Click the button below to go to the ScanIt form and place your request.
.clearfix
-if @alternate_request_options and @alternate_request_options.count >= 2
%a{:href => BlacklightCornellRequests::Request::DOCUMENT_DELIVERY_URL, :title =>'Submit ScanIt Request',:class => 'btn btn-danger pull-left', :target => '_blank'}
Go to ScanIt
= render :partial => 'shared/request_options'
-else
%a{:href => BlacklightCornellRequests::Request::DOCUMENT_DELIVERY_URL, :title =>'Submit ScanIt Request',:class => 'btn btn-danger pull-left', :target => '_blank'}
Go to ScanIt
%div.accordion-heading.request-options.pull-left.form-alternative-action
or
=link_to 'Ask a Librarian','http://ask.library.cornell.edu'
for help.
## Instruction:
Replace DOCUMENT_DELIVERY_URL with scanit_link for the button Go to ScanIt
## Code After:
-title = the_vernaculator('title_display', 'title_vern_display')
-subtitle = the_vernaculator('subtitle_display', 'subtitle_vern_display')
= render :partial => 'shared/back_to_item'
%h2 ScanIt
%div.well
%h3.item-title-request.blacklight-title_display=title
%div.request-author
=show_presenter(@document).field_value 'title_responsibility_display'
%p
Click the button below to go to the ScanIt form and place your request.
.clearfix
-if @alternate_request_options and @alternate_request_options.count >= 2
%a{:href => @scanit_link, :title =>'Submit ScanIt Request',:class => 'btn btn-danger pull-left', :target => '_blank'}
Go to ScanIt
= render :partial => 'shared/request_options'
-else
%a{:href => @scanit_link, :title =>'Submit ScanIt Request',:class => 'btn btn-danger pull-left', :target => '_blank'}
Go to ScanIt
%div.accordion-heading.request-options.pull-left.form-alternative-action
or
=link_to 'Ask a Librarian','http://ask.library.cornell.edu'
for help.
|
-title = the_vernaculator('title_display', 'title_vern_display')
-subtitle = the_vernaculator('subtitle_display', 'subtitle_vern_display')
= render :partial => 'shared/back_to_item'
%h2 ScanIt
%div.well
%h3.item-title-request.blacklight-title_display=title
%div.request-author
=show_presenter(@document).field_value 'title_responsibility_display'
%p
Click the button below to go to the ScanIt form and place your request.
.clearfix
-if @alternate_request_options and @alternate_request_options.count >= 2
- %a{:href => BlacklightCornellRequests::Request::DOCUMENT_DELIVERY_URL, :title =>'Submit ScanIt Request',:class => 'btn btn-danger pull-left', :target => '_blank'}
? ^^ ^^ ------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ %a{:href => @scanit_link, :title =>'Submit ScanIt Request',:class => 'btn btn-danger pull-left', :target => '_blank'}
? ^^^ ^^^^ ^
Go to ScanIt
- = render :partial => 'shared/request_options'
? -----------
+ = render :partial => 'shared/request_options'
-else
- %a{:href => BlacklightCornellRequests::Request::DOCUMENT_DELIVERY_URL, :title =>'Submit ScanIt Request',:class => 'btn btn-danger pull-left', :target => '_blank'}
? ^^ ^^ ------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ %a{:href => @scanit_link, :title =>'Submit ScanIt Request',:class => 'btn btn-danger pull-left', :target => '_blank'}
? ^^^ ^^^^ ^
Go to ScanIt
%div.accordion-heading.request-options.pull-left.form-alternative-action
or
=link_to 'Ask a Librarian','http://ask.library.cornell.edu'
for help.
| 6 | 0.24 | 3 | 3 |
eac85309c411adb1315ce1f41c7a94178844c873 | source/docs/01_overview/01_introduction.md | source/docs/01_overview/01_introduction.md | <!-- NAV SECTION HEADER -->
<h0>Overview</h0>
<!-- NAV SECTION HEADER -->
<img src="https://gc-misc.s3.amazonaws.com/images/api-docs-illo@2x.png" width="159" height="177">
# The Legacy GoCardless API
<p class="well-notice u-margin-Vl">
<strong>This documentation is intended for developers who already have an integration with this API.</strong>
If you're starting a new integration you should use [our new API](https://developer.gocardless.com/pro) instead.
The legacy API will not receive updates, and does not offer as many features as the new one.
</p>
| <!-- NAV SECTION HEADER -->
<h0>Overview</h0>
<!-- NAV SECTION HEADER -->
<img src="https://gc-misc.s3.amazonaws.com/images/api-docs-illo@2x.png" width="159" height="177">
# The Legacy GoCardless API
<p class="well-notice u-margin-Vl">
<strong>This documentation is intended for developers who already have an integration with this API.</strong>
If you're starting a new integration you should use our new API instead - check out the [getting started guide](https://developer.gocardless.com/getting-started) or the [API reference](https://developer.gocardless.com/api-reference).
The legacy API will not receive updates, and does not offer as many features as the new one.
</p>
| Update the URL of the new API reference, and point people to the new guides | Update the URL of the new API reference, and point people to the new guides
| Markdown | mit | gocardless/api-docs,gocardless/api-docs,gocardless/api-docs,gocardless/api-docs,gocardless/api-docs,gocardless/api-docs,gocardless/api-docs,gocardless/api-docs | markdown | ## Code Before:
<!-- NAV SECTION HEADER -->
<h0>Overview</h0>
<!-- NAV SECTION HEADER -->
<img src="https://gc-misc.s3.amazonaws.com/images/api-docs-illo@2x.png" width="159" height="177">
# The Legacy GoCardless API
<p class="well-notice u-margin-Vl">
<strong>This documentation is intended for developers who already have an integration with this API.</strong>
If you're starting a new integration you should use [our new API](https://developer.gocardless.com/pro) instead.
The legacy API will not receive updates, and does not offer as many features as the new one.
</p>
## Instruction:
Update the URL of the new API reference, and point people to the new guides
## Code After:
<!-- NAV SECTION HEADER -->
<h0>Overview</h0>
<!-- NAV SECTION HEADER -->
<img src="https://gc-misc.s3.amazonaws.com/images/api-docs-illo@2x.png" width="159" height="177">
# The Legacy GoCardless API
<p class="well-notice u-margin-Vl">
<strong>This documentation is intended for developers who already have an integration with this API.</strong>
If you're starting a new integration you should use our new API instead - check out the [getting started guide](https://developer.gocardless.com/getting-started) or the [API reference](https://developer.gocardless.com/api-reference).
The legacy API will not receive updates, and does not offer as many features as the new one.
</p>
| <!-- NAV SECTION HEADER -->
<h0>Overview</h0>
<!-- NAV SECTION HEADER -->
<img src="https://gc-misc.s3.amazonaws.com/images/api-docs-illo@2x.png" width="159" height="177">
# The Legacy GoCardless API
<p class="well-notice u-margin-Vl">
<strong>This documentation is intended for developers who already have an integration with this API.</strong>
- If you're starting a new integration you should use [our new API](https://developer.gocardless.com/pro) instead.
+ If you're starting a new integration you should use our new API instead - check out the [getting started guide](https://developer.gocardless.com/getting-started) or the [API reference](https://developer.gocardless.com/api-reference).
The legacy API will not receive updates, and does not offer as many features as the new one.
</p> | 2 | 0.153846 | 1 | 1 |
7ae78b4098bf1851ab97080c7b29ec2a81eff675 | src/java/nxt/db/DerivedDbTable.java | src/java/nxt/db/DerivedDbTable.java | package nxt.db;
import nxt.Nxt;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
public abstract class DerivedDbTable {
protected final String table;
protected DerivedDbTable(String table) {
this.table = table;
Nxt.getBlockchainProcessor().registerDerivedTable(this);
}
public void rollback(int height) {
if (!Db.isInTransaction()) {
throw new IllegalStateException("Not in transaction");
}
try (Connection con = Db.getConnection();
PreparedStatement pstmtDelete = con.prepareStatement("DELETE FROM " + table + " WHERE height > ?")) {
pstmtDelete.setInt(1, height);
pstmtDelete.executeUpdate();
} catch (SQLException e) {
throw new RuntimeException(e.toString(), e);
}
}
public void truncate() {
if (!Db.isInTransaction()) {
throw new IllegalStateException("Not in transaction");
}
try (Connection con = Db.getConnection();
Statement stmt = con.createStatement()) {
stmt.executeUpdate("TRUNCATE TABLE " + table);
} catch (SQLException e) {
throw new RuntimeException(e.toString(), e);
}
}
public void trim(int height) {
//nothing to trim
}
public void finish() {
}
}
| package nxt.db;
import nxt.Nxt;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
public abstract class DerivedDbTable {
protected final String table;
protected DerivedDbTable(String table) {
this.table = table;
Nxt.getBlockchainProcessor().registerDerivedTable(this);
}
public void rollback(int height) {
if (!Db.isInTransaction()) {
throw new IllegalStateException("Not in transaction");
}
try (Connection con = Db.getConnection();
PreparedStatement pstmtDelete = con.prepareStatement("DELETE FROM " + table + " WHERE height > ?")) {
pstmtDelete.setInt(1, height);
pstmtDelete.executeUpdate();
} catch (SQLException e) {
throw new RuntimeException(e.toString(), e);
}
}
public void truncate() {
if (!Db.isInTransaction()) {
throw new IllegalStateException("Not in transaction");
}
try (Connection con = Db.getConnection();
Statement stmt = con.createStatement()) {
stmt.executeUpdate("DELETE FROM " + table);
} catch (SQLException e) {
throw new RuntimeException(e.toString(), e);
}
}
public void trim(int height) {
//nothing to trim
}
public void finish() {
}
}
| Change truncate to delete from in db abstraction. Truncate is not getting rolled back in the new h2 db version, leaving things in a dirty state after failed block application. | Change truncate to delete from in db abstraction. Truncate is not getting rolled back in the new h2 db version, leaving things in a dirty state after failed block application.
| Java | mit | burst-team/burstcoin,burst-team/burstcoin,burst-team/burstcoin,burst-team/burstcoin,burst-team/burstcoin | java | ## Code Before:
package nxt.db;
import nxt.Nxt;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
public abstract class DerivedDbTable {
protected final String table;
protected DerivedDbTable(String table) {
this.table = table;
Nxt.getBlockchainProcessor().registerDerivedTable(this);
}
public void rollback(int height) {
if (!Db.isInTransaction()) {
throw new IllegalStateException("Not in transaction");
}
try (Connection con = Db.getConnection();
PreparedStatement pstmtDelete = con.prepareStatement("DELETE FROM " + table + " WHERE height > ?")) {
pstmtDelete.setInt(1, height);
pstmtDelete.executeUpdate();
} catch (SQLException e) {
throw new RuntimeException(e.toString(), e);
}
}
public void truncate() {
if (!Db.isInTransaction()) {
throw new IllegalStateException("Not in transaction");
}
try (Connection con = Db.getConnection();
Statement stmt = con.createStatement()) {
stmt.executeUpdate("TRUNCATE TABLE " + table);
} catch (SQLException e) {
throw new RuntimeException(e.toString(), e);
}
}
public void trim(int height) {
//nothing to trim
}
public void finish() {
}
}
## Instruction:
Change truncate to delete from in db abstraction. Truncate is not getting rolled back in the new h2 db version, leaving things in a dirty state after failed block application.
## Code After:
package nxt.db;
import nxt.Nxt;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
public abstract class DerivedDbTable {
protected final String table;
protected DerivedDbTable(String table) {
this.table = table;
Nxt.getBlockchainProcessor().registerDerivedTable(this);
}
public void rollback(int height) {
if (!Db.isInTransaction()) {
throw new IllegalStateException("Not in transaction");
}
try (Connection con = Db.getConnection();
PreparedStatement pstmtDelete = con.prepareStatement("DELETE FROM " + table + " WHERE height > ?")) {
pstmtDelete.setInt(1, height);
pstmtDelete.executeUpdate();
} catch (SQLException e) {
throw new RuntimeException(e.toString(), e);
}
}
public void truncate() {
if (!Db.isInTransaction()) {
throw new IllegalStateException("Not in transaction");
}
try (Connection con = Db.getConnection();
Statement stmt = con.createStatement()) {
stmt.executeUpdate("DELETE FROM " + table);
} catch (SQLException e) {
throw new RuntimeException(e.toString(), e);
}
}
public void trim(int height) {
//nothing to trim
}
public void finish() {
}
}
| package nxt.db;
import nxt.Nxt;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
public abstract class DerivedDbTable {
protected final String table;
protected DerivedDbTable(String table) {
this.table = table;
Nxt.getBlockchainProcessor().registerDerivedTable(this);
}
public void rollback(int height) {
if (!Db.isInTransaction()) {
throw new IllegalStateException("Not in transaction");
}
try (Connection con = Db.getConnection();
PreparedStatement pstmtDelete = con.prepareStatement("DELETE FROM " + table + " WHERE height > ?")) {
pstmtDelete.setInt(1, height);
pstmtDelete.executeUpdate();
} catch (SQLException e) {
throw new RuntimeException(e.toString(), e);
}
}
public void truncate() {
if (!Db.isInTransaction()) {
throw new IllegalStateException("Not in transaction");
}
try (Connection con = Db.getConnection();
Statement stmt = con.createStatement()) {
- stmt.executeUpdate("TRUNCATE TABLE " + table);
? ^^^^^^ ^^^^^
+ stmt.executeUpdate("DELETE FROM " + table);
? ^^^^ ^^^^
} catch (SQLException e) {
throw new RuntimeException(e.toString(), e);
}
}
public void trim(int height) {
//nothing to trim
}
public void finish() {
}
} | 2 | 0.038462 | 1 | 1 |
6078a52907dec5b37357824f49c7866e9958c3b8 | README.md | README.md |
```bash
./bin/setup
```
# How to run the test suite
```bash
bundle exec rake
```
# Deployment instructions
## Staging
```bash
# Add the heroku remote
heroku git:remote -a staging-tap-pensionwise -r staging
# Deploy
git push staging master
```
|
```bash
./bin/setup
```
# How to run the test suite
```bash
bundle exec rake
```
# Deployment instructions
## Staging
View staging at [https://staging-tap-pensionwise.herokuapp.com](https://staging-tap-pensionwise.herokuapp.com)
| Remove deployment from docs because we use heroku pipelines | Remove deployment from docs because we use heroku pipelines
| Markdown | mit | guidance-guarantee-programme/telephone_appointment_planner,guidance-guarantee-programme/telephone_appointment_planner,guidance-guarantee-programme/telephone_appointment_planner | markdown | ## Code Before:
```bash
./bin/setup
```
# How to run the test suite
```bash
bundle exec rake
```
# Deployment instructions
## Staging
```bash
# Add the heroku remote
heroku git:remote -a staging-tap-pensionwise -r staging
# Deploy
git push staging master
```
## Instruction:
Remove deployment from docs because we use heroku pipelines
## Code After:
```bash
./bin/setup
```
# How to run the test suite
```bash
bundle exec rake
```
# Deployment instructions
## Staging
View staging at [https://staging-tap-pensionwise.herokuapp.com](https://staging-tap-pensionwise.herokuapp.com)
|
```bash
./bin/setup
```
# How to run the test suite
```bash
bundle exec rake
```
# Deployment instructions
## Staging
+ View staging at [https://staging-tap-pensionwise.herokuapp.com](https://staging-tap-pensionwise.herokuapp.com)
- ```bash
- # Add the heroku remote
- heroku git:remote -a staging-tap-pensionwise -r staging
-
- # Deploy
- git push staging master
- ``` | 8 | 0.363636 | 1 | 7 |
753558f4b37a63245e679fffdfc2278e817978fd | lib/squall/dns_zone.rb | lib/squall/dns_zone.rb | module Squall
# OnApp DNS Zones
class DnsZone < Base
# Public: List DNS zones.
#
# Returns an Array.
def list
response = request(:get, "/dns_zones.json")
response["dns_zones"]
end
# Public: Get the details for a DNS zone.
#
# id - ID of the DNS store zone
#
# Returns a Hash.
def show(id)
response = request(:get, "/dns_zones/#{id}.json")
response['dns_zone']
end
# Public: Adds a new DNS Zone.
#
# options - Params for the data store zone:
# :name - Domain name
# :autopopulate - Autopopulate DNS records for this domain
#
# Returns a Hash.
def create(options = {})
response = request(:post, "/dns_zones.json", default_params(options))
response['dns_zone']
end
# Public: Deletes an existing DNS Zone.
#
# id - ID of the DNS zone
#
# Returns an empty Hash.
def delete(id)
request(:delete, "/dns_zones/#{id}.json")
end
end
end
| module Squall
# OnApp DNS Zones
class DnsZone < Base
# Public: List DNS zones.
#
# Returns an Array.
def list
response = request(:get, "/dns_zones.json")
response["dns_zones"]
end
# Public: Get the details for a DNS zone.
#
# id - ID of the DNS store zone
#
# Returns a Hash.
def show(id)
response = request(:get, "/dns_zones/#{id}.json")
response['dns_zone']
end
# Public: Adds a new DNS Zone.
#
# options - Params for the data store zone:
# :name - Domain name
# :autopopulate - Autopopulate DNS records for this domain
#
# Returns a Hash.
def create(options = {})
response = request(:post, "/dns_zones.json", default_params(options))
response['dns_zone']
end
# Public: Deletes an existing DNS Zone.
#
# id - ID of the DNS zone
#
# Returns an empty Hash.
def delete(id)
request(:delete, "/dns_zones/#{id}.json")
end
# Public: Grabs all the records associated with a DNS zone.
#
# id - ID of the DNS zone
#
# Returns a Hash.
def records(id)
request(:get, "/dns_zones/#{id}/records.json")
response['dns_zone']
end
# Public: Grabs the configured nameservers.
#
# Returns an array of records.
def nameservers
response = request(:get, "/settings/dns_zones/name-servers.json")
response['dns_zones']
end
end
end
| Add functionality to grab the DNS zone records and nameservers | Add functionality to grab the DNS zone records and nameservers
| Ruby | mit | OnApp/squall | ruby | ## Code Before:
module Squall
# OnApp DNS Zones
class DnsZone < Base
# Public: List DNS zones.
#
# Returns an Array.
def list
response = request(:get, "/dns_zones.json")
response["dns_zones"]
end
# Public: Get the details for a DNS zone.
#
# id - ID of the DNS store zone
#
# Returns a Hash.
def show(id)
response = request(:get, "/dns_zones/#{id}.json")
response['dns_zone']
end
# Public: Adds a new DNS Zone.
#
# options - Params for the data store zone:
# :name - Domain name
# :autopopulate - Autopopulate DNS records for this domain
#
# Returns a Hash.
def create(options = {})
response = request(:post, "/dns_zones.json", default_params(options))
response['dns_zone']
end
# Public: Deletes an existing DNS Zone.
#
# id - ID of the DNS zone
#
# Returns an empty Hash.
def delete(id)
request(:delete, "/dns_zones/#{id}.json")
end
end
end
## Instruction:
Add functionality to grab the DNS zone records and nameservers
## Code After:
module Squall
# OnApp DNS Zones
class DnsZone < Base
# Public: List DNS zones.
#
# Returns an Array.
def list
response = request(:get, "/dns_zones.json")
response["dns_zones"]
end
# Public: Get the details for a DNS zone.
#
# id - ID of the DNS store zone
#
# Returns a Hash.
def show(id)
response = request(:get, "/dns_zones/#{id}.json")
response['dns_zone']
end
# Public: Adds a new DNS Zone.
#
# options - Params for the data store zone:
# :name - Domain name
# :autopopulate - Autopopulate DNS records for this domain
#
# Returns a Hash.
def create(options = {})
response = request(:post, "/dns_zones.json", default_params(options))
response['dns_zone']
end
# Public: Deletes an existing DNS Zone.
#
# id - ID of the DNS zone
#
# Returns an empty Hash.
def delete(id)
request(:delete, "/dns_zones/#{id}.json")
end
# Public: Grabs all the records associated with a DNS zone.
#
# id - ID of the DNS zone
#
# Returns a Hash.
def records(id)
request(:get, "/dns_zones/#{id}/records.json")
response['dns_zone']
end
# Public: Grabs the configured nameservers.
#
# Returns an array of records.
def nameservers
response = request(:get, "/settings/dns_zones/name-servers.json")
response['dns_zones']
end
end
end
| module Squall
# OnApp DNS Zones
class DnsZone < Base
# Public: List DNS zones.
#
# Returns an Array.
def list
response = request(:get, "/dns_zones.json")
response["dns_zones"]
end
# Public: Get the details for a DNS zone.
#
# id - ID of the DNS store zone
#
# Returns a Hash.
def show(id)
response = request(:get, "/dns_zones/#{id}.json")
response['dns_zone']
end
# Public: Adds a new DNS Zone.
#
# options - Params for the data store zone:
# :name - Domain name
# :autopopulate - Autopopulate DNS records for this domain
#
# Returns a Hash.
def create(options = {})
response = request(:post, "/dns_zones.json", default_params(options))
response['dns_zone']
end
# Public: Deletes an existing DNS Zone.
#
# id - ID of the DNS zone
#
# Returns an empty Hash.
def delete(id)
request(:delete, "/dns_zones/#{id}.json")
end
+
+ # Public: Grabs all the records associated with a DNS zone.
+ #
+ # id - ID of the DNS zone
+ #
+ # Returns a Hash.
+ def records(id)
+ request(:get, "/dns_zones/#{id}/records.json")
+ response['dns_zone']
+ end
+
+ # Public: Grabs the configured nameservers.
+ #
+ # Returns an array of records.
+ def nameservers
+ response = request(:get, "/settings/dns_zones/name-servers.json")
+ response['dns_zones']
+ end
end
end | 18 | 0.418605 | 18 | 0 |
cf67a891c58e4361a096f3fd3566e4b141aed082 | sweettooth/auth/templates/registration/login.html | sweettooth/auth/templates/registration/login.html | {% extends "base.html" %}
{% block body %}
<form action="{% url auth-login %}" method="POST" id="auth_form">
<input type="hidden" name="next" value="{{ next }}">
{% csrf_token %}
<ol>
<li>
{% for error in form.username.errors %}
<p class="error">{{ error }}</p>
{% endfor %}
{{ form.username.label_tag }}
{{ form.username }}
</li>
<li>
{% for error in form.password.errors %}
<p class="error">{{ error }}</p>
{% endfor %}
{{ form.password.label_tag }}
{{ form.password }}
</li>
<li class="submit">
<input type="submit" value="Log in">
</li>
</ol>
</form>
<a href="{% url registration_register %}">Register</a>
<a href="{% url auth_password_reset %}">Forgot your password?</a>
{% endblock %}
| {% extends "base.html" %}
{% block body %}
<form action="" method="POST" id="auth_form">
<input type="hidden" name="next" value="{{ next }}">
{% csrf_token %}
<ol>
<li>
{% for error in form.username.errors %}
<p class="error">{{ error }}</p>
{% endfor %}
{{ form.username.label_tag }}
{{ form.username }}
</li>
<li>
{% for error in form.password.errors %}
<p class="error">{{ error }}</p>
{% endfor %}
{{ form.password.label_tag }}
{{ form.password }}
</li>
<li class="submit">
<input type="submit" value="Log in">
</li>
</ol>
</form>
<a href="{% url registration_register %}">Register</a>
<a href="{% url auth_password_reset %}">Forgot your password?</a>
{% endblock %}
| Use implicit form URL submit | Use implicit form URL submit
| HTML | agpl-3.0 | magcius/sweettooth,GNOME/extensions-web,GNOME/extensions-web,magcius/sweettooth,GNOME/extensions-web,GNOME/extensions-web | html | ## Code Before:
{% extends "base.html" %}
{% block body %}
<form action="{% url auth-login %}" method="POST" id="auth_form">
<input type="hidden" name="next" value="{{ next }}">
{% csrf_token %}
<ol>
<li>
{% for error in form.username.errors %}
<p class="error">{{ error }}</p>
{% endfor %}
{{ form.username.label_tag }}
{{ form.username }}
</li>
<li>
{% for error in form.password.errors %}
<p class="error">{{ error }}</p>
{% endfor %}
{{ form.password.label_tag }}
{{ form.password }}
</li>
<li class="submit">
<input type="submit" value="Log in">
</li>
</ol>
</form>
<a href="{% url registration_register %}">Register</a>
<a href="{% url auth_password_reset %}">Forgot your password?</a>
{% endblock %}
## Instruction:
Use implicit form URL submit
## Code After:
{% extends "base.html" %}
{% block body %}
<form action="" method="POST" id="auth_form">
<input type="hidden" name="next" value="{{ next }}">
{% csrf_token %}
<ol>
<li>
{% for error in form.username.errors %}
<p class="error">{{ error }}</p>
{% endfor %}
{{ form.username.label_tag }}
{{ form.username }}
</li>
<li>
{% for error in form.password.errors %}
<p class="error">{{ error }}</p>
{% endfor %}
{{ form.password.label_tag }}
{{ form.password }}
</li>
<li class="submit">
<input type="submit" value="Log in">
</li>
</ol>
</form>
<a href="{% url registration_register %}">Register</a>
<a href="{% url auth_password_reset %}">Forgot your password?</a>
{% endblock %}
| {% extends "base.html" %}
{% block body %}
- <form action="{% url auth-login %}" method="POST" id="auth_form">
? --------------------
+ <form action="" method="POST" id="auth_form">
<input type="hidden" name="next" value="{{ next }}">
{% csrf_token %}
<ol>
<li>
{% for error in form.username.errors %}
<p class="error">{{ error }}</p>
{% endfor %}
{{ form.username.label_tag }}
{{ form.username }}
</li>
<li>
{% for error in form.password.errors %}
<p class="error">{{ error }}</p>
{% endfor %}
{{ form.password.label_tag }}
{{ form.password }}
</li>
<li class="submit">
<input type="submit" value="Log in">
</li>
</ol>
</form>
<a href="{% url registration_register %}">Register</a>
<a href="{% url auth_password_reset %}">Forgot your password?</a>
{% endblock %} | 2 | 0.0625 | 1 | 1 |
0efe5ad130e1037d8ec5065777d16d4345f97a46 | setup.py | setup.py |
from setuptools import setup, find_packages
import os
version = '1.0' + os.environ.get('BUILD_SUFFIX', '')
setup(name='confab',
version=version,
description='Configuration management with Fabric and Jinja2.',
author='Location Labs',
author_email='info@locationlabs.com',
url='http://github.com/locationlabs/confab',
license='Apache2',
packages=find_packages(exclude=['*.tests']),
setup_requires=[
'nose>=1.0'
],
install_requires=[
'Fabric>=1.4',
'Jinja2>=2.4',
'python-magic'
],
test_suite='confab.tests',
entry_points={
'console_scripts': [
'confab = confab.main:main',
]
},
)
|
from setuptools import setup, find_packages
__version__ = '1.0'
# Jenkins will replace __build__ with a unique value.
__build__ = ''
setup(name='confab',
version=__version__ + __build__,
description='Configuration management with Fabric and Jinja2.',
author='Location Labs',
author_email='info@locationlabs.com',
url='http://github.com/locationlabs/confab',
license='Apache2',
packages=find_packages(exclude=['*.tests']),
setup_requires=[
'nose>=1.0'
],
install_requires=[
'Fabric>=1.4',
'Jinja2>=2.4',
'python-magic'
],
test_suite='confab.tests',
entry_points={
'console_scripts': [
'confab = confab.main:main',
]
},
)
| Use __build__ syntax instead of os.environ | Use __build__ syntax instead of os.environ
| Python | apache-2.0 | locationlabs/confab | python | ## Code Before:
from setuptools import setup, find_packages
import os
version = '1.0' + os.environ.get('BUILD_SUFFIX', '')
setup(name='confab',
version=version,
description='Configuration management with Fabric and Jinja2.',
author='Location Labs',
author_email='info@locationlabs.com',
url='http://github.com/locationlabs/confab',
license='Apache2',
packages=find_packages(exclude=['*.tests']),
setup_requires=[
'nose>=1.0'
],
install_requires=[
'Fabric>=1.4',
'Jinja2>=2.4',
'python-magic'
],
test_suite='confab.tests',
entry_points={
'console_scripts': [
'confab = confab.main:main',
]
},
)
## Instruction:
Use __build__ syntax instead of os.environ
## Code After:
from setuptools import setup, find_packages
__version__ = '1.0'
# Jenkins will replace __build__ with a unique value.
__build__ = ''
setup(name='confab',
version=__version__ + __build__,
description='Configuration management with Fabric and Jinja2.',
author='Location Labs',
author_email='info@locationlabs.com',
url='http://github.com/locationlabs/confab',
license='Apache2',
packages=find_packages(exclude=['*.tests']),
setup_requires=[
'nose>=1.0'
],
install_requires=[
'Fabric>=1.4',
'Jinja2>=2.4',
'python-magic'
],
test_suite='confab.tests',
entry_points={
'console_scripts': [
'confab = confab.main:main',
]
},
)
|
from setuptools import setup, find_packages
- import os
- version = '1.0' + os.environ.get('BUILD_SUFFIX', '')
+ __version__ = '1.0'
+
+ # Jenkins will replace __build__ with a unique value.
+ __build__ = ''
setup(name='confab',
- version=version,
+ version=__version__ + __build__,
description='Configuration management with Fabric and Jinja2.',
author='Location Labs',
author_email='info@locationlabs.com',
url='http://github.com/locationlabs/confab',
license='Apache2',
packages=find_packages(exclude=['*.tests']),
setup_requires=[
'nose>=1.0'
],
install_requires=[
'Fabric>=1.4',
'Jinja2>=2.4',
'python-magic'
],
test_suite='confab.tests',
entry_points={
'console_scripts': [
'confab = confab.main:main',
]
},
) | 8 | 0.275862 | 5 | 3 |
84a33eee225717a55f156173e10397b795dcac05 | meta-xilinx-core/recipes-bsp/bootgen/bootgen_1.0.bb | meta-xilinx-core/recipes-bsp/bootgen/bootgen_1.0.bb | SUMMARY = "Building and installing bootgen"
DESCRIPTION = "Building and installing bootgen, a Xilinx tool that lets you stitch binary files together and generate device boot images"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=d526b6d0807bf263b97da1da876f39b1"
S = "${WORKDIR}/git"
DEPENDS += "openssl"
RDEPENDS:${PN} += "openssl"
REPO ?= "git://github.com/Xilinx/bootgen.git;protocol=https"
BRANCH ?= "xlnx_rel_v2022.2"
SRCREV = "8c303a5f9c1db67a9f8b7643678740d007bf567c"
BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}"
SRC_URI = "${REPO};${BRANCHARG}"
EXTRA_OEMAKE += 'CROSS_COMPILER="${CXX}" -C ${S}'
CXXFLAGS:append = " -std=c++0x"
TARGET_CC_ARCH += "${LDFLAGS}"
do_install() {
install -d ${D}${bindir}
install -Dm 0755 ${S}/bootgen ${D}${bindir}
}
FILES:${PN} = "${bindir}/bootgen"
BBCLASSEXTEND = "native nativesdk"
| SUMMARY = "Building and installing bootgen"
DESCRIPTION = "Building and installing bootgen, a Xilinx tool that lets you stitch binary files together and generate device boot images"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=d526b6d0807bf263b97da1da876f39b1"
S = "${WORKDIR}/git"
DEPENDS += "openssl"
RDEPENDS:${PN} += "openssl"
REPO ?= "git://github.com/Xilinx/bootgen.git;protocol=https"
BRANCH ?= "xlnx_rel_v2022.2"
SRCREV = "cf4ba93b99644dc4429ef633471a639e1382f0e7"
BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}"
SRC_URI = "${REPO};${BRANCHARG}"
EXTRA_OEMAKE += 'CROSS_COMPILER="${CXX}" -C ${S}'
CXXFLAGS:append = " -std=c++0x"
TARGET_CC_ARCH += "${LDFLAGS}"
do_install() {
install -d ${D}${bindir}
install -Dm 0755 ${S}/bootgen ${D}${bindir}
}
FILES:${PN} = "${bindir}/bootgen"
BBCLASSEXTEND = "native nativesdk"
| Update to bootgen SRCREV to point to latest commit | Update to bootgen SRCREV to point to latest commit
Signed-off-by: Mark Hatle <41765ab18fb75e64ff0efe27f2ebcdb2d6f7e44e@amd.com>
| BitBake | mit | Xilinx/meta-xilinx,Xilinx/meta-xilinx,Xilinx/meta-xilinx,Xilinx/meta-xilinx,Xilinx/meta-xilinx,Xilinx/meta-xilinx | bitbake | ## Code Before:
SUMMARY = "Building and installing bootgen"
DESCRIPTION = "Building and installing bootgen, a Xilinx tool that lets you stitch binary files together and generate device boot images"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=d526b6d0807bf263b97da1da876f39b1"
S = "${WORKDIR}/git"
DEPENDS += "openssl"
RDEPENDS:${PN} += "openssl"
REPO ?= "git://github.com/Xilinx/bootgen.git;protocol=https"
BRANCH ?= "xlnx_rel_v2022.2"
SRCREV = "8c303a5f9c1db67a9f8b7643678740d007bf567c"
BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}"
SRC_URI = "${REPO};${BRANCHARG}"
EXTRA_OEMAKE += 'CROSS_COMPILER="${CXX}" -C ${S}'
CXXFLAGS:append = " -std=c++0x"
TARGET_CC_ARCH += "${LDFLAGS}"
do_install() {
install -d ${D}${bindir}
install -Dm 0755 ${S}/bootgen ${D}${bindir}
}
FILES:${PN} = "${bindir}/bootgen"
BBCLASSEXTEND = "native nativesdk"
## Instruction:
Update to bootgen SRCREV to point to latest commit
Signed-off-by: Mark Hatle <41765ab18fb75e64ff0efe27f2ebcdb2d6f7e44e@amd.com>
## Code After:
SUMMARY = "Building and installing bootgen"
DESCRIPTION = "Building and installing bootgen, a Xilinx tool that lets you stitch binary files together and generate device boot images"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=d526b6d0807bf263b97da1da876f39b1"
S = "${WORKDIR}/git"
DEPENDS += "openssl"
RDEPENDS:${PN} += "openssl"
REPO ?= "git://github.com/Xilinx/bootgen.git;protocol=https"
BRANCH ?= "xlnx_rel_v2022.2"
SRCREV = "cf4ba93b99644dc4429ef633471a639e1382f0e7"
BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}"
SRC_URI = "${REPO};${BRANCHARG}"
EXTRA_OEMAKE += 'CROSS_COMPILER="${CXX}" -C ${S}'
CXXFLAGS:append = " -std=c++0x"
TARGET_CC_ARCH += "${LDFLAGS}"
do_install() {
install -d ${D}${bindir}
install -Dm 0755 ${S}/bootgen ${D}${bindir}
}
FILES:${PN} = "${bindir}/bootgen"
BBCLASSEXTEND = "native nativesdk"
| SUMMARY = "Building and installing bootgen"
DESCRIPTION = "Building and installing bootgen, a Xilinx tool that lets you stitch binary files together and generate device boot images"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=d526b6d0807bf263b97da1da876f39b1"
S = "${WORKDIR}/git"
DEPENDS += "openssl"
RDEPENDS:${PN} += "openssl"
REPO ?= "git://github.com/Xilinx/bootgen.git;protocol=https"
BRANCH ?= "xlnx_rel_v2022.2"
- SRCREV = "8c303a5f9c1db67a9f8b7643678740d007bf567c"
+ SRCREV = "cf4ba93b99644dc4429ef633471a639e1382f0e7"
BRANCHARG = "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}"
SRC_URI = "${REPO};${BRANCHARG}"
EXTRA_OEMAKE += 'CROSS_COMPILER="${CXX}" -C ${S}'
CXXFLAGS:append = " -std=c++0x"
TARGET_CC_ARCH += "${LDFLAGS}"
do_install() {
install -d ${D}${bindir}
install -Dm 0755 ${S}/bootgen ${D}${bindir}
}
FILES:${PN} = "${bindir}/bootgen"
BBCLASSEXTEND = "native nativesdk" | 2 | 0.064516 | 1 | 1 |
ebe94114b14418c11e829e952c2ee92ea42585cb | test/CodeGen/tentative-decls.c | test/CodeGen/tentative-decls.c | // RUN: clang-cc -emit-llvm -o %t %s &&
// RUN: grep '@r = common global \[1 x .*\] zeroinitializer' %t &&
int r[];
int (*a)[] = &r;
struct s0;
struct s0 x;
// RUN: grep '@x = common global .struct.s0 zeroinitializer' %t &&
struct s0 y;
// RUN: grep '@y = common global .struct.s0 zeroinitializer' %t &&
struct s0 *f0() {
return &y;
}
struct s0 {
int x;
};
// RUN: grep '@b = common global \[1 x .*\] zeroinitializer' %t &&
int b[];
int *f1() {
return b;
}
// Check that the most recent tentative definition wins.
// RUN: grep '@c = common global \[4 x .*\] zeroinitializer' %t &&
int c[];
int c[4];
// RUN: true
| // RUN: clang-cc -emit-llvm -o %t %s &&
// RUN: grep '@r = common global \[1 x .*\] zeroinitializer' %t &&
int r[];
int (*a)[] = &r;
struct s0;
struct s0 x;
// RUN: grep '@x = common global .struct.s0 zeroinitializer' %t &&
struct s0 y;
// RUN: grep '@y = common global .struct.s0 zeroinitializer' %t &&
struct s0 *f0() {
return &y;
}
struct s0 {
int x;
};
// RUN: grep '@b = common global \[1 x .*\] zeroinitializer' %t &&
int b[];
int *f1() {
return b;
}
// Check that the most recent tentative definition wins.
// RUN: grep '@c = common global \[4 x .*\] zeroinitializer' %t &&
int c[];
int c[4];
// Check that we emit static tentative definitions
// RUN: grep '@c5 = internal global \[1 x .*\] zeroinitializer' %t &&
static int c5[];
static int func() { return c5[0]; }
int callfunc() { return func(); }
// RUN: true
| Add testcase that illustrates the problem from r69699 regarding tentative definitions of statics | Add testcase that illustrates the problem from r69699 regarding tentative definitions of statics
git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@70543 91177308-0d34-0410-b5e6-96231b3b80d8
| C | apache-2.0 | llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang | c | ## Code Before:
// RUN: clang-cc -emit-llvm -o %t %s &&
// RUN: grep '@r = common global \[1 x .*\] zeroinitializer' %t &&
int r[];
int (*a)[] = &r;
struct s0;
struct s0 x;
// RUN: grep '@x = common global .struct.s0 zeroinitializer' %t &&
struct s0 y;
// RUN: grep '@y = common global .struct.s0 zeroinitializer' %t &&
struct s0 *f0() {
return &y;
}
struct s0 {
int x;
};
// RUN: grep '@b = common global \[1 x .*\] zeroinitializer' %t &&
int b[];
int *f1() {
return b;
}
// Check that the most recent tentative definition wins.
// RUN: grep '@c = common global \[4 x .*\] zeroinitializer' %t &&
int c[];
int c[4];
// RUN: true
## Instruction:
Add testcase that illustrates the problem from r69699 regarding tentative definitions of statics
git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@70543 91177308-0d34-0410-b5e6-96231b3b80d8
## Code After:
// RUN: clang-cc -emit-llvm -o %t %s &&
// RUN: grep '@r = common global \[1 x .*\] zeroinitializer' %t &&
int r[];
int (*a)[] = &r;
struct s0;
struct s0 x;
// RUN: grep '@x = common global .struct.s0 zeroinitializer' %t &&
struct s0 y;
// RUN: grep '@y = common global .struct.s0 zeroinitializer' %t &&
struct s0 *f0() {
return &y;
}
struct s0 {
int x;
};
// RUN: grep '@b = common global \[1 x .*\] zeroinitializer' %t &&
int b[];
int *f1() {
return b;
}
// Check that the most recent tentative definition wins.
// RUN: grep '@c = common global \[4 x .*\] zeroinitializer' %t &&
int c[];
int c[4];
// Check that we emit static tentative definitions
// RUN: grep '@c5 = internal global \[1 x .*\] zeroinitializer' %t &&
static int c5[];
static int func() { return c5[0]; }
int callfunc() { return func(); }
// RUN: true
| // RUN: clang-cc -emit-llvm -o %t %s &&
// RUN: grep '@r = common global \[1 x .*\] zeroinitializer' %t &&
int r[];
int (*a)[] = &r;
struct s0;
struct s0 x;
// RUN: grep '@x = common global .struct.s0 zeroinitializer' %t &&
struct s0 y;
// RUN: grep '@y = common global .struct.s0 zeroinitializer' %t &&
struct s0 *f0() {
return &y;
}
struct s0 {
int x;
};
// RUN: grep '@b = common global \[1 x .*\] zeroinitializer' %t &&
int b[];
int *f1() {
return b;
}
// Check that the most recent tentative definition wins.
// RUN: grep '@c = common global \[4 x .*\] zeroinitializer' %t &&
int c[];
int c[4];
+ // Check that we emit static tentative definitions
+ // RUN: grep '@c5 = internal global \[1 x .*\] zeroinitializer' %t &&
+ static int c5[];
+ static int func() { return c5[0]; }
+ int callfunc() { return func(); }
+
// RUN: true | 6 | 0.181818 | 6 | 0 |
c01cd926cbd2bd3aa7bf9ad2f0e9f53ef9b16ac0 | Manifest.txt | Manifest.txt | History.rdoc
LICENSE
Manifest.txt
README.rdoc
Rakefile
bin/mizuno
lib/mizuno/base.rb
lib/mizuno.rb
lib/mizuno/http_server.rb
lib/mizuno/rack_servlet.rb
lib/rack/handler/mizuno.rb
spec/mizuno_spec.rb
spec/spec_helper.rb
spec/test_app.rb
spec/data/hello.txt
spec/data/reddit-icon.png
| History.rdoc
LICENSE
Manifest.txt
README.rdoc
Rakefile
bin/mizuno
example/config.ru
lib/mizuno/base.rb
lib/mizuno.rb
lib/mizuno/http_server.rb
lib/mizuno/rack_servlet.rb
lib/rack/handler/mizuno.rb
spec/mizuno_spec.rb
spec/spec_helper.rb
spec/test_app.rb
spec/data/hello.txt
spec/data/reddit-icon.png
| Add example to manifest per last merge | Add example to manifest per last merge
| Text | apache-2.0 | dekellum/fishwife,dekellum/fishwife | text | ## Code Before:
History.rdoc
LICENSE
Manifest.txt
README.rdoc
Rakefile
bin/mizuno
lib/mizuno/base.rb
lib/mizuno.rb
lib/mizuno/http_server.rb
lib/mizuno/rack_servlet.rb
lib/rack/handler/mizuno.rb
spec/mizuno_spec.rb
spec/spec_helper.rb
spec/test_app.rb
spec/data/hello.txt
spec/data/reddit-icon.png
## Instruction:
Add example to manifest per last merge
## Code After:
History.rdoc
LICENSE
Manifest.txt
README.rdoc
Rakefile
bin/mizuno
example/config.ru
lib/mizuno/base.rb
lib/mizuno.rb
lib/mizuno/http_server.rb
lib/mizuno/rack_servlet.rb
lib/rack/handler/mizuno.rb
spec/mizuno_spec.rb
spec/spec_helper.rb
spec/test_app.rb
spec/data/hello.txt
spec/data/reddit-icon.png
| History.rdoc
LICENSE
Manifest.txt
README.rdoc
Rakefile
bin/mizuno
+ example/config.ru
lib/mizuno/base.rb
lib/mizuno.rb
lib/mizuno/http_server.rb
lib/mizuno/rack_servlet.rb
lib/rack/handler/mizuno.rb
spec/mizuno_spec.rb
spec/spec_helper.rb
spec/test_app.rb
spec/data/hello.txt
spec/data/reddit-icon.png | 1 | 0.0625 | 1 | 0 |
d4c8cfffb7f290bb6d8b7c973f75d9d103eb952d | src/main/java/in/ac/amu/zhcet/configuration/SentryConfiguration.java | src/main/java/in/ac/amu/zhcet/configuration/SentryConfiguration.java | package in.ac.amu.zhcet.configuration;
import in.ac.amu.zhcet.data.model.user.UserAuth;
import in.ac.amu.zhcet.service.UserService;
import io.sentry.Sentry;
import io.sentry.event.helper.EventBuilderHelper;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Slf4j
@Component
public class SentryConfiguration {
@Data
private static class User {
private String userId;
private String name;
private String departmentName;
private String email;
private String[] roles;
private String type;
}
@Autowired
public SentryConfiguration(UserService userService, ModelMapper modelMapper) {
EventBuilderHelper myEventBuilderHelper = eventBuilder -> {
UserAuth loggedInUser = userService.getLoggedInUser();
if (loggedInUser != null) {
eventBuilder.withExtra("user", modelMapper.map(loggedInUser, User.class));
} else {
eventBuilder.withExtra("user", "UNAUTHORIZED");
}
};
Sentry.getStoredClient().addBuilderHelper(myEventBuilderHelper);
}
}
| package in.ac.amu.zhcet.configuration;
import in.ac.amu.zhcet.data.model.user.UserAuth;
import in.ac.amu.zhcet.service.UserService;
import io.sentry.Sentry;
import io.sentry.SentryClient;
import io.sentry.event.helper.ContextBuilderHelper;
import io.sentry.event.helper.EventBuilderHelper;
import io.sentry.event.helper.ForwardedAddressResolver;
import io.sentry.event.helper.HttpEventBuilderHelper;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Slf4j
@Component
public class SentryConfiguration {
@Data
private static class User {
private String userId;
private String name;
private String departmentName;
private String email;
private String[] roles;
private String type;
}
@Autowired
public SentryConfiguration(UserService userService, ModelMapper modelMapper) {
EventBuilderHelper myEventBuilderHelper = eventBuilder -> {
UserAuth loggedInUser = userService.getLoggedInUser();
if (loggedInUser != null) {
eventBuilder.withExtra("user", modelMapper.map(loggedInUser, User.class));
} else {
eventBuilder.withExtra("user", "UNAUTHORIZED");
}
};
SentryClient sentryClient = Sentry.getStoredClient();
sentryClient.addBuilderHelper(myEventBuilderHelper);
sentryClient.addBuilderHelper(new HttpEventBuilderHelper(new ForwardedAddressResolver()));
sentryClient.addBuilderHelper(new ContextBuilderHelper(sentryClient));
}
}
| Add forward address resolver to sentry | fix: Add forward address resolver to sentry
| Java | apache-2.0 | zhcet-amu/zhcet-web,zhcet-amu/zhcet-web,zhcet-amu/zhcet-web,zhcet-amu/zhcet-web,zhcet-amu/zhcet-web | java | ## Code Before:
package in.ac.amu.zhcet.configuration;
import in.ac.amu.zhcet.data.model.user.UserAuth;
import in.ac.amu.zhcet.service.UserService;
import io.sentry.Sentry;
import io.sentry.event.helper.EventBuilderHelper;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Slf4j
@Component
public class SentryConfiguration {
@Data
private static class User {
private String userId;
private String name;
private String departmentName;
private String email;
private String[] roles;
private String type;
}
@Autowired
public SentryConfiguration(UserService userService, ModelMapper modelMapper) {
EventBuilderHelper myEventBuilderHelper = eventBuilder -> {
UserAuth loggedInUser = userService.getLoggedInUser();
if (loggedInUser != null) {
eventBuilder.withExtra("user", modelMapper.map(loggedInUser, User.class));
} else {
eventBuilder.withExtra("user", "UNAUTHORIZED");
}
};
Sentry.getStoredClient().addBuilderHelper(myEventBuilderHelper);
}
}
## Instruction:
fix: Add forward address resolver to sentry
## Code After:
package in.ac.amu.zhcet.configuration;
import in.ac.amu.zhcet.data.model.user.UserAuth;
import in.ac.amu.zhcet.service.UserService;
import io.sentry.Sentry;
import io.sentry.SentryClient;
import io.sentry.event.helper.ContextBuilderHelper;
import io.sentry.event.helper.EventBuilderHelper;
import io.sentry.event.helper.ForwardedAddressResolver;
import io.sentry.event.helper.HttpEventBuilderHelper;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Slf4j
@Component
public class SentryConfiguration {
@Data
private static class User {
private String userId;
private String name;
private String departmentName;
private String email;
private String[] roles;
private String type;
}
@Autowired
public SentryConfiguration(UserService userService, ModelMapper modelMapper) {
EventBuilderHelper myEventBuilderHelper = eventBuilder -> {
UserAuth loggedInUser = userService.getLoggedInUser();
if (loggedInUser != null) {
eventBuilder.withExtra("user", modelMapper.map(loggedInUser, User.class));
} else {
eventBuilder.withExtra("user", "UNAUTHORIZED");
}
};
SentryClient sentryClient = Sentry.getStoredClient();
sentryClient.addBuilderHelper(myEventBuilderHelper);
sentryClient.addBuilderHelper(new HttpEventBuilderHelper(new ForwardedAddressResolver()));
sentryClient.addBuilderHelper(new ContextBuilderHelper(sentryClient));
}
}
| package in.ac.amu.zhcet.configuration;
import in.ac.amu.zhcet.data.model.user.UserAuth;
import in.ac.amu.zhcet.service.UserService;
import io.sentry.Sentry;
+ import io.sentry.SentryClient;
+ import io.sentry.event.helper.ContextBuilderHelper;
import io.sentry.event.helper.EventBuilderHelper;
+ import io.sentry.event.helper.ForwardedAddressResolver;
+ import io.sentry.event.helper.HttpEventBuilderHelper;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Slf4j
@Component
public class SentryConfiguration {
@Data
private static class User {
private String userId;
private String name;
private String departmentName;
private String email;
private String[] roles;
private String type;
}
@Autowired
public SentryConfiguration(UserService userService, ModelMapper modelMapper) {
EventBuilderHelper myEventBuilderHelper = eventBuilder -> {
UserAuth loggedInUser = userService.getLoggedInUser();
if (loggedInUser != null) {
eventBuilder.withExtra("user", modelMapper.map(loggedInUser, User.class));
} else {
eventBuilder.withExtra("user", "UNAUTHORIZED");
}
};
+ SentryClient sentryClient = Sentry.getStoredClient();
- Sentry.getStoredClient().addBuilderHelper(myEventBuilderHelper);
? ^ ---------- --
+ sentryClient.addBuilderHelper(myEventBuilderHelper);
? ^
+ sentryClient.addBuilderHelper(new HttpEventBuilderHelper(new ForwardedAddressResolver()));
+ sentryClient.addBuilderHelper(new ContextBuilderHelper(sentryClient));
}
} | 9 | 0.214286 | 8 | 1 |
fc0fbbd8b2e0effbd90c6767557179069f23a0a8 | wavenet_params.json | wavenet_params.json | {
"filter_width": 2,
"quantization_steps": 256,
"sample_rate": 16000,
"dilations": [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512],
"residual_channels": 32,
"dilation_channels":16
}
| {
"filter_width": 2,
"quantization_steps": 256,
"sample_rate": 16000,
"dilations": [1, 2, 4, 8, 16, 32, 64, 128, 256,
1, 2, 4, 8, 16, 32, 64, 128, 256],
"residual_channels": 32,
"dilation_channels":16
}
| Break line in json file | Break line in json file
| JSON | mit | jyegerlehner/tensorflow-wavenet,genekogan/tensorflow-wavenet,ibab/tensorflow-wavenet,thakkarV/tensorflow-wavenet,jyegerlehner/tensorflow-wavenet,kutakieu/tensorflow-wavenet,kutakieu/tensorflow-wavenet,genekogan/tensorflow-wavenet,ibab/tensorflow-wavenet,thakkarV/tensorflow-wavenet | json | ## Code Before:
{
"filter_width": 2,
"quantization_steps": 256,
"sample_rate": 16000,
"dilations": [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512],
"residual_channels": 32,
"dilation_channels":16
}
## Instruction:
Break line in json file
## Code After:
{
"filter_width": 2,
"quantization_steps": 256,
"sample_rate": 16000,
"dilations": [1, 2, 4, 8, 16, 32, 64, 128, 256,
1, 2, 4, 8, 16, 32, 64, 128, 256],
"residual_channels": 32,
"dilation_channels":16
}
| {
"filter_width": 2,
"quantization_steps": 256,
"sample_rate": 16000,
- "dilations": [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512],
+ "dilations": [1, 2, 4, 8, 16, 32, 64, 128, 256,
+ 1, 2, 4, 8, 16, 32, 64, 128, 256],
"residual_channels": 32,
"dilation_channels":16
} | 3 | 0.375 | 2 | 1 |
d80a92cfe45907b9f91fd212a3b06fa0b2321364 | wagtail/tests/routablepage/models.py | wagtail/tests/routablepage/models.py | from django.db import models
from django.http import HttpResponse
from django.conf.urls import url
from wagtail.contrib.wagtailroutablepage.models import RoutablePage
def routable_page_external_view(request, arg):
return HttpResponse("EXTERNAL VIEW: " + arg)
class RoutablePageTest(RoutablePage):
subpage_urls = (
url(r'^$', 'main', name='main'),
url(r'^archive/year/(\d+)/$', 'archive_by_year', name='archive_by_year'),
url(r'^archive/author/(?P<author_slug>.+)/$', 'archive_by_author', name='archive_by_author'),
url(r'^external/(.+)/$', routable_page_external_view, name='external_view')
)
def archive_by_year(self, request, year):
return HttpResponse("ARCHIVE BY YEAR: " + str(year))
def archive_by_author(self, request, author_slug):
return HttpResponse("ARCHIVE BY AUTHOR: " + author_slug)
def main(self, request):
return HttpResponse("MAIN VIEW")
| from django.db import models
from django.http import HttpResponse
from django.conf.urls import url
from wagtail.contrib.wagtailroutablepage.models import RoutablePage
def routable_page_external_view(request, arg):
return HttpResponse("EXTERNAL VIEW: " + arg)
class RoutablePageTest(RoutablePage):
@property
def subpage_urls(self):
return (
url(r'^$', self.main, name='main'),
url(r'^archive/year/(\d+)/$', self.archive_by_year, name='archive_by_year'),
url(r'^archive/author/(?P<author_slug>.+)/$', self.archive_by_author, name='archive_by_author'),
url(r'^external/(.+)/$', routable_page_external_view, name='external_view')
)
def archive_by_year(self, request, year):
return HttpResponse("ARCHIVE BY YEAR: " + str(year))
def archive_by_author(self, request, author_slug):
return HttpResponse("ARCHIVE BY AUTHOR: " + author_slug)
def main(self, request):
return HttpResponse("MAIN VIEW")
| Make subpage_urls a property on RoutablePageTest | Make subpage_urls a property on RoutablePageTest
| Python | bsd-3-clause | JoshBarr/wagtail,mikedingjan/wagtail,gasman/wagtail,takeflight/wagtail,kurtw/wagtail,jorge-marques/wagtail,Pennebaker/wagtail,zerolab/wagtail,kurtw/wagtail,bjesus/wagtail,nilnvoid/wagtail,mayapurmedia/wagtail,chrxr/wagtail,nilnvoid/wagtail,zerolab/wagtail,Klaudit/wagtail,iho/wagtail,serzans/wagtail,Tivix/wagtail,wagtail/wagtail,zerolab/wagtail,kurtw/wagtail,inonit/wagtail,mephizzle/wagtail,quru/wagtail,mjec/wagtail,Toshakins/wagtail,rv816/wagtail,mjec/wagtail,nimasmi/wagtail,gasman/wagtail,nealtodd/wagtail,darith27/wagtail,KimGlazebrook/wagtail-experiment,quru/wagtail,iansprice/wagtail,rsalmaso/wagtail,gasman/wagtail,inonit/wagtail,WQuanfeng/wagtail,stevenewey/wagtail,stevenewey/wagtail,nealtodd/wagtail,KimGlazebrook/wagtail-experiment,hamsterbacke23/wagtail,kaedroho/wagtail,timorieber/wagtail,thenewguy/wagtail,mephizzle/wagtail,mixxorz/wagtail,janusnic/wagtail,chrxr/wagtail,zerolab/wagtail,mephizzle/wagtail,quru/wagtail,davecranwell/wagtail,takeshineshiro/wagtail,nimasmi/wagtail,thenewguy/wagtail,takeflight/wagtail,jordij/wagtail,Klaudit/wagtail,marctc/wagtail,hamsterbacke23/wagtail,mayapurmedia/wagtail,nutztherookie/wagtail,darith27/wagtail,Toshakins/wagtail,taedori81/wagtail,gogobook/wagtail,JoshBarr/wagtail,nealtodd/wagtail,hamsterbacke23/wagtail,takeshineshiro/wagtail,Klaudit/wagtail,thenewguy/wagtail,jorge-marques/wagtail,hanpama/wagtail,takeflight/wagtail,thenewguy/wagtail,stevenewey/wagtail,mjec/wagtail,hamsterbacke23/wagtail,nutztherookie/wagtail,mikedingjan/wagtail,nrsimha/wagtail,hanpama/wagtail,jnns/wagtail,kurtrwall/wagtail,mikedingjan/wagtail,Toshakins/wagtail,wagtail/wagtail,FlipperPA/wagtail,jordij/wagtail,janusnic/wagtail,gasman/wagtail,nimasmi/wagtail,darith27/wagtail,rsalmaso/wagtail,jorge-marques/wagtail,kurtw/wagtail,mixxorz/wagtail,kurtrwall/wagtail,iansprice/wagtail,serzans/wagtail,serzans/wagtail,iansprice/wagtail,nrsimha/wagtail,JoshBarr/wagtail,taedori81/wagtail,inonit/wagtail,bjesus/wagtail,mayapurmedia/wagtail,FlipperPA/wagtail,nrsimha/wagtail,Tivix/wagtail,marctc/wagtail,janusnic/wagtail,iho/wagtail,takeflight/wagtail,taedori81/wagtail,gogobook/wagtail,hanpama/wagtail,jorge-marques/wagtail,mephizzle/wagtail,jnns/wagtail,tangentlabs/wagtail,nilnvoid/wagtail,rsalmaso/wagtail,m-sanders/wagtail,taedori81/wagtail,nimasmi/wagtail,nutztherookie/wagtail,Pennebaker/wagtail,rjsproxy/wagtail,rjsproxy/wagtail,kaedroho/wagtail,hanpama/wagtail,chrxr/wagtail,jordij/wagtail,mayapurmedia/wagtail,JoshBarr/wagtail,jordij/wagtail,WQuanfeng/wagtail,taedori81/wagtail,gogobook/wagtail,Pennebaker/wagtail,m-sanders/wagtail,jnns/wagtail,timorieber/wagtail,mixxorz/wagtail,thenewguy/wagtail,davecranwell/wagtail,gasman/wagtail,nealtodd/wagtail,mixxorz/wagtail,KimGlazebrook/wagtail-experiment,iansprice/wagtail,tangentlabs/wagtail,wagtail/wagtail,m-sanders/wagtail,takeshineshiro/wagtail,davecranwell/wagtail,timorieber/wagtail,mixxorz/wagtail,rjsproxy/wagtail,Klaudit/wagtail,kaedroho/wagtail,wagtail/wagtail,janusnic/wagtail,jnns/wagtail,gogobook/wagtail,iho/wagtail,rv816/wagtail,KimGlazebrook/wagtail-experiment,mikedingjan/wagtail,torchbox/wagtail,darith27/wagtail,stevenewey/wagtail,rsalmaso/wagtail,torchbox/wagtail,bjesus/wagtail,Pennebaker/wagtail,iho/wagtail,chrxr/wagtail,WQuanfeng/wagtail,Tivix/wagtail,Toshakins/wagtail,rsalmaso/wagtail,mjec/wagtail,nilnvoid/wagtail,rv816/wagtail,kaedroho/wagtail,kurtrwall/wagtail,m-sanders/wagtail,nutztherookie/wagtail,nrsimha/wagtail,inonit/wagtail,tangentlabs/wagtail,FlipperPA/wagtail,kurtrwall/wagtail,FlipperPA/wagtail,torchbox/wagtail,rv816/wagtail,torchbox/wagtail,Tivix/wagtail,davecranwell/wagtail,quru/wagtail,WQuanfeng/wagtail,wagtail/wagtail,zerolab/wagtail,serzans/wagtail,takeshineshiro/wagtail,kaedroho/wagtail,marctc/wagtail,timorieber/wagtail,bjesus/wagtail,tangentlabs/wagtail,marctc/wagtail,rjsproxy/wagtail,jorge-marques/wagtail | python | ## Code Before:
from django.db import models
from django.http import HttpResponse
from django.conf.urls import url
from wagtail.contrib.wagtailroutablepage.models import RoutablePage
def routable_page_external_view(request, arg):
return HttpResponse("EXTERNAL VIEW: " + arg)
class RoutablePageTest(RoutablePage):
subpage_urls = (
url(r'^$', 'main', name='main'),
url(r'^archive/year/(\d+)/$', 'archive_by_year', name='archive_by_year'),
url(r'^archive/author/(?P<author_slug>.+)/$', 'archive_by_author', name='archive_by_author'),
url(r'^external/(.+)/$', routable_page_external_view, name='external_view')
)
def archive_by_year(self, request, year):
return HttpResponse("ARCHIVE BY YEAR: " + str(year))
def archive_by_author(self, request, author_slug):
return HttpResponse("ARCHIVE BY AUTHOR: " + author_slug)
def main(self, request):
return HttpResponse("MAIN VIEW")
## Instruction:
Make subpage_urls a property on RoutablePageTest
## Code After:
from django.db import models
from django.http import HttpResponse
from django.conf.urls import url
from wagtail.contrib.wagtailroutablepage.models import RoutablePage
def routable_page_external_view(request, arg):
return HttpResponse("EXTERNAL VIEW: " + arg)
class RoutablePageTest(RoutablePage):
@property
def subpage_urls(self):
return (
url(r'^$', self.main, name='main'),
url(r'^archive/year/(\d+)/$', self.archive_by_year, name='archive_by_year'),
url(r'^archive/author/(?P<author_slug>.+)/$', self.archive_by_author, name='archive_by_author'),
url(r'^external/(.+)/$', routable_page_external_view, name='external_view')
)
def archive_by_year(self, request, year):
return HttpResponse("ARCHIVE BY YEAR: " + str(year))
def archive_by_author(self, request, author_slug):
return HttpResponse("ARCHIVE BY AUTHOR: " + author_slug)
def main(self, request):
return HttpResponse("MAIN VIEW")
| from django.db import models
from django.http import HttpResponse
from django.conf.urls import url
from wagtail.contrib.wagtailroutablepage.models import RoutablePage
def routable_page_external_view(request, arg):
return HttpResponse("EXTERNAL VIEW: " + arg)
class RoutablePageTest(RoutablePage):
- subpage_urls = (
+ @property
+ def subpage_urls(self):
+ return (
- url(r'^$', 'main', name='main'),
? ^ -
+ url(r'^$', self.main, name='main'),
? ++++ ^^^^^
- url(r'^archive/year/(\d+)/$', 'archive_by_year', name='archive_by_year'),
? ^ -
+ url(r'^archive/year/(\d+)/$', self.archive_by_year, name='archive_by_year'),
? ++++ ^^^^^
- url(r'^archive/author/(?P<author_slug>.+)/$', 'archive_by_author', name='archive_by_author'),
? ^ -
+ url(r'^archive/author/(?P<author_slug>.+)/$', self.archive_by_author, name='archive_by_author'),
? ++++ ^^^^^
- url(r'^external/(.+)/$', routable_page_external_view, name='external_view')
+ url(r'^external/(.+)/$', routable_page_external_view, name='external_view')
? ++++
- )
+ )
def archive_by_year(self, request, year):
return HttpResponse("ARCHIVE BY YEAR: " + str(year))
def archive_by_author(self, request, author_slug):
return HttpResponse("ARCHIVE BY AUTHOR: " + author_slug)
def main(self, request):
return HttpResponse("MAIN VIEW") | 14 | 0.538462 | 8 | 6 |
7c11c3ff93cef12aae0c790dc0032c380b6d531a | examples/eigh.rs | examples/eigh.rs | extern crate ndarray;
extern crate ndarray_linalg;
use ndarray::*;
use ndarray_linalg::*;
fn main() {
let a = arr2(&[[3.0, 1.0, 1.0], [1.0, 3.0, 1.0], [1.0, 1.0, 3.0]]);
let (e, vecs): (Array1<_>, Array2<_>) = a.clone().eigh(UPLO::Upper).unwrap();
println!("eigenvalues = \n{:?}", e);
println!("V = \n{:?}", vecs);
let av = a.dot(&vecs);
println!("AV = \n{:?}", av);
}
| extern crate ndarray;
extern crate ndarray_linalg;
use ndarray::*;
use ndarray_linalg::*;
fn main() {
let a = arr2(&[[3.0, 1.0, 1.0], [1.0, 3.0, 1.0], [1.0, 1.0, 3.0]]);
let (e, vecs) = a.clone().eigh(UPLO::Upper).unwrap();
println!("eigenvalues = \n{:?}", e);
println!("V = \n{:?}", vecs);
let av = a.dot(&vecs);
println!("AV = \n{:?}", av);
}
| Drop type annotation from example | Drop type annotation from example
| Rust | mit | termoshtt/ndarray-linalg | rust | ## Code Before:
extern crate ndarray;
extern crate ndarray_linalg;
use ndarray::*;
use ndarray_linalg::*;
fn main() {
let a = arr2(&[[3.0, 1.0, 1.0], [1.0, 3.0, 1.0], [1.0, 1.0, 3.0]]);
let (e, vecs): (Array1<_>, Array2<_>) = a.clone().eigh(UPLO::Upper).unwrap();
println!("eigenvalues = \n{:?}", e);
println!("V = \n{:?}", vecs);
let av = a.dot(&vecs);
println!("AV = \n{:?}", av);
}
## Instruction:
Drop type annotation from example
## Code After:
extern crate ndarray;
extern crate ndarray_linalg;
use ndarray::*;
use ndarray_linalg::*;
fn main() {
let a = arr2(&[[3.0, 1.0, 1.0], [1.0, 3.0, 1.0], [1.0, 1.0, 3.0]]);
let (e, vecs) = a.clone().eigh(UPLO::Upper).unwrap();
println!("eigenvalues = \n{:?}", e);
println!("V = \n{:?}", vecs);
let av = a.dot(&vecs);
println!("AV = \n{:?}", av);
}
| extern crate ndarray;
extern crate ndarray_linalg;
use ndarray::*;
use ndarray_linalg::*;
fn main() {
let a = arr2(&[[3.0, 1.0, 1.0], [1.0, 3.0, 1.0], [1.0, 1.0, 3.0]]);
- let (e, vecs): (Array1<_>, Array2<_>) = a.clone().eigh(UPLO::Upper).unwrap();
? ------------------------
+ let (e, vecs) = a.clone().eigh(UPLO::Upper).unwrap();
println!("eigenvalues = \n{:?}", e);
println!("V = \n{:?}", vecs);
let av = a.dot(&vecs);
println!("AV = \n{:?}", av);
} | 2 | 0.142857 | 1 | 1 |
b783f8f9d03436fc349269a68008450b9539a2b0 | src/Parser.cc | src/Parser.cc | //
// Parser.cpp
// snowcrash
//
// Created by Zdenek Nemec on 4/8/13.
// Copyright (c) 2013 Apiary.io. All rights reserved.
//
#include <exception>
#include <sstream>
#include "Parser.h"
#include "MarkdownParser.h"
#include "BlueprintParser.h"
using namespace snowcrash;
const int SourceAnnotation::OK;
void Parser::parse(const SourceData& source, Result& result, Blueprint& blueprint)
{
try {
// Parse Markdown
MarkdownBlock::Stack markdown;
MarkdownParser markdownParser;
markdownParser.parse(source, result, markdown);
if (result.error.code != Error::OK)
return;
// Parse Blueprint
BlueprintParser::Parse(source, markdown, result, blueprint);
}
catch (const std::exception& e) {
std::stringstream ss;
ss << "parser exception: '" << e.what() << "'";
result.error = Error(ss.str(), 1);
}
catch (...) {
result.error = Error("parser exception has occured", 1);
}
}
| //
// Parser.cpp
// snowcrash
//
// Created by Zdenek Nemec on 4/8/13.
// Copyright (c) 2013 Apiary.io. All rights reserved.
//
#include <exception>
#include <sstream>
#include "Parser.h"
#include "MarkdownParser.h"
#include "BlueprintParser.h"
using namespace snowcrash;
const int SourceAnnotation::OK;
// Check source for unsupported character \t & \r
// Returns true if passed (not found), false otherwise
static bool CheckSource(const SourceData& source, Result& result)
{
std::string::size_type pos = source.find("\t");
if (pos != std::string::npos) {
result.error = Error("the use of tab(s) `\\t` in source data isn't currently supported, please contact makers", 2);
return false;
}
pos = source.find("\r");
if (pos != std::string::npos) {
result.error = Error("the use of carriage return(s) `\\r` in source data isn't currently supported, please contact makers", 2);
return false;
}
return true;
}
void Parser::parse(const SourceData& source, Result& result, Blueprint& blueprint)
{
try {
// Sanity Check
if (!CheckSource(source, result))
return;
// Parse Markdown
MarkdownBlock::Stack markdown;
MarkdownParser markdownParser;
markdownParser.parse(source, result, markdown);
if (result.error.code != Error::OK)
return;
// Parse Blueprint
BlueprintParser::Parse(source, markdown, result, blueprint);
}
catch (const std::exception& e) {
std::stringstream ss;
ss << "parser exception: '" << e.what() << "'";
result.error = Error(ss.str(), 1);
}
catch (...) {
result.error = Error("parser exception has occured", 1);
}
}
| Add tabs & CR sanity check | Add tabs & CR sanity check
| C++ | mit | obihann/snowcrash,apiaryio/drafter,apiaryio/drafter,apiaryio/drafter,apiaryio/snowcrash,apiaryio/drafter,obihann/snowcrash,obihann/snowcrash,apiaryio/drafter,apiaryio/snowcrash | c++ | ## Code Before:
//
// Parser.cpp
// snowcrash
//
// Created by Zdenek Nemec on 4/8/13.
// Copyright (c) 2013 Apiary.io. All rights reserved.
//
#include <exception>
#include <sstream>
#include "Parser.h"
#include "MarkdownParser.h"
#include "BlueprintParser.h"
using namespace snowcrash;
const int SourceAnnotation::OK;
void Parser::parse(const SourceData& source, Result& result, Blueprint& blueprint)
{
try {
// Parse Markdown
MarkdownBlock::Stack markdown;
MarkdownParser markdownParser;
markdownParser.parse(source, result, markdown);
if (result.error.code != Error::OK)
return;
// Parse Blueprint
BlueprintParser::Parse(source, markdown, result, blueprint);
}
catch (const std::exception& e) {
std::stringstream ss;
ss << "parser exception: '" << e.what() << "'";
result.error = Error(ss.str(), 1);
}
catch (...) {
result.error = Error("parser exception has occured", 1);
}
}
## Instruction:
Add tabs & CR sanity check
## Code After:
//
// Parser.cpp
// snowcrash
//
// Created by Zdenek Nemec on 4/8/13.
// Copyright (c) 2013 Apiary.io. All rights reserved.
//
#include <exception>
#include <sstream>
#include "Parser.h"
#include "MarkdownParser.h"
#include "BlueprintParser.h"
using namespace snowcrash;
const int SourceAnnotation::OK;
// Check source for unsupported character \t & \r
// Returns true if passed (not found), false otherwise
static bool CheckSource(const SourceData& source, Result& result)
{
std::string::size_type pos = source.find("\t");
if (pos != std::string::npos) {
result.error = Error("the use of tab(s) `\\t` in source data isn't currently supported, please contact makers", 2);
return false;
}
pos = source.find("\r");
if (pos != std::string::npos) {
result.error = Error("the use of carriage return(s) `\\r` in source data isn't currently supported, please contact makers", 2);
return false;
}
return true;
}
void Parser::parse(const SourceData& source, Result& result, Blueprint& blueprint)
{
try {
// Sanity Check
if (!CheckSource(source, result))
return;
// Parse Markdown
MarkdownBlock::Stack markdown;
MarkdownParser markdownParser;
markdownParser.parse(source, result, markdown);
if (result.error.code != Error::OK)
return;
// Parse Blueprint
BlueprintParser::Parse(source, markdown, result, blueprint);
}
catch (const std::exception& e) {
std::stringstream ss;
ss << "parser exception: '" << e.what() << "'";
result.error = Error(ss.str(), 1);
}
catch (...) {
result.error = Error("parser exception has occured", 1);
}
}
| //
// Parser.cpp
// snowcrash
//
// Created by Zdenek Nemec on 4/8/13.
// Copyright (c) 2013 Apiary.io. All rights reserved.
//
#include <exception>
#include <sstream>
#include "Parser.h"
#include "MarkdownParser.h"
#include "BlueprintParser.h"
using namespace snowcrash;
const int SourceAnnotation::OK;
+ // Check source for unsupported character \t & \r
+ // Returns true if passed (not found), false otherwise
+ static bool CheckSource(const SourceData& source, Result& result)
+ {
+ std::string::size_type pos = source.find("\t");
+ if (pos != std::string::npos) {
+ result.error = Error("the use of tab(s) `\\t` in source data isn't currently supported, please contact makers", 2);
+ return false;
+ }
+
+ pos = source.find("\r");
+ if (pos != std::string::npos) {
+ result.error = Error("the use of carriage return(s) `\\r` in source data isn't currently supported, please contact makers", 2);
+ return false;
+ }
+
+ return true;
+ }
+
void Parser::parse(const SourceData& source, Result& result, Blueprint& blueprint)
{
try {
+
+ // Sanity Check
+ if (!CheckSource(source, result))
+ return;
+
// Parse Markdown
MarkdownBlock::Stack markdown;
MarkdownParser markdownParser;
markdownParser.parse(source, result, markdown);
if (result.error.code != Error::OK)
return;
// Parse Blueprint
BlueprintParser::Parse(source, markdown, result, blueprint);
}
catch (const std::exception& e) {
std::stringstream ss;
ss << "parser exception: '" << e.what() << "'";
result.error = Error(ss.str(), 1);
}
catch (...) {
result.error = Error("parser exception has occured", 1);
}
} | 24 | 0.55814 | 24 | 0 |
73a442f0f2ebc3e2ec277ccf0e2f75384ed7114e | app.coffee | app.coffee | express = require 'express'
app = express()
# Serve static files
app.use express.static(__dirname + '/public')
# Set cache manifext content-type
app.use (req, res, next)->
if req.originalUrl == '/cache.manifest'
res.setHeader('Content-Type', 'text/cache-manifest')
next()
app.get '/', (req, res, next)->
res.redirect('/online.html')
port = process.env.PORT || 1234
app.listen port, ()->
console.log 'listening on port', port
| express = require 'express'
app = express()
process.env.PWD = process.cwd()
# Serve static files
app.use express.static(process.env.PWD + '/public')
# Set cache manifext content-type
app.use (req, res, next)->
if req.originalUrl == '/cache.manifest'
res.setHeader('Content-Type', 'text/cache-manifest')
next()
app.get '/', (req, res, next)->
res.redirect('/online.html')
port = process.env.PORT || 1234
app.listen port, ()->
console.log 'listening on port', port
| Fix heroku /public file serving | Fix heroku /public file serving
| CoffeeScript | mit | ArnaudWopata/videoappcache | coffeescript | ## Code Before:
express = require 'express'
app = express()
# Serve static files
app.use express.static(__dirname + '/public')
# Set cache manifext content-type
app.use (req, res, next)->
if req.originalUrl == '/cache.manifest'
res.setHeader('Content-Type', 'text/cache-manifest')
next()
app.get '/', (req, res, next)->
res.redirect('/online.html')
port = process.env.PORT || 1234
app.listen port, ()->
console.log 'listening on port', port
## Instruction:
Fix heroku /public file serving
## Code After:
express = require 'express'
app = express()
process.env.PWD = process.cwd()
# Serve static files
app.use express.static(process.env.PWD + '/public')
# Set cache manifext content-type
app.use (req, res, next)->
if req.originalUrl == '/cache.manifest'
res.setHeader('Content-Type', 'text/cache-manifest')
next()
app.get '/', (req, res, next)->
res.redirect('/online.html')
port = process.env.PORT || 1234
app.listen port, ()->
console.log 'listening on port', port
| express = require 'express'
app = express()
+ process.env.PWD = process.cwd()
+
# Serve static files
- app.use express.static(__dirname + '/public')
? ^^^^ ^^^
+ app.use express.static(process.env.PWD + '/public')
? ^ +++++++ ^^^^^
# Set cache manifext content-type
app.use (req, res, next)->
if req.originalUrl == '/cache.manifest'
res.setHeader('Content-Type', 'text/cache-manifest')
next()
app.get '/', (req, res, next)->
res.redirect('/online.html')
port = process.env.PORT || 1234
app.listen port, ()->
console.log 'listening on port', port | 4 | 0.210526 | 3 | 1 |
9ce4fd1e0f4d9a812e1cae3433de466f087872d9 | app/views/tags/update.js.erb | app/views/tags/update.js.erb | feedbin.updateFeeds('<%= j render partial: 'feeds/feeds', locals: {collections: @collections, tags: @tags, feeds: @feeds} %>');
feedbin.hideTagsForm();
$('[data-behavior~=show_tags_form]').replaceWith('<%= j render partial: "shared/buttons/tag", locals: {feed: nil, tags: nil, tag: @new_tag} %>');
$('[data-behavior~=unsubscribe]').replaceWith('<%= j render partial: "shared/buttons/destroy_tag", locals: {tag: @new_tag} %>');
$('[data-behavior~=mark_all_as_read]').replaceWith('<%= j render partial: "shared/buttons/mark_all_as_read", locals: {type: @type, data: @data} %>');
| feedbin.updateFeeds('<%= j render partial: 'feeds/feeds', locals: {collections: @collections, tags: @tags, feeds: @feeds} %>');
$('[data-behavior~=feeds_target] [data-tag-id~=<%= @new_tag.id %>] .tag-link').click()
feedbin.hideTagsForm();
$('[data-behavior~=show_tags_form]').replaceWith('<%= j render partial: "shared/buttons/tag", locals: {feed: nil, tags: nil, tag: @new_tag} %>');
$('[data-behavior~=unsubscribe]').replaceWith('<%= j render partial: "shared/buttons/destroy_tag", locals: {tag: @new_tag} %>');
$('[data-behavior~=mark_all_as_read]').replaceWith('<%= j render partial: "shared/buttons/mark_all_as_read", locals: {type: @type, data: @data} %>');
| Update entries column when renaming tags. | Update entries column when renaming tags.
| HTML+ERB | mit | feedbin/feedbin,saitodisse/feedbin,azukiapp/feedbin,brendanlong/feedbin,feedbin/feedbin,saitodisse/feedbin,brendanlong/feedbin,azukiapp/feedbin,feedbin/feedbin,azukiapp/feedbin,brendanlong/feedbin,nota-ja/feedbin,nota-ja/feedbin,fearenales/feedbin,saitodisse/feedbin,fearenales/feedbin,feedbin/feedbin,fearenales/feedbin,nota-ja/feedbin | html+erb | ## Code Before:
feedbin.updateFeeds('<%= j render partial: 'feeds/feeds', locals: {collections: @collections, tags: @tags, feeds: @feeds} %>');
feedbin.hideTagsForm();
$('[data-behavior~=show_tags_form]').replaceWith('<%= j render partial: "shared/buttons/tag", locals: {feed: nil, tags: nil, tag: @new_tag} %>');
$('[data-behavior~=unsubscribe]').replaceWith('<%= j render partial: "shared/buttons/destroy_tag", locals: {tag: @new_tag} %>');
$('[data-behavior~=mark_all_as_read]').replaceWith('<%= j render partial: "shared/buttons/mark_all_as_read", locals: {type: @type, data: @data} %>');
## Instruction:
Update entries column when renaming tags.
## Code After:
feedbin.updateFeeds('<%= j render partial: 'feeds/feeds', locals: {collections: @collections, tags: @tags, feeds: @feeds} %>');
$('[data-behavior~=feeds_target] [data-tag-id~=<%= @new_tag.id %>] .tag-link').click()
feedbin.hideTagsForm();
$('[data-behavior~=show_tags_form]').replaceWith('<%= j render partial: "shared/buttons/tag", locals: {feed: nil, tags: nil, tag: @new_tag} %>');
$('[data-behavior~=unsubscribe]').replaceWith('<%= j render partial: "shared/buttons/destroy_tag", locals: {tag: @new_tag} %>');
$('[data-behavior~=mark_all_as_read]').replaceWith('<%= j render partial: "shared/buttons/mark_all_as_read", locals: {type: @type, data: @data} %>');
| feedbin.updateFeeds('<%= j render partial: 'feeds/feeds', locals: {collections: @collections, tags: @tags, feeds: @feeds} %>');
+ $('[data-behavior~=feeds_target] [data-tag-id~=<%= @new_tag.id %>] .tag-link').click()
feedbin.hideTagsForm();
$('[data-behavior~=show_tags_form]').replaceWith('<%= j render partial: "shared/buttons/tag", locals: {feed: nil, tags: nil, tag: @new_tag} %>');
$('[data-behavior~=unsubscribe]').replaceWith('<%= j render partial: "shared/buttons/destroy_tag", locals: {tag: @new_tag} %>');
$('[data-behavior~=mark_all_as_read]').replaceWith('<%= j render partial: "shared/buttons/mark_all_as_read", locals: {type: @type, data: @data} %>'); | 1 | 0.2 | 1 | 0 |
ee6bcf7a30a46ae6848687fa19bd239fe68047cf | bin/setup.sh | bin/setup.sh |
apt-get update && apt-get -y dist-upgrade
apt-get install -y open-vm-tools-desktop fuse
|
apt-get update && apt-get -y dist-upgrade
# Install Vmware tools
apt-get install -y open-vm-tools-desktop fuse
# Install tools
apt-get install -y libbde-dev libbde-utils exfat-fuse exfat-utils
| Install exfat support and libbde. | Install exfat support and libbde.
| Shell | mit | reuteras/kali-tools | shell | ## Code Before:
apt-get update && apt-get -y dist-upgrade
apt-get install -y open-vm-tools-desktop fuse
## Instruction:
Install exfat support and libbde.
## Code After:
apt-get update && apt-get -y dist-upgrade
# Install Vmware tools
apt-get install -y open-vm-tools-desktop fuse
# Install tools
apt-get install -y libbde-dev libbde-utils exfat-fuse exfat-utils
| +
apt-get update && apt-get -y dist-upgrade
+ # Install Vmware tools
apt-get install -y open-vm-tools-desktop fuse
+ # Install tools
+ apt-get install -y libbde-dev libbde-utils exfat-fuse exfat-utils
| 4 | 0.666667 | 4 | 0 |
bca32ac5770f93bbd0fdbf492606c9b800b03c19 | src/utils/serialize.js | src/utils/serialize.js | 'use strict';
/**
* @param {import('../models').Playlist} model
*/
function serializePlaylist(model) {
return {
_id: model.id || model._id.toString(),
name: model.name,
author: model.author,
createdAt: model.createdAt,
description: model.description,
size: model.media.length,
};
}
/**
* @param {Pick<import('../models').User,
* '_id' | 'username' | 'slug' | 'roles' | 'avatar' |
* 'createdAt' | 'updatedAt' | 'lastSeenAt'>} model
*/
function serializeUser(model) {
return {
_id: model._id.toString(),
username: model.username,
slug: model.slug,
roles: model.roles,
avatar: model.avatar,
createdAt: model.createdAt.toString(),
updatedAt: model.updatedAt.toString(),
lastSeenAt: model.lastSeenAt.toString(),
};
}
exports.serializePlaylist = serializePlaylist;
exports.serializeUser = serializeUser;
| 'use strict';
/**
* @param {import('../models').Playlist} model
*/
function serializePlaylist(model) {
return {
_id: model.id || model._id.toString(),
name: model.name,
author: model.author.toString(),
createdAt: model.createdAt.toISOString(),
description: model.description,
size: model.media.length,
};
}
/**
* @param {Pick<import('../models').User,
* '_id' | 'username' | 'slug' | 'roles' | 'avatar' |
* 'createdAt' | 'updatedAt' | 'lastSeenAt'>} model
*/
function serializeUser(model) {
return {
_id: model._id.toString(),
username: model.username,
slug: model.slug,
roles: model.roles,
avatar: model.avatar,
createdAt: model.createdAt.toISOString(),
updatedAt: model.updatedAt.toISOString(),
lastSeenAt: model.lastSeenAt.toISOString(),
};
}
exports.serializePlaylist = serializePlaylist;
exports.serializeUser = serializeUser;
| Fix serialization of Dates in user and playlist objects | Fix serialization of Dates in user and playlist objects
| JavaScript | mit | u-wave/core,u-wave/core,u-wave/core | javascript | ## Code Before:
'use strict';
/**
* @param {import('../models').Playlist} model
*/
function serializePlaylist(model) {
return {
_id: model.id || model._id.toString(),
name: model.name,
author: model.author,
createdAt: model.createdAt,
description: model.description,
size: model.media.length,
};
}
/**
* @param {Pick<import('../models').User,
* '_id' | 'username' | 'slug' | 'roles' | 'avatar' |
* 'createdAt' | 'updatedAt' | 'lastSeenAt'>} model
*/
function serializeUser(model) {
return {
_id: model._id.toString(),
username: model.username,
slug: model.slug,
roles: model.roles,
avatar: model.avatar,
createdAt: model.createdAt.toString(),
updatedAt: model.updatedAt.toString(),
lastSeenAt: model.lastSeenAt.toString(),
};
}
exports.serializePlaylist = serializePlaylist;
exports.serializeUser = serializeUser;
## Instruction:
Fix serialization of Dates in user and playlist objects
## Code After:
'use strict';
/**
* @param {import('../models').Playlist} model
*/
function serializePlaylist(model) {
return {
_id: model.id || model._id.toString(),
name: model.name,
author: model.author.toString(),
createdAt: model.createdAt.toISOString(),
description: model.description,
size: model.media.length,
};
}
/**
* @param {Pick<import('../models').User,
* '_id' | 'username' | 'slug' | 'roles' | 'avatar' |
* 'createdAt' | 'updatedAt' | 'lastSeenAt'>} model
*/
function serializeUser(model) {
return {
_id: model._id.toString(),
username: model.username,
slug: model.slug,
roles: model.roles,
avatar: model.avatar,
createdAt: model.createdAt.toISOString(),
updatedAt: model.updatedAt.toISOString(),
lastSeenAt: model.lastSeenAt.toISOString(),
};
}
exports.serializePlaylist = serializePlaylist;
exports.serializeUser = serializeUser;
| 'use strict';
/**
* @param {import('../models').Playlist} model
*/
function serializePlaylist(model) {
return {
_id: model.id || model._id.toString(),
name: model.name,
- author: model.author,
+ author: model.author.toString(),
? +++++++++++
- createdAt: model.createdAt,
+ createdAt: model.createdAt.toISOString(),
? ++++++++++++++
description: model.description,
size: model.media.length,
};
}
/**
* @param {Pick<import('../models').User,
* '_id' | 'username' | 'slug' | 'roles' | 'avatar' |
* 'createdAt' | 'updatedAt' | 'lastSeenAt'>} model
*/
function serializeUser(model) {
return {
_id: model._id.toString(),
username: model.username,
slug: model.slug,
roles: model.roles,
avatar: model.avatar,
- createdAt: model.createdAt.toString(),
+ createdAt: model.createdAt.toISOString(),
? +++
- updatedAt: model.updatedAt.toString(),
+ updatedAt: model.updatedAt.toISOString(),
? +++
- lastSeenAt: model.lastSeenAt.toString(),
+ lastSeenAt: model.lastSeenAt.toISOString(),
? +++
};
}
exports.serializePlaylist = serializePlaylist;
exports.serializeUser = serializeUser; | 10 | 0.277778 | 5 | 5 |
90a450c2afc7c07276a46804cd5c6e87d4e94532 | spec/spec_helper.rb | spec/spec_helper.rb | ENV["RAILS_ENV"] ||= 'test'
require File.expand_path('../tmp/sample/config/environment', __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
RSpec.configure do |config|
config.include FactoryGirl::Syntax::Methods
config.use_transactional_fixtures = true
config.infer_base_class_for_anonymous_controllers = false
config.order = "random"
# Because we are not running things in Rails we need to stub some secrets
config.before(:each) { Rails.application.config.stub(:secret_token).and_return("SECRET") }
end
| ENV["RAILS_ENV"] ||= 'test'
require File.expand_path('../tmp/sample/config/environment', __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
RSpec.configure do |config|
config.use_transactional_fixtures = true
config.infer_base_class_for_anonymous_controllers = false
config.order = "random"
# Because we are not running things in Rails we need to stub some secrets
config.before(:each) { Rails.application.config.stub(:secret_token).and_return("SECRET") }
end
| Remove factory girl just to keep things lite | Remove factory girl just to keep things lite
| Ruby | mit | jeffrafter/authkit,jeffrafter/authkit | ruby | ## Code Before:
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path('../tmp/sample/config/environment', __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
RSpec.configure do |config|
config.include FactoryGirl::Syntax::Methods
config.use_transactional_fixtures = true
config.infer_base_class_for_anonymous_controllers = false
config.order = "random"
# Because we are not running things in Rails we need to stub some secrets
config.before(:each) { Rails.application.config.stub(:secret_token).and_return("SECRET") }
end
## Instruction:
Remove factory girl just to keep things lite
## Code After:
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path('../tmp/sample/config/environment', __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
RSpec.configure do |config|
config.use_transactional_fixtures = true
config.infer_base_class_for_anonymous_controllers = false
config.order = "random"
# Because we are not running things in Rails we need to stub some secrets
config.before(:each) { Rails.application.config.stub(:secret_token).and_return("SECRET") }
end
| ENV["RAILS_ENV"] ||= 'test'
require File.expand_path('../tmp/sample/config/environment', __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
RSpec.configure do |config|
- config.include FactoryGirl::Syntax::Methods
config.use_transactional_fixtures = true
config.infer_base_class_for_anonymous_controllers = false
config.order = "random"
# Because we are not running things in Rails we need to stub some secrets
config.before(:each) { Rails.application.config.stub(:secret_token).and_return("SECRET") }
end | 1 | 0.058824 | 0 | 1 |
bdca4889442e7d84f8c4e68ecdbee676d46ff264 | examples/test_with_data_provider.py | examples/test_with_data_provider.py | from pytf.dataprovider import DataProvider
try:
from unittest.mock import call
except ImportError:
from mock import call
@DataProvider([call(max=5), call(max=10), call(max=15)])
class TestCase(object):
def __init__(self, max):
self.max = max
@DataProvider([call(n=3), call(n=7), call(n=12), call(n=20)])
def test_test(self, n):
assert n < self.max
| from pytf.dataprovider import DataProvider, call
@DataProvider(max_5=call(max=5), max_10=call(max=10), max_15=call(max=15))
class TestCase(object):
def __init__(self, max):
self.max = max
@DataProvider(n_3=call(n=3), n_7=call(n=7), n_12=call(n=12), n_20=call(n=20))
def test_test(self, n):
assert n < self.max
| Fix data provider example file. | Fix data provider example file.
| Python | mit | Lothiraldan/pytf | python | ## Code Before:
from pytf.dataprovider import DataProvider
try:
from unittest.mock import call
except ImportError:
from mock import call
@DataProvider([call(max=5), call(max=10), call(max=15)])
class TestCase(object):
def __init__(self, max):
self.max = max
@DataProvider([call(n=3), call(n=7), call(n=12), call(n=20)])
def test_test(self, n):
assert n < self.max
## Instruction:
Fix data provider example file.
## Code After:
from pytf.dataprovider import DataProvider, call
@DataProvider(max_5=call(max=5), max_10=call(max=10), max_15=call(max=15))
class TestCase(object):
def __init__(self, max):
self.max = max
@DataProvider(n_3=call(n=3), n_7=call(n=7), n_12=call(n=12), n_20=call(n=20))
def test_test(self, n):
assert n < self.max
| - from pytf.dataprovider import DataProvider
+ from pytf.dataprovider import DataProvider, call
? ++++++
-
- try:
- from unittest.mock import call
- except ImportError:
- from mock import call
- @DataProvider([call(max=5), call(max=10), call(max=15)])
? ^ -
+ @DataProvider(max_5=call(max=5), max_10=call(max=10), max_15=call(max=15))
? ^^^^^^ +++++++ +++++++
class TestCase(object):
def __init__(self, max):
self.max = max
- @DataProvider([call(n=3), call(n=7), call(n=12), call(n=20)])
? ^ -
+ @DataProvider(n_3=call(n=3), n_7=call(n=7), n_12=call(n=12), n_20=call(n=20))
? ^^^^ ++++ +++++ +++++
def test_test(self, n):
assert n < self.max | 11 | 0.6875 | 3 | 8 |
773125a45f680d980c3cc5053fb9ae7b12c79aec | .travis.yml | .travis.yml |
language: python
python:
- "3.5"
- "3.6"
# Setup anaconda
before_install:
# - sudo apt-get update
- pip install -r requirements.txt
- git clone git@github.com:BBN-Q/Adapt.git && cd clone && pip install -e .
install:
- export PYTHONPATH=$PYTHONPATH:$PWD/src
# execute scripts
script:
- python -m unittest discover -v test
# necessary to run on new container-based infrastructure
sudo: false |
language: python
python:
- "3.5"
- "3.6"
# Setup anaconda
before_install:
# - sudo apt-get update
- pip install -r requirements.txt
- git clone https://github.com/BBN-Q/Adapt.git && cd Adapt && pip install -e .
install:
- export PYTHONPATH=$PYTHONPATH:$PWD/src
# execute scripts
script:
- python -m unittest discover -v test
# necessary to run on new container-based infrastructure
sudo: false | Switch to https clone of adapt | Switch to https clone of adapt
| YAML | apache-2.0 | BBN-Q/Auspex,BBN-Q/Auspex,BBN-Q/Auspex,BBN-Q/Auspex | yaml | ## Code Before:
language: python
python:
- "3.5"
- "3.6"
# Setup anaconda
before_install:
# - sudo apt-get update
- pip install -r requirements.txt
- git clone git@github.com:BBN-Q/Adapt.git && cd clone && pip install -e .
install:
- export PYTHONPATH=$PYTHONPATH:$PWD/src
# execute scripts
script:
- python -m unittest discover -v test
# necessary to run on new container-based infrastructure
sudo: false
## Instruction:
Switch to https clone of adapt
## Code After:
language: python
python:
- "3.5"
- "3.6"
# Setup anaconda
before_install:
# - sudo apt-get update
- pip install -r requirements.txt
- git clone https://github.com/BBN-Q/Adapt.git && cd Adapt && pip install -e .
install:
- export PYTHONPATH=$PYTHONPATH:$PWD/src
# execute scripts
script:
- python -m unittest discover -v test
# necessary to run on new container-based infrastructure
sudo: false |
language: python
python:
- "3.5"
- "3.6"
# Setup anaconda
before_install:
# - sudo apt-get update
- pip install -r requirements.txt
- - git clone git@github.com:BBN-Q/Adapt.git && cd clone && pip install -e .
? ^^ ^ ^ ^^^^^
+ - git clone https://github.com/BBN-Q/Adapt.git && cd Adapt && pip install -e .
? ^ ^^^^^^ ^ ^^^^^
install:
- export PYTHONPATH=$PYTHONPATH:$PWD/src
# execute scripts
script:
- python -m unittest discover -v test
# necessary to run on new container-based infrastructure
sudo: false | 2 | 0.095238 | 1 | 1 |
363867b4077354339713328149010819ce63196d | triggers/autoban/README.md | triggers/autoban/README.md | The autoban function won't work unless you know the secret password. Put the secret password in a file called `pw` in this directory for !ab and !uab to work.
| Here's what you need to get this function working:
* The autoban password
* Your `config.yml` file
If you don't know the autoban password, don't bother with this, just remove this file from your config for triggers or modify it to not use an online banlist.
If you do, add a config key to the bot's config called `autoban` and under it make a key called `pw` and make its value the password.
| Add info to readme to reflect changes | Add info to readme to reflect changes
| Markdown | mit | DePhoenix/le-meme-man,raymoo/ps-chatbot-llewd,pickdenis/ps-chatbot | markdown | ## Code Before:
The autoban function won't work unless you know the secret password. Put the secret password in a file called `pw` in this directory for !ab and !uab to work.
## Instruction:
Add info to readme to reflect changes
## Code After:
Here's what you need to get this function working:
* The autoban password
* Your `config.yml` file
If you don't know the autoban password, don't bother with this, just remove this file from your config for triggers or modify it to not use an online banlist.
If you do, add a config key to the bot's config called `autoban` and under it make a key called `pw` and make its value the password.
| - The autoban function won't work unless you know the secret password. Put the secret password in a file called `pw` in this directory for !ab and !uab to work.
+ Here's what you need to get this function working:
+
+ * The autoban password
+ * Your `config.yml` file
+
+ If you don't know the autoban password, don't bother with this, just remove this file from your config for triggers or modify it to not use an online banlist.
+
+ If you do, add a config key to the bot's config called `autoban` and under it make a key called `pw` and make its value the password. | 9 | 9 | 8 | 1 |
082c08ae6a643425611a5bab2f328a9ecd33cc8d | javascript/maps-app/index.htm | javascript/maps-app/index.htm | <!DOCTYPE html>
<html>
<head>
<!--
Re: PROOFS
JavaScript
Maps web application
Author: Jonathan Milam Walters
Date: 04 May 2016
Filename: index.htm
-->
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Maps</title>
<link rel="stylesheet" href="styles.css" />
<script src="modernizr.custom.05819.js"></script>
</head>
<body>
<header>
<h1>
Maps
</h1>
</header>
<article>
<div id="museums">
<div id="location">My Location</div>
<div id="berlin">Pergamon Museum</div>
<div id="paris">Musée d'Orsay</div>
<div id="houston">Rothko Chapel</div>
</div>
<div id="caption">
My location
</div>
<div id="map"></div>
</article>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAALYidtyvzzkGffV0X7sZVkseFgdEIBvQ&callback=geoTest" async defer></script>
<script src="script.js"></script>
</body>
</html>
| <!DOCTYPE html>
<html>
<head>
<!--
Re: PROOFS
JavaScript
Maps web application
Author: Jonathan Milam Walters
Date: 04 May 2016
Filename: index.htm
-->
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Maps</title>
<link rel="stylesheet" href="styles.css" />
<script src="modernizr.custom.05819.js"></script>
</head>
<body>
<header>
<h1>
Maps
</h1>
</header>
<article>
<div id="museums">
<div id="location">My Location</div>
<div id="berlin">Pergamon Museum</div>
<div id="paris">Musée d'Orsay</div>
<div id="houston">Rothko Chapel</div>
</div>
<div id="caption">
My location
</div>
<div id="map"></div>
</article>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDgBYuqXHM9X6T4vO_cBv-X6weYGPrX5tE&callback=geoTest" async defer></script>
<script src="script.js"></script>
</body>
</html>
| Update Google Maps API browser key | Update Google Maps API browser key
| HTML | mit | jmilamwalters/jmilamwalters.github.io,jmilamwalters/jmilamwalters.github.io,jmilamwalters/jmilamwalters.github.io | html | ## Code Before:
<!DOCTYPE html>
<html>
<head>
<!--
Re: PROOFS
JavaScript
Maps web application
Author: Jonathan Milam Walters
Date: 04 May 2016
Filename: index.htm
-->
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Maps</title>
<link rel="stylesheet" href="styles.css" />
<script src="modernizr.custom.05819.js"></script>
</head>
<body>
<header>
<h1>
Maps
</h1>
</header>
<article>
<div id="museums">
<div id="location">My Location</div>
<div id="berlin">Pergamon Museum</div>
<div id="paris">Musée d'Orsay</div>
<div id="houston">Rothko Chapel</div>
</div>
<div id="caption">
My location
</div>
<div id="map"></div>
</article>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAALYidtyvzzkGffV0X7sZVkseFgdEIBvQ&callback=geoTest" async defer></script>
<script src="script.js"></script>
</body>
</html>
## Instruction:
Update Google Maps API browser key
## Code After:
<!DOCTYPE html>
<html>
<head>
<!--
Re: PROOFS
JavaScript
Maps web application
Author: Jonathan Milam Walters
Date: 04 May 2016
Filename: index.htm
-->
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Maps</title>
<link rel="stylesheet" href="styles.css" />
<script src="modernizr.custom.05819.js"></script>
</head>
<body>
<header>
<h1>
Maps
</h1>
</header>
<article>
<div id="museums">
<div id="location">My Location</div>
<div id="berlin">Pergamon Museum</div>
<div id="paris">Musée d'Orsay</div>
<div id="houston">Rothko Chapel</div>
</div>
<div id="caption">
My location
</div>
<div id="map"></div>
</article>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDgBYuqXHM9X6T4vO_cBv-X6weYGPrX5tE&callback=geoTest" async defer></script>
<script src="script.js"></script>
</body>
</html>
| <!DOCTYPE html>
<html>
<head>
<!--
Re: PROOFS
JavaScript
Maps web application
Author: Jonathan Milam Walters
Date: 04 May 2016
Filename: index.htm
-->
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Maps</title>
<link rel="stylesheet" href="styles.css" />
<script src="modernizr.custom.05819.js"></script>
</head>
<body>
<header>
<h1>
Maps
</h1>
</header>
<article>
<div id="museums">
<div id="location">My Location</div>
<div id="berlin">Pergamon Museum</div>
<div id="paris">Musée d'Orsay</div>
<div id="houston">Rothko Chapel</div>
</div>
<div id="caption">
My location
</div>
<div id="map"></div>
</article>
- <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAALYidtyvzzkGffV0X7sZVkseFgdEIBvQ&callback=geoTest" async defer></script>
? ^^^ ^^^^ ^^^^^^^^^^^^^^^^^^^^^ ^
+ <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDgBYuqXHM9X6T4vO_cBv-X6weYGPrX5tE&callback=geoTest" async defer></script>
? ^^^ ^^^^^^^^^^ ^^^ ^^^^^^^^^^^^^
<script src="script.js"></script>
</body>
</html> | 2 | 0.047619 | 1 | 1 |
21af3d7d744f11b5070a06e9ca6423a36b0a2076 | conda.recipe/meta.yaml | conda.recipe/meta.yaml | package:
name: parmap
version: !!str 1.3.0
source:
fn: parmap-1.3.0.tar.gz
url: https://pypi.python.org/packages/source/p/parmap/parmap-1.3.0.tar.gz
requirements:
build:
- python
run:
- python
test:
# Python imports
imports:
- parmap
#commands:
# You can put test commands to be run here. Use this to test that the
# entry points work.
# You can also put a file called run_test.py in the recipe that will be run
# at test time.
# requires:
# Put any additional test requirements here. For example
# - nose
about:
home: https://github.com/zeehio/parmap
license: Apache Software License
# See
# http://docs.continuum.io/conda/build.html for
# more information about meta.yaml
| package:
name: parmap
version: !!str 1.4.0
source:
fn: parmap-1.4.0.tar.gz
url: https://pypi.python.org/packages/6e/d2/400781417eaf123e5ff394ce428dc3e4175f6065b1f20ed5f6d6a3307210/parmap-1.4.0.tar.gz
requirements:
build:
- python
run:
- python
- tqdm # optional dependency
test:
# Python imports
imports:
- parmap
#commands:
# You can put test commands to be run here. Use this to test that the
# entry points work.
# You can also put a file called run_test.py in the recipe that will be run
# at test time.
# requires:
# Put any additional test requirements here. For example
# - nose
about:
home: https://github.com/zeehio/parmap
license: Apache Software License
# See
# http://docs.continuum.io/conda/build.html for
# more information about meta.yaml
| Update conda recipe for 1.4 and upload | Update conda recipe for 1.4 and upload
| YAML | apache-2.0 | zeehio/parmap | yaml | ## Code Before:
package:
name: parmap
version: !!str 1.3.0
source:
fn: parmap-1.3.0.tar.gz
url: https://pypi.python.org/packages/source/p/parmap/parmap-1.3.0.tar.gz
requirements:
build:
- python
run:
- python
test:
# Python imports
imports:
- parmap
#commands:
# You can put test commands to be run here. Use this to test that the
# entry points work.
# You can also put a file called run_test.py in the recipe that will be run
# at test time.
# requires:
# Put any additional test requirements here. For example
# - nose
about:
home: https://github.com/zeehio/parmap
license: Apache Software License
# See
# http://docs.continuum.io/conda/build.html for
# more information about meta.yaml
## Instruction:
Update conda recipe for 1.4 and upload
## Code After:
package:
name: parmap
version: !!str 1.4.0
source:
fn: parmap-1.4.0.tar.gz
url: https://pypi.python.org/packages/6e/d2/400781417eaf123e5ff394ce428dc3e4175f6065b1f20ed5f6d6a3307210/parmap-1.4.0.tar.gz
requirements:
build:
- python
run:
- python
- tqdm # optional dependency
test:
# Python imports
imports:
- parmap
#commands:
# You can put test commands to be run here. Use this to test that the
# entry points work.
# You can also put a file called run_test.py in the recipe that will be run
# at test time.
# requires:
# Put any additional test requirements here. For example
# - nose
about:
home: https://github.com/zeehio/parmap
license: Apache Software License
# See
# http://docs.continuum.io/conda/build.html for
# more information about meta.yaml
| package:
name: parmap
- version: !!str 1.3.0
? ^
+ version: !!str 1.4.0
? ^
source:
- fn: parmap-1.3.0.tar.gz
? ^
+ fn: parmap-1.4.0.tar.gz
? ^
- url: https://pypi.python.org/packages/source/p/parmap/parmap-1.3.0.tar.gz
+ url: https://pypi.python.org/packages/6e/d2/400781417eaf123e5ff394ce428dc3e4175f6065b1f20ed5f6d6a3307210/parmap-1.4.0.tar.gz
requirements:
build:
- python
run:
- python
+ - tqdm # optional dependency
test:
# Python imports
imports:
- parmap
#commands:
# You can put test commands to be run here. Use this to test that the
# entry points work.
# You can also put a file called run_test.py in the recipe that will be run
# at test time.
# requires:
# Put any additional test requirements here. For example
# - nose
about:
home: https://github.com/zeehio/parmap
license: Apache Software License
# See
# http://docs.continuum.io/conda/build.html for
# more information about meta.yaml | 7 | 0.179487 | 4 | 3 |
d7cedfe97f8ce1bb4a5b5ed753853588a6da6718 | package/vagrant-scripts/osx.sh | package/vagrant-scripts/osx.sh | SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
set -x
# if the proxy is around, use it
nc -z -w3 192.168.1.1 8123 && export http_proxy="http://192.168.1.1:8123"
gem install json_pure -v '~> 1.0' --no-ri --no-rdoc
gem install puppet -v '~> 3.0' --no-ri --no-rdoc
gem install fpm -v '~> 0.4.0' --no-ri --no-rdoc
chmod 755 /vagrant/package/package.sh
TRAVIS=1 su vagrant -l -c 'ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"'
su vagrant -l -c "brew install /vagrant/package/vagrant-scripts/dmgbuild.rb"
/vagrant/package/package.sh /vagrant/substrate-assets/substrate_darwin_x86_64.zip master
mkdir -p /vagrant/pkg
cp *.dmg /vagrant/pkg
| SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
set -x
# if the proxy is around, use it
nc -z -w3 192.168.1.1 8123 && export http_proxy="http://192.168.1.1:8123"
export PATH="/usr/local/bin:$PATH"
gem install json_pure -v '~> 1.0' --no-ri --no-rdoc
gem install puppet -v '~> 3.0' --no-ri --no-rdoc
gem install fpm -v '~> 0.4.0' --no-ri --no-rdoc
chmod 755 /vagrant/package/package.sh
TRAVIS=1 su vagrant -l -c 'ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"'
pushd /tmp
su vagrant -c "brew install python"
rm /usr/bin/python
ln -s /usr/local/bin/python /usr/bin/python
su vagrant -c "brew install /vagrant/package/vagrant-scripts/dmgbuild.rb"
popd
/vagrant/package/package.sh /vagrant/substrate-assets/substrate_darwin_x86_64.zip master
mkdir -p /vagrant/pkg
cp *.dmg /vagrant/pkg
| Update installed version of python to resolve unicode issues | Update installed version of python to resolve unicode issues
| Shell | mit | mitchellh/vagrant-installers,mitchellh/vagrant-installers,chrisroberts/vagrant-installers,chrisroberts/vagrant-installers,mitchellh/vagrant-installers,mitchellh/vagrant-installers,chrisroberts/vagrant-installers,mitchellh/vagrant-installers,mitchellh/vagrant-installers,chrisroberts/vagrant-installers,chrisroberts/vagrant-installers,chrisroberts/vagrant-installers | shell | ## Code Before:
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
set -x
# if the proxy is around, use it
nc -z -w3 192.168.1.1 8123 && export http_proxy="http://192.168.1.1:8123"
gem install json_pure -v '~> 1.0' --no-ri --no-rdoc
gem install puppet -v '~> 3.0' --no-ri --no-rdoc
gem install fpm -v '~> 0.4.0' --no-ri --no-rdoc
chmod 755 /vagrant/package/package.sh
TRAVIS=1 su vagrant -l -c 'ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"'
su vagrant -l -c "brew install /vagrant/package/vagrant-scripts/dmgbuild.rb"
/vagrant/package/package.sh /vagrant/substrate-assets/substrate_darwin_x86_64.zip master
mkdir -p /vagrant/pkg
cp *.dmg /vagrant/pkg
## Instruction:
Update installed version of python to resolve unicode issues
## Code After:
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
set -x
# if the proxy is around, use it
nc -z -w3 192.168.1.1 8123 && export http_proxy="http://192.168.1.1:8123"
export PATH="/usr/local/bin:$PATH"
gem install json_pure -v '~> 1.0' --no-ri --no-rdoc
gem install puppet -v '~> 3.0' --no-ri --no-rdoc
gem install fpm -v '~> 0.4.0' --no-ri --no-rdoc
chmod 755 /vagrant/package/package.sh
TRAVIS=1 su vagrant -l -c 'ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"'
pushd /tmp
su vagrant -c "brew install python"
rm /usr/bin/python
ln -s /usr/local/bin/python /usr/bin/python
su vagrant -c "brew install /vagrant/package/vagrant-scripts/dmgbuild.rb"
popd
/vagrant/package/package.sh /vagrant/substrate-assets/substrate_darwin_x86_64.zip master
mkdir -p /vagrant/pkg
cp *.dmg /vagrant/pkg
| SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
set -x
# if the proxy is around, use it
nc -z -w3 192.168.1.1 8123 && export http_proxy="http://192.168.1.1:8123"
+ export PATH="/usr/local/bin:$PATH"
+
gem install json_pure -v '~> 1.0' --no-ri --no-rdoc
gem install puppet -v '~> 3.0' --no-ri --no-rdoc
gem install fpm -v '~> 0.4.0' --no-ri --no-rdoc
chmod 755 /vagrant/package/package.sh
TRAVIS=1 su vagrant -l -c 'ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"'
+ pushd /tmp
+ su vagrant -c "brew install python"
+ rm /usr/bin/python
+ ln -s /usr/local/bin/python /usr/bin/python
- su vagrant -l -c "brew install /vagrant/package/vagrant-scripts/dmgbuild.rb"
? ---
+ su vagrant -c "brew install /vagrant/package/vagrant-scripts/dmgbuild.rb"
+ popd
/vagrant/package/package.sh /vagrant/substrate-assets/substrate_darwin_x86_64.zip master
mkdir -p /vagrant/pkg
cp *.dmg /vagrant/pkg | 9 | 0.428571 | 8 | 1 |
63087b7fd7499bd770f0e9a38695ebe68191a04d | remoting/webapp/jscompiler_hacks.js | remoting/webapp/jscompiler_hacks.js | // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file contains various hacks needed to inform JSCompiler of various
// WebKit-specific properties and methods. It is used only with JSCompiler
// to verify the type-correctness of our code.
/** @type Array.<HTMLElement> */
Document.prototype.all;
/** @type {function(string): void} */
Document.prototype.execCommand = function(command) {};
/** @return {void} Nothing. */
Document.prototype.webkitCancelFullScreen = function() {};
/** @type {boolean} */
Document.prototype.webkitIsFullScreen;
/** @type {number} */
Element.ALLOW_KEYBOARD_INPUT;
/** @param {number} flags
/** @return {void} Nothing. */
Element.prototype.webkitRequestFullScreen = function(flags) {};
/** @type {{getRandomValues: function(Uint16Array):void}} */
Window.prototype.crypto;
| // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file contains various hacks needed to inform JSCompiler of various
// WebKit-specific properties and methods. It is used only with JSCompiler
// to verify the type-correctness of our code.
/** @type Array.<HTMLElement> */
Document.prototype.all;
/** @type {function(string): void} */
Document.prototype.execCommand = function(command) {};
/** @return {void} Nothing. */
Document.prototype.webkitCancelFullScreen = function() {};
/** @type {boolean} */
Document.prototype.webkitIsFullScreen;
/** @type {number} */
Element.ALLOW_KEYBOARD_INPUT;
/** @param {number} flags
/** @return {void} Nothing. */
Element.prototype.webkitRequestFullScreen = function(flags) {};
/** @type {{getRandomValues: function(Uint16Array):void}} */
Window.prototype.crypto;
// This string is replaced with the actual value in build-webapp.py.
var OAUTH2_USE_OFFICIAL_CLIENT_ID = false;
| Make JS compiler happy about OAUTH2_USE_OFFICEIAL_CLIENT_ID. | Make JS compiler happy about OAUTH2_USE_OFFICEIAL_CLIENT_ID.
Review URL: https://chromiumcodereview.appspot.com/10206007
git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@133634 0039d316-1c4b-4281-b951-d872f2087c98
| JavaScript | bsd-3-clause | yitian134/chromium,adobe/chromium,ropik/chromium,ropik/chromium,adobe/chromium,yitian134/chromium,ropik/chromium,yitian134/chromium,yitian134/chromium,ropik/chromium,yitian134/chromium,adobe/chromium,ropik/chromium,adobe/chromium,yitian134/chromium,yitian134/chromium,adobe/chromium,adobe/chromium,adobe/chromium,adobe/chromium,adobe/chromium,adobe/chromium,ropik/chromium,ropik/chromium,ropik/chromium,yitian134/chromium,yitian134/chromium,yitian134/chromium,adobe/chromium,ropik/chromium | javascript | ## Code Before:
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file contains various hacks needed to inform JSCompiler of various
// WebKit-specific properties and methods. It is used only with JSCompiler
// to verify the type-correctness of our code.
/** @type Array.<HTMLElement> */
Document.prototype.all;
/** @type {function(string): void} */
Document.prototype.execCommand = function(command) {};
/** @return {void} Nothing. */
Document.prototype.webkitCancelFullScreen = function() {};
/** @type {boolean} */
Document.prototype.webkitIsFullScreen;
/** @type {number} */
Element.ALLOW_KEYBOARD_INPUT;
/** @param {number} flags
/** @return {void} Nothing. */
Element.prototype.webkitRequestFullScreen = function(flags) {};
/** @type {{getRandomValues: function(Uint16Array):void}} */
Window.prototype.crypto;
## Instruction:
Make JS compiler happy about OAUTH2_USE_OFFICEIAL_CLIENT_ID.
Review URL: https://chromiumcodereview.appspot.com/10206007
git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@133634 0039d316-1c4b-4281-b951-d872f2087c98
## Code After:
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file contains various hacks needed to inform JSCompiler of various
// WebKit-specific properties and methods. It is used only with JSCompiler
// to verify the type-correctness of our code.
/** @type Array.<HTMLElement> */
Document.prototype.all;
/** @type {function(string): void} */
Document.prototype.execCommand = function(command) {};
/** @return {void} Nothing. */
Document.prototype.webkitCancelFullScreen = function() {};
/** @type {boolean} */
Document.prototype.webkitIsFullScreen;
/** @type {number} */
Element.ALLOW_KEYBOARD_INPUT;
/** @param {number} flags
/** @return {void} Nothing. */
Element.prototype.webkitRequestFullScreen = function(flags) {};
/** @type {{getRandomValues: function(Uint16Array):void}} */
Window.prototype.crypto;
// This string is replaced with the actual value in build-webapp.py.
var OAUTH2_USE_OFFICIAL_CLIENT_ID = false;
| // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file contains various hacks needed to inform JSCompiler of various
// WebKit-specific properties and methods. It is used only with JSCompiler
// to verify the type-correctness of our code.
/** @type Array.<HTMLElement> */
Document.prototype.all;
/** @type {function(string): void} */
Document.prototype.execCommand = function(command) {};
/** @return {void} Nothing. */
Document.prototype.webkitCancelFullScreen = function() {};
/** @type {boolean} */
Document.prototype.webkitIsFullScreen;
/** @type {number} */
Element.ALLOW_KEYBOARD_INPUT;
/** @param {number} flags
/** @return {void} Nothing. */
Element.prototype.webkitRequestFullScreen = function(flags) {};
/** @type {{getRandomValues: function(Uint16Array):void}} */
Window.prototype.crypto;
+
+ // This string is replaced with the actual value in build-webapp.py.
+ var OAUTH2_USE_OFFICIAL_CLIENT_ID = false; | 3 | 0.103448 | 3 | 0 |
9d1ff49a94b0182fe32b3921b63e68462afcc8a4 | _drafts/2017-11-01-in-memory-testing.md | _drafts/2017-11-01-in-memory-testing.md | ---
title: "In-memory testing in sensenet ECM"
author: tusmester
image: "../img/posts/inmemory_testing.png"
tags: [enterprise content management, test, database]
---
# Testing a complete ECM platform in memory
| ---
title: "In-memory testing in sensenet ECM"
author: tusmester
image: "../img/posts/inmemory_testing.png"
tags: [test, database]
---
## Testing a complete ECM platform in memory
In the previous version of sensenet ECM we had many tests, 1400+. They covered most of the codebase, but unfortunately only some of them were real unit tests. Most of them were integration tests, involving multiple layers of the product, and as such, in many cases they required a fully installed sensenet ECM database in place.
That is not how a modern test environment should work, because of many reasons: speed, maintainability, flexibility.
> So we started over.
In the core repository (that contains the main component, [sensenet Services](https://github.com/SenseNet/sensenet)) we started small. Added a few real unit tests (and moved some from the old test project) that covered only a certain class or method and did not require the whole repository to run.
After that we started investigating the possibility of writing new unit tests for modules that needed the repository - but without actually starting it. We realised that it would require a thremendous amount of refactoring to make the codebase 100% unit test friendly with classes that support dependency injection in a natural way. It would take too much time and break so many existing apis that it was not a option.
## A whole repository in memory
## What's next?
| Add some draft text to the In-memory testing post. | Add some draft text to the In-memory testing post. | Markdown | mit | SenseNet/sensenet.github.io,SenseNet/sensenet.github.io,SenseNet/sensenet.github.io | markdown | ## Code Before:
---
title: "In-memory testing in sensenet ECM"
author: tusmester
image: "../img/posts/inmemory_testing.png"
tags: [enterprise content management, test, database]
---
# Testing a complete ECM platform in memory
## Instruction:
Add some draft text to the In-memory testing post.
## Code After:
---
title: "In-memory testing in sensenet ECM"
author: tusmester
image: "../img/posts/inmemory_testing.png"
tags: [test, database]
---
## Testing a complete ECM platform in memory
In the previous version of sensenet ECM we had many tests, 1400+. They covered most of the codebase, but unfortunately only some of them were real unit tests. Most of them were integration tests, involving multiple layers of the product, and as such, in many cases they required a fully installed sensenet ECM database in place.
That is not how a modern test environment should work, because of many reasons: speed, maintainability, flexibility.
> So we started over.
In the core repository (that contains the main component, [sensenet Services](https://github.com/SenseNet/sensenet)) we started small. Added a few real unit tests (and moved some from the old test project) that covered only a certain class or method and did not require the whole repository to run.
After that we started investigating the possibility of writing new unit tests for modules that needed the repository - but without actually starting it. We realised that it would require a thremendous amount of refactoring to make the codebase 100% unit test friendly with classes that support dependency injection in a natural way. It would take too much time and break so many existing apis that it was not a option.
## A whole repository in memory
## What's next?
| ---
title: "In-memory testing in sensenet ECM"
author: tusmester
image: "../img/posts/inmemory_testing.png"
- tags: [enterprise content management, test, database]
+ tags: [test, database]
---
- # Testing a complete ECM platform in memory
+ ## Testing a complete ECM platform in memory
? +
+ In the previous version of sensenet ECM we had many tests, 1400+. They covered most of the codebase, but unfortunately only some of them were real unit tests. Most of them were integration tests, involving multiple layers of the product, and as such, in many cases they required a fully installed sensenet ECM database in place.
+
+ That is not how a modern test environment should work, because of many reasons: speed, maintainability, flexibility.
+
+ > So we started over.
+
+ In the core repository (that contains the main component, [sensenet Services](https://github.com/SenseNet/sensenet)) we started small. Added a few real unit tests (and moved some from the old test project) that covered only a certain class or method and did not require the whole repository to run.
+
+ After that we started investigating the possibility of writing new unit tests for modules that needed the repository - but without actually starting it. We realised that it would require a thremendous amount of refactoring to make the codebase 100% unit test friendly with classes that support dependency injection in a natural way. It would take too much time and break so many existing apis that it was not a option.
+
+ ## A whole repository in memory
+
+
+ ## What's next? | 18 | 1.8 | 16 | 2 |
eed31bd9d9f3459bbc2c87667893a02146af3bc0 | activerecord/test/cases/arel/collectors/bind_test.rb | activerecord/test/cases/arel/collectors/bind_test.rb |
require_relative "../helper"
module Arel
module Collectors
class TestBind < Arel::Test
def setup
@conn = FakeRecord::Base.new
@visitor = Visitors::ToSql.new @conn.connection
super
end
def collect(node)
@visitor.accept(node, Collectors::Bind.new)
end
def compile(node)
collect(node).value
end
def ast_with_binds(bvs)
table = Table.new(:users)
manager = Arel::SelectManager.new table
manager.where(table[:age].eq(Nodes::BindParam.new(bvs.shift)))
manager.where(table[:name].eq(Nodes::BindParam.new(bvs.shift)))
manager.ast
end
def test_compile_gathers_all_bind_params
binds = compile(ast_with_binds(["hello", "world"]))
assert_equal ["hello", "world"], binds
binds = compile(ast_with_binds(["hello2", "world3"]))
assert_equal ["hello2", "world3"], binds
end
end
end
end
|
require_relative "../helper"
require "arel/collectors/bind"
module Arel
module Collectors
class TestBind < Arel::Test
def setup
@conn = FakeRecord::Base.new
@visitor = Visitors::ToSql.new @conn.connection
super
end
def collect(node)
@visitor.accept(node, Collectors::Bind.new)
end
def compile(node)
collect(node).value
end
def ast_with_binds(bvs)
table = Table.new(:users)
manager = Arel::SelectManager.new table
manager.where(table[:age].eq(Nodes::BindParam.new(bvs.shift)))
manager.where(table[:name].eq(Nodes::BindParam.new(bvs.shift)))
manager.ast
end
def test_compile_gathers_all_bind_params
binds = compile(ast_with_binds(["hello", "world"]))
assert_equal ["hello", "world"], binds
binds = compile(ast_with_binds(["hello2", "world3"]))
assert_equal ["hello2", "world3"], binds
end
end
end
end
| Address `NameError: uninitialized constant Arel::Collectors::Bind` when tested with Ruby 2.5 or higher | Address `NameError: uninitialized constant Arel::Collectors::Bind`
when tested with Ruby 2.5 or higher
```ruby
$ ruby -v
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
$ bundle exec ruby -w -Itest test/cases/arel/collectors/bind_test.rb -n test_compile_gathers_all_bind_params
Run options: -n test_compile_gathers_all_bind_params --seed 24420
E
Error:
Arel::Collectors::TestBind#test_compile_gathers_all_bind_params:
NameError: uninitialized constant Arel::Collectors::Bind
Did you mean? Binding
test/cases/arel/collectors/bind_test.rb:15:in `collect'
test/cases/arel/collectors/bind_test.rb:19:in `compile'
test/cases/arel/collectors/bind_test.rb:31:in `test_compile_gathers_all_bind_params'
bin/rails test test/cases/arel/collectors/bind_test.rb:30
Finished in 0.002343s, 426.8559 runs/s, 0.0000 assertions/s.
1 runs, 0 assertions, 0 failures, 1 errors, 0 skips
$
```
It is likely due to Ruby 2.5 does not look up top level constant.
https://www.ruby-lang.org/en/news/2017/12/25/ruby-2-5-0-released/
"Top-level constant look-up is no longer available."
| Ruby | mit | jeremy/rails,deraru/rails,betesh/rails,aditya-kapoor/rails,prathamesh-sonpatki/rails,joonyou/rails,lcreid/rails,esparta/rails,bogdanvlviv/rails,yawboakye/rails,EmmaB/rails-1,assain/rails,MSP-Greg/rails,pvalena/rails,Erol/rails,tgxworld/rails,schuetzm/rails,MSP-Greg/rails,yhirano55/rails,flanger001/rails,utilum/rails,illacceptanything/illacceptanything,kddeisz/rails,schuetzm/rails,Edouard-chin/rails,palkan/rails,BlakeWilliams/rails,untidy-hair/rails,iainbeeston/rails,deraru/rails,yahonda/rails,MSP-Greg/rails,jeremy/rails,deraru/rails,shioyama/rails,yawboakye/rails,eileencodes/rails,baerjam/rails,baerjam/rails,bogdanvlviv/rails,vipulnsward/rails,mohitnatoo/rails,prathamesh-sonpatki/rails,Edouard-chin/rails,printercu/rails,rails/rails,betesh/rails,mechanicles/rails,prathamesh-sonpatki/rails,bogdanvlviv/rails,starknx/rails,yalab/rails,yahonda/rails,iainbeeston/rails,BlakeWilliams/rails,aditya-kapoor/rails,rails/rails,EmmaB/rails-1,joonyou/rails,pvalena/rails,Vasfed/rails,untidy-hair/rails,yahonda/rails,arunagw/rails,lcreid/rails,kmcphillips/rails,Envek/rails,gauravtiwari/rails,illacceptanything/illacceptanything,georgeclaghorn/rails,flanger001/rails,Erol/rails,Vasfed/rails,tjschuck/rails,mohitnatoo/rails,Erol/rails,printercu/rails,kmcphillips/rails,prathamesh-sonpatki/rails,arunagw/rails,iainbeeston/rails,mechanicles/rails,georgeclaghorn/rails,schuetzm/rails,Vasfed/rails,shioyama/rails,Stellenticket/rails,mechanicles/rails,vipulnsward/rails,aditya-kapoor/rails,iainbeeston/rails,illacceptanything/illacceptanything,MSP-Greg/rails,illacceptanything/illacceptanything,utilum/rails,eileencodes/rails,notapatch/rails,palkan/rails,tgxworld/rails,repinel/rails,yawboakye/rails,fabianoleittes/rails,yhirano55/rails,betesh/rails,Edouard-chin/rails,EmmaB/rails-1,yhirano55/rails,jeremy/rails,Stellenticket/rails,starknx/rails,joonyou/rails,gauravtiwari/rails,yhirano55/rails,utilum/rails,esparta/rails,repinel/rails,untidy-hair/rails,utilum/rails,printercu/rails,yalab/rails,flanger001/rails,assain/rails,notapatch/rails,tjschuck/rails,kmcphillips/rails,aditya-kapoor/rails,esparta/rails,betesh/rails,tgxworld/rails,illacceptanything/illacceptanything,Stellenticket/rails,assain/rails,illacceptanything/illacceptanything,rails/rails,tjschuck/rails,tgxworld/rails,illacceptanything/illacceptanything,yahonda/rails,mechanicles/rails,illacceptanything/illacceptanything,deraru/rails,fabianoleittes/rails,arunagw/rails,kmcphillips/rails,Erol/rails,yalab/rails,Envek/rails,repinel/rails,illacceptanything/illacceptanything,Edouard-chin/rails,BlakeWilliams/rails,lcreid/rails,tjschuck/rails,georgeclaghorn/rails,rafaelfranca/omg-rails,repinel/rails,baerjam/rails,pvalena/rails,rails/rails,Stellenticket/rails,yawboakye/rails,BlakeWilliams/rails,joonyou/rails,mohitnatoo/rails,assain/rails,fabianoleittes/rails,vipulnsward/rails,mohitnatoo/rails,illacceptanything/illacceptanything,starknx/rails,kddeisz/rails,untidy-hair/rails,kddeisz/rails,shioyama/rails,rafaelfranca/omg-rails,schuetzm/rails,Envek/rails,Envek/rails,palkan/rails,illacceptanything/illacceptanything,yalab/rails,lcreid/rails,eileencodes/rails,illacceptanything/illacceptanything,notapatch/rails,rafaelfranca/omg-rails,georgeclaghorn/rails,gauravtiwari/rails,esparta/rails,pvalena/rails,arunagw/rails,bogdanvlviv/rails,illacceptanything/illacceptanything,jeremy/rails,flanger001/rails,eileencodes/rails,fabianoleittes/rails,baerjam/rails,vipulnsward/rails,notapatch/rails,palkan/rails,kddeisz/rails,Vasfed/rails,shioyama/rails,illacceptanything/illacceptanything,illacceptanything/illacceptanything,printercu/rails | ruby | ## Code Before:
require_relative "../helper"
module Arel
module Collectors
class TestBind < Arel::Test
def setup
@conn = FakeRecord::Base.new
@visitor = Visitors::ToSql.new @conn.connection
super
end
def collect(node)
@visitor.accept(node, Collectors::Bind.new)
end
def compile(node)
collect(node).value
end
def ast_with_binds(bvs)
table = Table.new(:users)
manager = Arel::SelectManager.new table
manager.where(table[:age].eq(Nodes::BindParam.new(bvs.shift)))
manager.where(table[:name].eq(Nodes::BindParam.new(bvs.shift)))
manager.ast
end
def test_compile_gathers_all_bind_params
binds = compile(ast_with_binds(["hello", "world"]))
assert_equal ["hello", "world"], binds
binds = compile(ast_with_binds(["hello2", "world3"]))
assert_equal ["hello2", "world3"], binds
end
end
end
end
## Instruction:
Address `NameError: uninitialized constant Arel::Collectors::Bind`
when tested with Ruby 2.5 or higher
```ruby
$ ruby -v
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
$ bundle exec ruby -w -Itest test/cases/arel/collectors/bind_test.rb -n test_compile_gathers_all_bind_params
Run options: -n test_compile_gathers_all_bind_params --seed 24420
E
Error:
Arel::Collectors::TestBind#test_compile_gathers_all_bind_params:
NameError: uninitialized constant Arel::Collectors::Bind
Did you mean? Binding
test/cases/arel/collectors/bind_test.rb:15:in `collect'
test/cases/arel/collectors/bind_test.rb:19:in `compile'
test/cases/arel/collectors/bind_test.rb:31:in `test_compile_gathers_all_bind_params'
bin/rails test test/cases/arel/collectors/bind_test.rb:30
Finished in 0.002343s, 426.8559 runs/s, 0.0000 assertions/s.
1 runs, 0 assertions, 0 failures, 1 errors, 0 skips
$
```
It is likely due to Ruby 2.5 does not look up top level constant.
https://www.ruby-lang.org/en/news/2017/12/25/ruby-2-5-0-released/
"Top-level constant look-up is no longer available."
## Code After:
require_relative "../helper"
require "arel/collectors/bind"
module Arel
module Collectors
class TestBind < Arel::Test
def setup
@conn = FakeRecord::Base.new
@visitor = Visitors::ToSql.new @conn.connection
super
end
def collect(node)
@visitor.accept(node, Collectors::Bind.new)
end
def compile(node)
collect(node).value
end
def ast_with_binds(bvs)
table = Table.new(:users)
manager = Arel::SelectManager.new table
manager.where(table[:age].eq(Nodes::BindParam.new(bvs.shift)))
manager.where(table[:name].eq(Nodes::BindParam.new(bvs.shift)))
manager.ast
end
def test_compile_gathers_all_bind_params
binds = compile(ast_with_binds(["hello", "world"]))
assert_equal ["hello", "world"], binds
binds = compile(ast_with_binds(["hello2", "world3"]))
assert_equal ["hello2", "world3"], binds
end
end
end
end
|
require_relative "../helper"
+ require "arel/collectors/bind"
module Arel
module Collectors
class TestBind < Arel::Test
def setup
@conn = FakeRecord::Base.new
@visitor = Visitors::ToSql.new @conn.connection
super
end
def collect(node)
@visitor.accept(node, Collectors::Bind.new)
end
def compile(node)
collect(node).value
end
def ast_with_binds(bvs)
table = Table.new(:users)
manager = Arel::SelectManager.new table
manager.where(table[:age].eq(Nodes::BindParam.new(bvs.shift)))
manager.where(table[:name].eq(Nodes::BindParam.new(bvs.shift)))
manager.ast
end
def test_compile_gathers_all_bind_params
binds = compile(ast_with_binds(["hello", "world"]))
assert_equal ["hello", "world"], binds
binds = compile(ast_with_binds(["hello2", "world3"]))
assert_equal ["hello2", "world3"], binds
end
end
end
end | 1 | 0.026316 | 1 | 0 |
be464317febc0e3a3dbfff2df7a31c3f4b982c88 | app/models/repository/destroying.rb | app/models/repository/destroying.rb | module Repository::Destroying
extend ActiveSupport::Concern
# Only use `destroy_asynchronously` if you want to destroy a repository.
# It prepares the deletion by setting a flag, which enables the deletion
# of its ontologies.
def destroy
Rails.logger.info "Destroy #{self.class} #{self} (id: #{id})"
super
rescue StandardError => e
self.destroying = false
save!
raise e.class, I18n.t('repository.delete_error', oms: Settings.OMS.with_indefinite_article)
end
def destroy_asynchronously
unless can_be_deleted?
raise Repository::DeleteError, I18n.t('repository.delete_error')
end
Rails.logger.info "Mark #{self.class} #{self} (id: #{id}) as is_destroying"
self.is_destroying = true
save!
async(:destroy)
end
def can_be_deleted?
ontologies.map(&:can_be_deleted_with_whole_repository?).all?
end
end
| module Repository::Destroying
extend ActiveSupport::Concern
included do
scope :destroying, ->() { unscoped.where(is_destroying: true) }
scope :active, ->() { where(is_destroying: false) }
default_scope ->() { active }
end
# Only use `destroy_asynchronously` if you want to destroy a repository.
# It prepares the deletion by setting a flag, which enables the deletion
# of its ontologies.
def destroy
Rails.logger.info "Destroy #{self.class} #{self} (id: #{id})"
super
rescue StandardError => e
self.destroying = false
save!
raise e.class, I18n.t('repository.delete_error', oms: Settings.OMS.with_indefinite_article)
end
def destroy_asynchronously
unless can_be_deleted?
raise Repository::DeleteError, I18n.t('repository.delete_error')
end
Rails.logger.info "Mark #{self.class} #{self} (id: #{id}) as is_destroying"
self.is_destroying = true
save!
async(:destroy)
end
def can_be_deleted?
ontologies.map(&:can_be_deleted_with_whole_repository?).all?
end
end
| Add scopes and default scope, adjust migrations. | Add scopes and default scope, adjust migrations.
| Ruby | agpl-3.0 | ontohub/ontohub,ontohub/ontohub,ontohub/ontohub,ontohub/ontohub,ontohub/ontohub,ontohub/ontohub | ruby | ## Code Before:
module Repository::Destroying
extend ActiveSupport::Concern
# Only use `destroy_asynchronously` if you want to destroy a repository.
# It prepares the deletion by setting a flag, which enables the deletion
# of its ontologies.
def destroy
Rails.logger.info "Destroy #{self.class} #{self} (id: #{id})"
super
rescue StandardError => e
self.destroying = false
save!
raise e.class, I18n.t('repository.delete_error', oms: Settings.OMS.with_indefinite_article)
end
def destroy_asynchronously
unless can_be_deleted?
raise Repository::DeleteError, I18n.t('repository.delete_error')
end
Rails.logger.info "Mark #{self.class} #{self} (id: #{id}) as is_destroying"
self.is_destroying = true
save!
async(:destroy)
end
def can_be_deleted?
ontologies.map(&:can_be_deleted_with_whole_repository?).all?
end
end
## Instruction:
Add scopes and default scope, adjust migrations.
## Code After:
module Repository::Destroying
extend ActiveSupport::Concern
included do
scope :destroying, ->() { unscoped.where(is_destroying: true) }
scope :active, ->() { where(is_destroying: false) }
default_scope ->() { active }
end
# Only use `destroy_asynchronously` if you want to destroy a repository.
# It prepares the deletion by setting a flag, which enables the deletion
# of its ontologies.
def destroy
Rails.logger.info "Destroy #{self.class} #{self} (id: #{id})"
super
rescue StandardError => e
self.destroying = false
save!
raise e.class, I18n.t('repository.delete_error', oms: Settings.OMS.with_indefinite_article)
end
def destroy_asynchronously
unless can_be_deleted?
raise Repository::DeleteError, I18n.t('repository.delete_error')
end
Rails.logger.info "Mark #{self.class} #{self} (id: #{id}) as is_destroying"
self.is_destroying = true
save!
async(:destroy)
end
def can_be_deleted?
ontologies.map(&:can_be_deleted_with_whole_repository?).all?
end
end
| module Repository::Destroying
extend ActiveSupport::Concern
+
+ included do
+ scope :destroying, ->() { unscoped.where(is_destroying: true) }
+ scope :active, ->() { where(is_destroying: false) }
+ default_scope ->() { active }
+ end
# Only use `destroy_asynchronously` if you want to destroy a repository.
# It prepares the deletion by setting a flag, which enables the deletion
# of its ontologies.
def destroy
Rails.logger.info "Destroy #{self.class} #{self} (id: #{id})"
super
rescue StandardError => e
self.destroying = false
save!
raise e.class, I18n.t('repository.delete_error', oms: Settings.OMS.with_indefinite_article)
end
def destroy_asynchronously
unless can_be_deleted?
raise Repository::DeleteError, I18n.t('repository.delete_error')
end
Rails.logger.info "Mark #{self.class} #{self} (id: #{id}) as is_destroying"
self.is_destroying = true
save!
async(:destroy)
end
def can_be_deleted?
ontologies.map(&:can_be_deleted_with_whole_repository?).all?
end
end | 6 | 0.206897 | 6 | 0 |
b829eb47cf043be892326bfb6db7fb6542697800 | example/twitter-example/src/App.js | example/twitter-example/src/App.js | import React, { Component } from 'react';
import TwitterLogin from 'react-twitter-auth/lib/react-twitter-auth-component.js';
class App extends Component {
constructor() {
super();
this.onFailed = this.onFailed.bind(this);
this.onSuccess = this.onSuccess.bind(this);
}
onSuccess(body) {
alert(JSON.stringify(body));
}
onFailed(error) {
alert(error);
}
render() {
return (
<div>
<TwitterLogin loginUrl="http://localhost:4000/api/v1/auth/twitter" onFailure={this.onFailed} onSuccess={this.onSuccess} requestTokenUrl="http://localhost:4000/api/v1/auth/twitter/reverse"/>
</div>
);
}
}
export default App;
| import React, { Component } from 'react';
import TwitterLogin from 'react-twitter-auth/lib/react-twitter-auth-component.js';
class App extends Component {
constructor() {
super();
this.onFailed = this.onFailed.bind(this);
this.onSuccess = this.onSuccess.bind(this);
}
onSuccess(response) {
response.json().then(body => {
alert(JSON.stringify(body));
});
}
onFailed(error) {
alert(error);
}
render() {
return (
<div>
<TwitterLogin loginUrl="http://localhost:4000/api/v1/auth/twitter" onFailure={this.onFailed} onSuccess={this.onSuccess} requestTokenUrl="http://localhost:4000/api/v1/auth/twitter/reverse"/>
</div>
);
}
}
export default App;
| Improve example so that it writes nicely received object on success | Improve example so that it writes nicely received object on success
| JavaScript | mit | GenFirst/react-twitter-auth,GenFirst/react-twitter-auth | javascript | ## Code Before:
import React, { Component } from 'react';
import TwitterLogin from 'react-twitter-auth/lib/react-twitter-auth-component.js';
class App extends Component {
constructor() {
super();
this.onFailed = this.onFailed.bind(this);
this.onSuccess = this.onSuccess.bind(this);
}
onSuccess(body) {
alert(JSON.stringify(body));
}
onFailed(error) {
alert(error);
}
render() {
return (
<div>
<TwitterLogin loginUrl="http://localhost:4000/api/v1/auth/twitter" onFailure={this.onFailed} onSuccess={this.onSuccess} requestTokenUrl="http://localhost:4000/api/v1/auth/twitter/reverse"/>
</div>
);
}
}
export default App;
## Instruction:
Improve example so that it writes nicely received object on success
## Code After:
import React, { Component } from 'react';
import TwitterLogin from 'react-twitter-auth/lib/react-twitter-auth-component.js';
class App extends Component {
constructor() {
super();
this.onFailed = this.onFailed.bind(this);
this.onSuccess = this.onSuccess.bind(this);
}
onSuccess(response) {
response.json().then(body => {
alert(JSON.stringify(body));
});
}
onFailed(error) {
alert(error);
}
render() {
return (
<div>
<TwitterLogin loginUrl="http://localhost:4000/api/v1/auth/twitter" onFailure={this.onFailed} onSuccess={this.onSuccess} requestTokenUrl="http://localhost:4000/api/v1/auth/twitter/reverse"/>
</div>
);
}
}
export default App;
| import React, { Component } from 'react';
import TwitterLogin from 'react-twitter-auth/lib/react-twitter-auth-component.js';
class App extends Component {
constructor() {
super();
this.onFailed = this.onFailed.bind(this);
this.onSuccess = this.onSuccess.bind(this);
}
- onSuccess(body) {
? ^ ^^
+ onSuccess(response) {
? ^^^^ ^^^
+ response.json().then(body => {
- alert(JSON.stringify(body));
+ alert(JSON.stringify(body));
? ++
+ });
}
onFailed(error) {
alert(error);
}
render() {
return (
<div>
<TwitterLogin loginUrl="http://localhost:4000/api/v1/auth/twitter" onFailure={this.onFailed} onSuccess={this.onSuccess} requestTokenUrl="http://localhost:4000/api/v1/auth/twitter/reverse"/>
</div>
);
}
}
export default App; | 6 | 0.2 | 4 | 2 |
c038da2f6b1de2780e02fd1850ab25626225ca7b | tests/service.rs | tests/service.rs | extern crate specinfra;
use specinfra::backend;
#[test]
fn service_resource_with_inline_provider() {
let b = backend::direct::Direct::new();
let s = specinfra::new(&b).unwrap();
test_service_resource(s);
}
fn test_service_resource(s: specinfra::Specinfra) {
let dbus = s.service("dbus.service");
assert!(dbus.is_running().unwrap());
let dbus = s.service("dbus");
assert!(dbus.is_running().unwrap());
let sshd = s.service("sshd");
assert!(sshd.is_enabled().unwrap());
let nginx = s.service("nginx");
assert!(nginx.enable().unwrap());
assert!(nginx.is_enabled().unwrap());
assert!(nginx.disable().unwrap());
assert_eq!(nginx.is_enabled().unwrap(), false);
assert!(nginx.start().unwrap());
assert!(nginx.is_running().unwrap());
assert!(nginx.reload().unwrap());
assert!(nginx.is_running().unwrap());
assert!(nginx.restart().unwrap());
assert!(nginx.is_running().unwrap());
assert!(nginx.stop().unwrap());
assert_eq!(nginx.is_running().unwrap(), false);
}
| extern crate specinfra;
use specinfra::backend;
use specinfra::Specinfra;
use specinfra::provider::service::inline::null::Null;
#[test]
fn service_resource_with_inline_provider() {
let b = backend::direct::Direct::new();
let s = specinfra::new(&b).unwrap();
test_service_resource(s);
}
#[test]
fn service_resource_with_shell_provider() {
let b = backend::direct::Direct::new();
let mut s = specinfra::new(&b).unwrap();
s.providers.service.inline = Box::new(Null);
test_service_resource(s);
}
fn test_service_resource(s: Specinfra) {
let dbus = s.service("dbus.service");
assert!(dbus.is_running().unwrap());
let dbus = s.service("dbus");
assert!(dbus.is_running().unwrap());
let sshd = s.service("sshd");
assert!(sshd.is_enabled().unwrap());
let nginx = s.service("nginx");
assert!(nginx.enable().unwrap());
assert!(nginx.is_enabled().unwrap());
assert!(nginx.disable().unwrap());
assert_eq!(nginx.is_enabled().unwrap(), false);
assert!(nginx.start().unwrap());
assert!(nginx.is_running().unwrap());
assert!(nginx.reload().unwrap());
assert!(nginx.is_running().unwrap());
assert!(nginx.restart().unwrap());
assert!(nginx.is_running().unwrap());
assert!(nginx.stop().unwrap());
assert_eq!(nginx.is_running().unwrap(), false);
}
| Add test for shell systemd provider | Add test for shell systemd provider
| Rust | mit | libspecinfra/specinfra,libspecinfra/specinfra | rust | ## Code Before:
extern crate specinfra;
use specinfra::backend;
#[test]
fn service_resource_with_inline_provider() {
let b = backend::direct::Direct::new();
let s = specinfra::new(&b).unwrap();
test_service_resource(s);
}
fn test_service_resource(s: specinfra::Specinfra) {
let dbus = s.service("dbus.service");
assert!(dbus.is_running().unwrap());
let dbus = s.service("dbus");
assert!(dbus.is_running().unwrap());
let sshd = s.service("sshd");
assert!(sshd.is_enabled().unwrap());
let nginx = s.service("nginx");
assert!(nginx.enable().unwrap());
assert!(nginx.is_enabled().unwrap());
assert!(nginx.disable().unwrap());
assert_eq!(nginx.is_enabled().unwrap(), false);
assert!(nginx.start().unwrap());
assert!(nginx.is_running().unwrap());
assert!(nginx.reload().unwrap());
assert!(nginx.is_running().unwrap());
assert!(nginx.restart().unwrap());
assert!(nginx.is_running().unwrap());
assert!(nginx.stop().unwrap());
assert_eq!(nginx.is_running().unwrap(), false);
}
## Instruction:
Add test for shell systemd provider
## Code After:
extern crate specinfra;
use specinfra::backend;
use specinfra::Specinfra;
use specinfra::provider::service::inline::null::Null;
#[test]
fn service_resource_with_inline_provider() {
let b = backend::direct::Direct::new();
let s = specinfra::new(&b).unwrap();
test_service_resource(s);
}
#[test]
fn service_resource_with_shell_provider() {
let b = backend::direct::Direct::new();
let mut s = specinfra::new(&b).unwrap();
s.providers.service.inline = Box::new(Null);
test_service_resource(s);
}
fn test_service_resource(s: Specinfra) {
let dbus = s.service("dbus.service");
assert!(dbus.is_running().unwrap());
let dbus = s.service("dbus");
assert!(dbus.is_running().unwrap());
let sshd = s.service("sshd");
assert!(sshd.is_enabled().unwrap());
let nginx = s.service("nginx");
assert!(nginx.enable().unwrap());
assert!(nginx.is_enabled().unwrap());
assert!(nginx.disable().unwrap());
assert_eq!(nginx.is_enabled().unwrap(), false);
assert!(nginx.start().unwrap());
assert!(nginx.is_running().unwrap());
assert!(nginx.reload().unwrap());
assert!(nginx.is_running().unwrap());
assert!(nginx.restart().unwrap());
assert!(nginx.is_running().unwrap());
assert!(nginx.stop().unwrap());
assert_eq!(nginx.is_running().unwrap(), false);
}
| extern crate specinfra;
use specinfra::backend;
+ use specinfra::Specinfra;
+ use specinfra::provider::service::inline::null::Null;
#[test]
fn service_resource_with_inline_provider() {
let b = backend::direct::Direct::new();
let s = specinfra::new(&b).unwrap();
test_service_resource(s);
}
+ #[test]
+ fn service_resource_with_shell_provider() {
+ let b = backend::direct::Direct::new();
+ let mut s = specinfra::new(&b).unwrap();
+ s.providers.service.inline = Box::new(Null);
+ test_service_resource(s);
+ }
+
- fn test_service_resource(s: specinfra::Specinfra) {
? -----------
+ fn test_service_resource(s: Specinfra) {
let dbus = s.service("dbus.service");
assert!(dbus.is_running().unwrap());
let dbus = s.service("dbus");
assert!(dbus.is_running().unwrap());
let sshd = s.service("sshd");
assert!(sshd.is_enabled().unwrap());
let nginx = s.service("nginx");
assert!(nginx.enable().unwrap());
assert!(nginx.is_enabled().unwrap());
assert!(nginx.disable().unwrap());
assert_eq!(nginx.is_enabled().unwrap(), false);
assert!(nginx.start().unwrap());
assert!(nginx.is_running().unwrap());
assert!(nginx.reload().unwrap());
assert!(nginx.is_running().unwrap());
assert!(nginx.restart().unwrap());
assert!(nginx.is_running().unwrap());
assert!(nginx.stop().unwrap());
assert_eq!(nginx.is_running().unwrap(), false);
} | 12 | 0.307692 | 11 | 1 |
708a8efd9c453d4f7758dff2a60edf37ff84d1cf | app/models/attachment.rb | app/models/attachment.rb | require "services"
class Attachment
include Mongoid::Document
include Mongoid::Timestamps
field :title
field :filename
field :file_id, type: String
field :file_url, type: String
embedded_in :section_edition
before_save :upload_file, if: :file_has_changed?
def to_param
id.to_s
end
def snippet
"[InlineAttachment:#{filename}]"
end
def file=(file)
@file_has_changed = true
@uploaded_file = file
end
def file_has_changed?
@file_has_changed
end
def upload_file
raise ApiClientNotPresent unless Services.attachment_api
begin
if file_id.nil?
response = Services.attachment_api.create_asset(file: @uploaded_file)
self.file_id = response["id"].split("/").last
else
response = Services.attachment_api.update_asset(file_id, file: @uploaded_file)
end
self.file_url = response["file_url"]
rescue GdsApi::HTTPNotFound => e
raise "Error uploading file. Is the Asset Manager service available?\n#{e.message}"
rescue StandardError
errors.add(:file_id, "could not be uploaded")
end
end
def content_type
return unless file_url
extname = File.extname(file_url).delete(".")
"application/#{extname}"
end
class ::ApiClientNotPresent < StandardError; end
end
| require "services"
class Attachment
include Mongoid::Document
include Mongoid::Timestamps
field :title
field :filename
field :file_id, type: String
field :file_url, type: String
embedded_in :section_edition
before_save :upload_file, if: :file_has_changed?
def to_param
id.to_s
end
def snippet
"[InlineAttachment:#{filename}]"
end
def file=(file)
@file_has_changed = true
@uploaded_file = file
end
def file_has_changed?
@file_has_changed
end
def upload_file
begin
if file_id.nil?
response = Services.attachment_api.create_asset(file: @uploaded_file)
self.file_id = response["id"].split("/").last
else
response = Services.attachment_api.update_asset(file_id, file: @uploaded_file)
end
self.file_url = response["file_url"]
rescue GdsApi::HTTPNotFound => e
raise "Error uploading file. Is the Asset Manager service available?\n#{e.message}"
rescue StandardError
errors.add(:file_id, "could not be uploaded")
end
end
def content_type
return unless file_url
extname = File.extname(file_url).delete(".")
"application/#{extname}"
end
end
| Remove unnecessary guard condition and exception | Remove unnecessary guard condition and exception
I can't see how `Services.attachment_api` would ever not return
something and so I think this guard condition is unnecessary.
What's more the raising of a `ApiClientNotPresent` exception is not
covered in the tests and this exception is never explicitly handled.
If it turns out that `Services.attachment_api` does return `nil` for
some reason, we won't be any worse off - we'll just see a
`NoMethodError` instead of the custom exception.
| Ruby | mit | alphagov/manuals-publisher,alphagov/manuals-publisher,alphagov/manuals-publisher | ruby | ## Code Before:
require "services"
class Attachment
include Mongoid::Document
include Mongoid::Timestamps
field :title
field :filename
field :file_id, type: String
field :file_url, type: String
embedded_in :section_edition
before_save :upload_file, if: :file_has_changed?
def to_param
id.to_s
end
def snippet
"[InlineAttachment:#{filename}]"
end
def file=(file)
@file_has_changed = true
@uploaded_file = file
end
def file_has_changed?
@file_has_changed
end
def upload_file
raise ApiClientNotPresent unless Services.attachment_api
begin
if file_id.nil?
response = Services.attachment_api.create_asset(file: @uploaded_file)
self.file_id = response["id"].split("/").last
else
response = Services.attachment_api.update_asset(file_id, file: @uploaded_file)
end
self.file_url = response["file_url"]
rescue GdsApi::HTTPNotFound => e
raise "Error uploading file. Is the Asset Manager service available?\n#{e.message}"
rescue StandardError
errors.add(:file_id, "could not be uploaded")
end
end
def content_type
return unless file_url
extname = File.extname(file_url).delete(".")
"application/#{extname}"
end
class ::ApiClientNotPresent < StandardError; end
end
## Instruction:
Remove unnecessary guard condition and exception
I can't see how `Services.attachment_api` would ever not return
something and so I think this guard condition is unnecessary.
What's more the raising of a `ApiClientNotPresent` exception is not
covered in the tests and this exception is never explicitly handled.
If it turns out that `Services.attachment_api` does return `nil` for
some reason, we won't be any worse off - we'll just see a
`NoMethodError` instead of the custom exception.
## Code After:
require "services"
class Attachment
include Mongoid::Document
include Mongoid::Timestamps
field :title
field :filename
field :file_id, type: String
field :file_url, type: String
embedded_in :section_edition
before_save :upload_file, if: :file_has_changed?
def to_param
id.to_s
end
def snippet
"[InlineAttachment:#{filename}]"
end
def file=(file)
@file_has_changed = true
@uploaded_file = file
end
def file_has_changed?
@file_has_changed
end
def upload_file
begin
if file_id.nil?
response = Services.attachment_api.create_asset(file: @uploaded_file)
self.file_id = response["id"].split("/").last
else
response = Services.attachment_api.update_asset(file_id, file: @uploaded_file)
end
self.file_url = response["file_url"]
rescue GdsApi::HTTPNotFound => e
raise "Error uploading file. Is the Asset Manager service available?\n#{e.message}"
rescue StandardError
errors.add(:file_id, "could not be uploaded")
end
end
def content_type
return unless file_url
extname = File.extname(file_url).delete(".")
"application/#{extname}"
end
end
| require "services"
class Attachment
include Mongoid::Document
include Mongoid::Timestamps
field :title
field :filename
field :file_id, type: String
field :file_url, type: String
embedded_in :section_edition
before_save :upload_file, if: :file_has_changed?
def to_param
id.to_s
end
def snippet
"[InlineAttachment:#{filename}]"
end
def file=(file)
@file_has_changed = true
@uploaded_file = file
end
def file_has_changed?
@file_has_changed
end
def upload_file
- raise ApiClientNotPresent unless Services.attachment_api
begin
if file_id.nil?
response = Services.attachment_api.create_asset(file: @uploaded_file)
self.file_id = response["id"].split("/").last
else
response = Services.attachment_api.update_asset(file_id, file: @uploaded_file)
end
self.file_url = response["file_url"]
rescue GdsApi::HTTPNotFound => e
raise "Error uploading file. Is the Asset Manager service available?\n#{e.message}"
rescue StandardError
errors.add(:file_id, "could not be uploaded")
end
end
def content_type
return unless file_url
extname = File.extname(file_url).delete(".")
"application/#{extname}"
end
-
- class ::ApiClientNotPresent < StandardError; end
end | 3 | 0.052632 | 0 | 3 |
9a434c3954afbec3609305bc12dbf7d7f9427cf9 | stock_location_area_data/data/stock_location_area_data.xml | stock_location_area_data/data/stock_location_area_data.xml | <?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="product_uom_categ_surface" model="product.uom.categ">
<field name="name">Surface</field>
</record>
<record id="product_uom_m2" model="product.uom">
<field name="name">m²</field>
<field name="category_id" eval="product_uom_categ_surface"/>
</record>
<record id="product_uom_feet2" model="product.uom">
<field name="name">feet²</field>
<field name="category_id" eval="product_uom_categ_surface"/>
</record>
</data>
</openerp>
| <?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="product_uom_categ_surface" model="product.uom.categ">
<field name="name">Surface</field>
</record>
<record id="product_uom_m2" model="product.uom">
<field name="name">m²</field>
<field name="category_id" eval="product_uom_categ_surface"/>
<field name="uom_type">reference</field>
</record>
<record id="product_uom_feet2" model="product.uom">
<field name="name">feet²</field>
<field name="category_id" eval="product_uom_categ_surface"/>
<field name="uom_type">smaller</field>
<field name="factor">10.76391042</field>
</record>
</data>
</openerp>
| Add units of measure conversion | Add units of measure conversion
| XML | agpl-3.0 | NL66278/stock-logistics-warehouse,open-synergy/stock-logistics-warehouse,tafaRU/stock-logistics-warehouse,StefanRijnhart/stock-logistics-warehouse,vauxoo-dev/stock-logistics-warehouse,acsone/stock-logistics-warehouse,factorlibre/stock-logistics-warehouse,zhaohuaw/stock-logistics-warehouse,avoinsystems/stock-logistics-warehouse,akretion/stock-logistics-warehouse,kmee/stock-logistics-warehouse,pedrobaeza/stock-logistics-warehouse,raycarnes/stock-logistics-warehouse,LatinuxSistemas/stock-logistics-warehouse | xml | ## Code Before:
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="product_uom_categ_surface" model="product.uom.categ">
<field name="name">Surface</field>
</record>
<record id="product_uom_m2" model="product.uom">
<field name="name">m²</field>
<field name="category_id" eval="product_uom_categ_surface"/>
</record>
<record id="product_uom_feet2" model="product.uom">
<field name="name">feet²</field>
<field name="category_id" eval="product_uom_categ_surface"/>
</record>
</data>
</openerp>
## Instruction:
Add units of measure conversion
## Code After:
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="product_uom_categ_surface" model="product.uom.categ">
<field name="name">Surface</field>
</record>
<record id="product_uom_m2" model="product.uom">
<field name="name">m²</field>
<field name="category_id" eval="product_uom_categ_surface"/>
<field name="uom_type">reference</field>
</record>
<record id="product_uom_feet2" model="product.uom">
<field name="name">feet²</field>
<field name="category_id" eval="product_uom_categ_surface"/>
<field name="uom_type">smaller</field>
<field name="factor">10.76391042</field>
</record>
</data>
</openerp>
| <?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="product_uom_categ_surface" model="product.uom.categ">
<field name="name">Surface</field>
</record>
<record id="product_uom_m2" model="product.uom">
<field name="name">m²</field>
<field name="category_id" eval="product_uom_categ_surface"/>
+ <field name="uom_type">reference</field>
</record>
<record id="product_uom_feet2" model="product.uom">
<field name="name">feet²</field>
<field name="category_id" eval="product_uom_categ_surface"/>
+ <field name="uom_type">smaller</field>
+ <field name="factor">10.76391042</field>
</record>
</data>
</openerp> | 3 | 0.15 | 3 | 0 |
4309a19a7cbaec0cce496a5a1fe459cee087dfd7 | Library/Homebrew/test/test_sandbox.rb | Library/Homebrew/test/test_sandbox.rb | require "testing_env"
require "sandbox"
class SandboxTest < Homebrew::TestCase
def setup
skip "sandbox not implemented" unless Sandbox.available?
@sandbox = Sandbox.new
@dir = Pathname.new(mktmpdir)
@file = @dir/"foo"
end
def teardown
@dir.rmtree
end
def test_allow_write
@sandbox.allow_write @file
@sandbox.exec "touch", @file
assert_predicate @file, :exist?
end
def test_deny_write
shutup do
assert_raises(ErrorDuringExecution) { @sandbox.exec "touch", @file }
end
refute_predicate @file, :exist?
end
end
| require "testing_env"
require "sandbox"
class SandboxTest < Homebrew::TestCase
def setup
skip "sandbox not implemented" unless Sandbox.available?
@sandbox = Sandbox.new
@dir = Pathname.new(mktmpdir)
@file = @dir/"foo"
end
def teardown
@dir.rmtree
end
def test_allow_write
@sandbox.allow_write @file
@sandbox.exec "touch", @file
assert_predicate @file, :exist?
end
def test_deny_write
shutup do
assert_raises(ErrorDuringExecution) { @sandbox.exec "touch", @file }
end
refute_predicate @file, :exist?
end
def test_complains_on_failure
Utils.expects(:popen_read => "foo")
ARGV.stubs(:verbose? => true)
out, _err = capture_io do
assert_raises(ErrorDuringExecution) { @sandbox.exec "false" }
end
assert_match "foo", out
end
def test_ignores_bogus_python_error
with_bogus_error = <<-EOS.undent
foo
Mar 17 02:55:06 sandboxd[342]: Python(49765) deny file-write-unlink /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/errors.pyc
bar
EOS
Utils.expects(:popen_read => with_bogus_error)
ARGV.stubs(:verbose? => true)
out, _err = capture_io do
assert_raises(ErrorDuringExecution) { @sandbox.exec "false" }
end
refute_predicate out, :empty?
assert_match "foo", out
assert_match "bar", out
refute_match "Python", out
end
end
| Test that sandbox complains correctly | Test that sandbox complains correctly
Test that sandbox does not complain about bogus .pyc errors and does
complain about other failures.
Closes #684.
| Ruby | bsd-2-clause | claui/brew,Linuxbrew/brew,sjackman/homebrew,maxim-belkin/brew,JCount/brew,Homebrew/brew,AnastasiaSulyagina/brew,vitorgalvao/brew,aw1621107/brew,Linuxbrew/brew,toonetown/homebrew,palxex/brew,bfontaine/brew,aw1621107/brew,Homebrew/brew,JCount/brew,Linuxbrew/brew,sjackman/homebrew,hanxue/linuxbrew,bfontaine/brew,mgrimes/brew,tonyg/homebrew,reitermarkus/brew,nandub/brew,toonetown/homebrew,reelsense/brew,aw1621107/brew,mgrimes/brew,toonetown/homebrew,Homebrew/brew,mahori/brew,sjackman/homebrew,reelsense/brew,nandub/brew,JCount/brew,MikeMcQuaid/brew,amar-laksh/brew_sudo,vitorgalvao/brew,ilovezfs/brew,rwhogg/brew,mahori/brew,pseudocody/brew,sjackman/homebrew,DomT4/brew,EricFromCanada/brew,hanxue/linuxbrew,maxim-belkin/brew,tonyg/homebrew,zmwangx/brew,bfontaine/brew,gregory-nisbet/brew,zmwangx/brew,vitorgalvao/brew,reitermarkus/brew,gregory-nisbet/brew,alyssais/brew,claui/brew,nandub/brew,reitermarkus/brew,alyssais/brew,konqui/brew,konqui/brew,vitorgalvao/brew,gregory-nisbet/brew,muellermartin/dist,EricFromCanada/brew,amar-laksh/brew_sudo,konqui/brew,pseudocody/brew,reitermarkus/brew,hanxue/linuxbrew,jmsundar/brew,muellermartin/dist,alyssais/brew,mahori/brew,jmsundar/brew,reelsense/brew,AnastasiaSulyagina/brew,DomT4/brew,DomT4/brew,maxim-belkin/brew,claui/brew,JCount/brew,MikeMcQuaid/brew,mahori/brew,ilovezfs/brew,claui/brew,EricFromCanada/brew,pseudocody/brew,tonyg/homebrew,zmwangx/brew,jmsundar/brew,nandub/brew,mgrimes/brew,Linuxbrew/brew,EricFromCanada/brew,amar-laksh/brew_sudo,AnastasiaSulyagina/brew,konqui/brew,palxex/brew,rwhogg/brew,ilovezfs/brew,MikeMcQuaid/brew,palxex/brew,muellermartin/dist,Homebrew/brew,DomT4/brew,MikeMcQuaid/brew,rwhogg/brew | ruby | ## Code Before:
require "testing_env"
require "sandbox"
class SandboxTest < Homebrew::TestCase
def setup
skip "sandbox not implemented" unless Sandbox.available?
@sandbox = Sandbox.new
@dir = Pathname.new(mktmpdir)
@file = @dir/"foo"
end
def teardown
@dir.rmtree
end
def test_allow_write
@sandbox.allow_write @file
@sandbox.exec "touch", @file
assert_predicate @file, :exist?
end
def test_deny_write
shutup do
assert_raises(ErrorDuringExecution) { @sandbox.exec "touch", @file }
end
refute_predicate @file, :exist?
end
end
## Instruction:
Test that sandbox complains correctly
Test that sandbox does not complain about bogus .pyc errors and does
complain about other failures.
Closes #684.
## Code After:
require "testing_env"
require "sandbox"
class SandboxTest < Homebrew::TestCase
def setup
skip "sandbox not implemented" unless Sandbox.available?
@sandbox = Sandbox.new
@dir = Pathname.new(mktmpdir)
@file = @dir/"foo"
end
def teardown
@dir.rmtree
end
def test_allow_write
@sandbox.allow_write @file
@sandbox.exec "touch", @file
assert_predicate @file, :exist?
end
def test_deny_write
shutup do
assert_raises(ErrorDuringExecution) { @sandbox.exec "touch", @file }
end
refute_predicate @file, :exist?
end
def test_complains_on_failure
Utils.expects(:popen_read => "foo")
ARGV.stubs(:verbose? => true)
out, _err = capture_io do
assert_raises(ErrorDuringExecution) { @sandbox.exec "false" }
end
assert_match "foo", out
end
def test_ignores_bogus_python_error
with_bogus_error = <<-EOS.undent
foo
Mar 17 02:55:06 sandboxd[342]: Python(49765) deny file-write-unlink /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/errors.pyc
bar
EOS
Utils.expects(:popen_read => with_bogus_error)
ARGV.stubs(:verbose? => true)
out, _err = capture_io do
assert_raises(ErrorDuringExecution) { @sandbox.exec "false" }
end
refute_predicate out, :empty?
assert_match "foo", out
assert_match "bar", out
refute_match "Python", out
end
end
| require "testing_env"
require "sandbox"
class SandboxTest < Homebrew::TestCase
def setup
skip "sandbox not implemented" unless Sandbox.available?
@sandbox = Sandbox.new
@dir = Pathname.new(mktmpdir)
@file = @dir/"foo"
end
def teardown
@dir.rmtree
end
def test_allow_write
@sandbox.allow_write @file
@sandbox.exec "touch", @file
assert_predicate @file, :exist?
end
def test_deny_write
shutup do
assert_raises(ErrorDuringExecution) { @sandbox.exec "touch", @file }
end
refute_predicate @file, :exist?
end
+
+ def test_complains_on_failure
+ Utils.expects(:popen_read => "foo")
+ ARGV.stubs(:verbose? => true)
+ out, _err = capture_io do
+ assert_raises(ErrorDuringExecution) { @sandbox.exec "false" }
+ end
+ assert_match "foo", out
+ end
+
+ def test_ignores_bogus_python_error
+ with_bogus_error = <<-EOS.undent
+ foo
+ Mar 17 02:55:06 sandboxd[342]: Python(49765) deny file-write-unlink /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/errors.pyc
+ bar
+ EOS
+ Utils.expects(:popen_read => with_bogus_error)
+ ARGV.stubs(:verbose? => true)
+ out, _err = capture_io do
+ assert_raises(ErrorDuringExecution) { @sandbox.exec "false" }
+ end
+ refute_predicate out, :empty?
+ assert_match "foo", out
+ assert_match "bar", out
+ refute_match "Python", out
+ end
end | 26 | 0.928571 | 26 | 0 |
150e338b7d2793c434d7e2f21aef061f35634476 | openspending/test/__init__.py | openspending/test/__init__.py |
import os
import sys
from paste.deploy import appconfig
from openspending import mongo
from helpers import clean_all
__all__ = ['TestCase', 'DatabaseTestCase']
here_dir = os.getcwd()
config = appconfig('config:test.ini', relative_to=here_dir)
mongo.configure(config)
class TestCase(object):
def setup(self):
pass
def teardown(self):
pass
class DatabaseTestCase(TestCase):
def teardown(self):
clean_all()
super(DatabaseTestCase, self).teardown() |
import os
import sys
from pylons import config
from openspending import mongo
from .helpers import clean_all
__all__ = ['TestCase', 'DatabaseTestCase']
mongo.configure(config)
class TestCase(object):
def setup(self):
pass
def teardown(self):
pass
class DatabaseTestCase(TestCase):
def teardown(self):
clean_all()
super(DatabaseTestCase, self).teardown() | Use config given on command line | Use config given on command line
| Python | agpl-3.0 | pudo/spendb,openspending/spendb,openspending/spendb,nathanhilbert/FPA_Core,pudo/spendb,johnjohndoe/spendb,CivicVision/datahub,USStateDept/FPA_Core,johnjohndoe/spendb,USStateDept/FPA_Core,CivicVision/datahub,nathanhilbert/FPA_Core,johnjohndoe/spendb,openspending/spendb,USStateDept/FPA_Core,spendb/spendb,nathanhilbert/FPA_Core,spendb/spendb,pudo/spendb,spendb/spendb,CivicVision/datahub | python | ## Code Before:
import os
import sys
from paste.deploy import appconfig
from openspending import mongo
from helpers import clean_all
__all__ = ['TestCase', 'DatabaseTestCase']
here_dir = os.getcwd()
config = appconfig('config:test.ini', relative_to=here_dir)
mongo.configure(config)
class TestCase(object):
def setup(self):
pass
def teardown(self):
pass
class DatabaseTestCase(TestCase):
def teardown(self):
clean_all()
super(DatabaseTestCase, self).teardown()
## Instruction:
Use config given on command line
## Code After:
import os
import sys
from pylons import config
from openspending import mongo
from .helpers import clean_all
__all__ = ['TestCase', 'DatabaseTestCase']
mongo.configure(config)
class TestCase(object):
def setup(self):
pass
def teardown(self):
pass
class DatabaseTestCase(TestCase):
def teardown(self):
clean_all()
super(DatabaseTestCase, self).teardown() |
import os
import sys
- from paste.deploy import appconfig
+ from pylons import config
from openspending import mongo
- from helpers import clean_all
+ from .helpers import clean_all
? +
__all__ = ['TestCase', 'DatabaseTestCase']
- here_dir = os.getcwd()
- config = appconfig('config:test.ini', relative_to=here_dir)
mongo.configure(config)
class TestCase(object):
def setup(self):
pass
def teardown(self):
pass
class DatabaseTestCase(TestCase):
def teardown(self):
clean_all()
super(DatabaseTestCase, self).teardown() | 6 | 0.230769 | 2 | 4 |
b32c999ea59c7e76e6f7c82095c2a6a2961de0a1 | src/mural/AppViewController.cc | src/mural/AppViewController.cc |
namespace mural
{
AppViewController::~AppViewController()
{
delete this->view;
}
void AppViewController::initWithScriptAtPath(const char *path, int width, int height, const char *title)
{
this->view = new JavaScriptView(width, height, title);
this->view->loadScriptAtPath(path);
this->view->startRunning();
}
}
|
// #include <thread>
namespace mural
{
AppViewController::~AppViewController()
{
delete this->view;
}
void AppViewController::initWithScriptAtPath(const char *path, int width, int height, const char *title)
{
this->view = new JavaScriptView(width, height, title);
this->view->loadScriptAtPath(path);
// Test MuOperationQueue
// this->view->backgroundQueue.addOperation([] {
// printf("[Test]: Operation 'A' starts running, this should be long (1000ms)\n");
// std::this_thread::sleep_for(std::chrono::milliseconds(1000));
// printf("[Test]: Operation 'A' finished\n");
// });
// this->view->backgroundQueue.addOperation([] {
// printf("[Test]: Operation 'B' just fired\n");
// });
this->view->startRunning();
}
}
| Add some simple tests to check whether the operation-queue works | Add some simple tests to check whether the operation-queue works
| C++ | mit | pixelpicosean/Mural-Deprecated,pixelpicosean/Mural-Deprecated,pixelpicosean/Mural-Deprecated,pixelpicosean/Mural-Deprecated,pixelpicosean/Mural-Deprecated | c++ | ## Code Before:
namespace mural
{
AppViewController::~AppViewController()
{
delete this->view;
}
void AppViewController::initWithScriptAtPath(const char *path, int width, int height, const char *title)
{
this->view = new JavaScriptView(width, height, title);
this->view->loadScriptAtPath(path);
this->view->startRunning();
}
}
## Instruction:
Add some simple tests to check whether the operation-queue works
## Code After:
// #include <thread>
namespace mural
{
AppViewController::~AppViewController()
{
delete this->view;
}
void AppViewController::initWithScriptAtPath(const char *path, int width, int height, const char *title)
{
this->view = new JavaScriptView(width, height, title);
this->view->loadScriptAtPath(path);
// Test MuOperationQueue
// this->view->backgroundQueue.addOperation([] {
// printf("[Test]: Operation 'A' starts running, this should be long (1000ms)\n");
// std::this_thread::sleep_for(std::chrono::milliseconds(1000));
// printf("[Test]: Operation 'A' finished\n");
// });
// this->view->backgroundQueue.addOperation([] {
// printf("[Test]: Operation 'B' just fired\n");
// });
this->view->startRunning();
}
}
| +
+ // #include <thread>
namespace mural
{
AppViewController::~AppViewController()
{
delete this->view;
}
void AppViewController::initWithScriptAtPath(const char *path, int width, int height, const char *title)
{
this->view = new JavaScriptView(width, height, title);
this->view->loadScriptAtPath(path);
+ // Test MuOperationQueue
+ // this->view->backgroundQueue.addOperation([] {
+ // printf("[Test]: Operation 'A' starts running, this should be long (1000ms)\n");
+ // std::this_thread::sleep_for(std::chrono::milliseconds(1000));
+ // printf("[Test]: Operation 'A' finished\n");
+ // });
+ // this->view->backgroundQueue.addOperation([] {
+ // printf("[Test]: Operation 'B' just fired\n");
+ // });
this->view->startRunning();
}
} | 11 | 0.647059 | 11 | 0 |
9bb89c59c2f596942a07733cc2b5e59733edb784 | README.md | README.md |
This is the React comment box example from [the React tutorial](http://facebook.github.io/react/docs/tutorial.html).
## To use
There are several simple server implementations included. They all serve static files from `public/` and handle requests to `comments.json` to fetch or add data. Start a server with one of the following:
### Node
```sh
npm install
node server.js
```
### Python
```sh
python server.py
```
### Ruby
```sh
ruby server.rb
```
And visit <http://localhost:3000/>. Try opening multiple tabs!
|
This is the React comment box example from [the React tutorial](http://facebook.github.io/react/docs/tutorial.html).
## To use
There are several simple server implementations included. They all serve static files from `public/` and handle requests to `comments.json` to fetch or add data. Start a server with one of the following:
### Node
```sh
npm install
node server.js
```
### Python
```sh
python server.py
```
### Ruby
```sh
ruby server.rb
```
### PHP
```sh
php -S localhost:3000 -t public/ server.php
```
And visit <http://localhost:3000/>. Try opening multiple tabs!
| Update readme with info about starting the php server | Update readme with info about starting the php server
| Markdown | mit | nfelix/primeNameChecker,lewiscowper/serviceworker-demo,nfelix/primeNameChecker,Capocaccia/reacting,nicrocs/react-form-builder,Capocaccia/reacting,lewiscowper/serviceworker-demo,nicrocs/react-form-builder | markdown | ## Code Before:
This is the React comment box example from [the React tutorial](http://facebook.github.io/react/docs/tutorial.html).
## To use
There are several simple server implementations included. They all serve static files from `public/` and handle requests to `comments.json` to fetch or add data. Start a server with one of the following:
### Node
```sh
npm install
node server.js
```
### Python
```sh
python server.py
```
### Ruby
```sh
ruby server.rb
```
And visit <http://localhost:3000/>. Try opening multiple tabs!
## Instruction:
Update readme with info about starting the php server
## Code After:
This is the React comment box example from [the React tutorial](http://facebook.github.io/react/docs/tutorial.html).
## To use
There are several simple server implementations included. They all serve static files from `public/` and handle requests to `comments.json` to fetch or add data. Start a server with one of the following:
### Node
```sh
npm install
node server.js
```
### Python
```sh
python server.py
```
### Ruby
```sh
ruby server.rb
```
### PHP
```sh
php -S localhost:3000 -t public/ server.php
```
And visit <http://localhost:3000/>. Try opening multiple tabs!
|
This is the React comment box example from [the React tutorial](http://facebook.github.io/react/docs/tutorial.html).
## To use
There are several simple server implementations included. They all serve static files from `public/` and handle requests to `comments.json` to fetch or add data. Start a server with one of the following:
### Node
```sh
npm install
node server.js
```
### Python
```sh
python server.py
```
### Ruby
```sh
ruby server.rb
```
+ ### PHP
+ ```sh
+ php -S localhost:3000 -t public/ server.php
+ ```
+
And visit <http://localhost:3000/>. Try opening multiple tabs! | 5 | 0.192308 | 5 | 0 |
c811f5240ad6b7cf4ab8f3c06d1b18f5fb9b6463 | client/templates/notifications/notifications.js | client/templates/notifications/notifications.js | Template.notifications.helpers({
notifications: function() {
return Notifications.find({ userId: Meteor.userId() });
},
notificationCount: function() {
return Notifications.find({ userId: Meteor.userId() }).count();
}
});
Template.notifications.events({
});
| Template.notifications.helpers({
notifications: function() {
return Notifications.find({ userId: Meteor.userId() });
},
notificationCount: function() {
return Notifications.find({ userId: Meteor.userId() }).count();
}
});
Template.notifications.events({
'click #accept-button': function (e) {
var self = this;
var request = {
userId: self.userId,
requestingUserId: self.requestingUserId,
requestId: self.extraFields.requestId,
projectId: self.extraFields.projectId,
notificationId: self._id
};
Meteor.call('addUserToProject', request, function(err, result) {
if (err) {
console.log(err.reason);
}
});
}
});
| Add click event to accept request | Add click event to accept request
| JavaScript | mit | PUMATeam/puma,PUMATeam/puma | javascript | ## Code Before:
Template.notifications.helpers({
notifications: function() {
return Notifications.find({ userId: Meteor.userId() });
},
notificationCount: function() {
return Notifications.find({ userId: Meteor.userId() }).count();
}
});
Template.notifications.events({
});
## Instruction:
Add click event to accept request
## Code After:
Template.notifications.helpers({
notifications: function() {
return Notifications.find({ userId: Meteor.userId() });
},
notificationCount: function() {
return Notifications.find({ userId: Meteor.userId() }).count();
}
});
Template.notifications.events({
'click #accept-button': function (e) {
var self = this;
var request = {
userId: self.userId,
requestingUserId: self.requestingUserId,
requestId: self.extraFields.requestId,
projectId: self.extraFields.projectId,
notificationId: self._id
};
Meteor.call('addUserToProject', request, function(err, result) {
if (err) {
console.log(err.reason);
}
});
}
});
| Template.notifications.helpers({
notifications: function() {
return Notifications.find({ userId: Meteor.userId() });
},
notificationCount: function() {
return Notifications.find({ userId: Meteor.userId() }).count();
}
});
Template.notifications.events({
+ 'click #accept-button': function (e) {
+ var self = this;
+ var request = {
+ userId: self.userId,
+ requestingUserId: self.requestingUserId,
+ requestId: self.extraFields.requestId,
+ projectId: self.extraFields.projectId,
+ notificationId: self._id
+ };
+
+ Meteor.call('addUserToProject', request, function(err, result) {
+ if (err) {
+ console.log(err.reason);
+ }
+ });
+ }
}); | 16 | 1.333333 | 16 | 0 |
496373e97d1e7ed1bb84e4eafd64ed8de722c22b | www/sponsors.html | www/sponsors.html | <html>
<head>
<title>Emulab.Net - Sponsors</title>
<link rel='stylesheet' href='tbstyle-plain.css' type='text/css'>
</head>
<body>
<basefont size=4>
<center>
<h1>
Emulab Sponsors
</h1>
</center>
<p>
We are grateful to the following companies and organizations for
helping to support the network testbed.
<ul>
<li> <a href = "http://www.nsf.gov/">The National Science Foundation</a>
<li> <a href = "http://www.cisco.com/">Cisco Systems</a>
<li> <a href = "http://www.research.utah.edu/">The University of Utah</a>
<li> <a href = "http://www.compaq.com/">Compaq</a>,
especially Compaq SRC and WRL.
<li> <a href = "http://www.darpa.mil/ito/research/anets/">
DARPA/ITO Active Networks program</a>
<li> <a href = "http://www.intel.com/">Intel Network Communications Group</a>
<li> <a href = "http://www.novell.com/">Novell</a>
<li> <a href = "http://www.nortel.com/">Nortel Networks</a>
</ul>
| <html>
<head>
<title>Emulab.Net - Sponsors</title>
<link rel='stylesheet' href='tbstyle-plain.css' type='text/css'>
</head>
<body>
<basefont size=4>
<center>
<h1>
Emulab Sponsors
</h1>
</center>
<p>
We are grateful to the following companies and organizations for
helping to support the network testbed.
<ul>
<li> <a href = "http://www.nsf.gov/">The National Science Foundation</a>
<li> <a href = "http://www.cisco.com/">Cisco Systems</a>
<li> <a href = "http://www.research.utah.edu/">The University of Utah</a>
<li> <a href = "http://www.compaq.com/">Compaq</a>,
especially Compaq SRC and WRL.
<li> <a href = "http://www.darpa.mil/ito/research/anets/">
DARPA/ITO Active Networks program</a>
<li> <a href = "http://www.intel.com/">Intel Network Communications Group</a>
<li> <a href = "http://research.microsoft.com/">Microsoft Research</a>
<li> <a href = "http://www.novell.com/">Novell</a>
<li> <a href = "http://www.nortel.com/">Nortel Networks</a>
</ul>
| Add MSR; they finally came thru with the check. | Add MSR; they finally came thru with the check.
| HTML | agpl-3.0 | nmc-probe/emulab-nome,nmc-probe/emulab-nome,nmc-probe/emulab-nome,nmc-probe/emulab-nome,nmc-probe/emulab-nome,nmc-probe/emulab-nome,nmc-probe/emulab-nome,nmc-probe/emulab-nome,nmc-probe/emulab-nome,nmc-probe/emulab-nome,nmc-probe/emulab-nome | html | ## Code Before:
<html>
<head>
<title>Emulab.Net - Sponsors</title>
<link rel='stylesheet' href='tbstyle-plain.css' type='text/css'>
</head>
<body>
<basefont size=4>
<center>
<h1>
Emulab Sponsors
</h1>
</center>
<p>
We are grateful to the following companies and organizations for
helping to support the network testbed.
<ul>
<li> <a href = "http://www.nsf.gov/">The National Science Foundation</a>
<li> <a href = "http://www.cisco.com/">Cisco Systems</a>
<li> <a href = "http://www.research.utah.edu/">The University of Utah</a>
<li> <a href = "http://www.compaq.com/">Compaq</a>,
especially Compaq SRC and WRL.
<li> <a href = "http://www.darpa.mil/ito/research/anets/">
DARPA/ITO Active Networks program</a>
<li> <a href = "http://www.intel.com/">Intel Network Communications Group</a>
<li> <a href = "http://www.novell.com/">Novell</a>
<li> <a href = "http://www.nortel.com/">Nortel Networks</a>
</ul>
## Instruction:
Add MSR; they finally came thru with the check.
## Code After:
<html>
<head>
<title>Emulab.Net - Sponsors</title>
<link rel='stylesheet' href='tbstyle-plain.css' type='text/css'>
</head>
<body>
<basefont size=4>
<center>
<h1>
Emulab Sponsors
</h1>
</center>
<p>
We are grateful to the following companies and organizations for
helping to support the network testbed.
<ul>
<li> <a href = "http://www.nsf.gov/">The National Science Foundation</a>
<li> <a href = "http://www.cisco.com/">Cisco Systems</a>
<li> <a href = "http://www.research.utah.edu/">The University of Utah</a>
<li> <a href = "http://www.compaq.com/">Compaq</a>,
especially Compaq SRC and WRL.
<li> <a href = "http://www.darpa.mil/ito/research/anets/">
DARPA/ITO Active Networks program</a>
<li> <a href = "http://www.intel.com/">Intel Network Communications Group</a>
<li> <a href = "http://research.microsoft.com/">Microsoft Research</a>
<li> <a href = "http://www.novell.com/">Novell</a>
<li> <a href = "http://www.nortel.com/">Nortel Networks</a>
</ul>
| <html>
<head>
<title>Emulab.Net - Sponsors</title>
<link rel='stylesheet' href='tbstyle-plain.css' type='text/css'>
</head>
<body>
<basefont size=4>
<center>
<h1>
Emulab Sponsors
</h1>
</center>
<p>
We are grateful to the following companies and organizations for
helping to support the network testbed.
<ul>
<li> <a href = "http://www.nsf.gov/">The National Science Foundation</a>
<li> <a href = "http://www.cisco.com/">Cisco Systems</a>
<li> <a href = "http://www.research.utah.edu/">The University of Utah</a>
<li> <a href = "http://www.compaq.com/">Compaq</a>,
especially Compaq SRC and WRL.
<li> <a href = "http://www.darpa.mil/ito/research/anets/">
DARPA/ITO Active Networks program</a>
<li> <a href = "http://www.intel.com/">Intel Network Communications Group</a>
+ <li> <a href = "http://research.microsoft.com/">Microsoft Research</a>
<li> <a href = "http://www.novell.com/">Novell</a>
<li> <a href = "http://www.nortel.com/">Nortel Networks</a>
</ul> | 1 | 0.033333 | 1 | 0 |
bd890d4476aa90b3b7c59feae462edebd28db325 | lib/import_products/user_mailer_ext.rb | lib/import_products/user_mailer_ext.rb | module ImportProducts
module UserMailerExt
def self.included(base)
base.class_eval do
def product_import_results(user, error_message = nil)
@user = user
@error_message = error_message
attachment["import_products.log"] = File.read(ImportProductSettings::LOGFILE) if @error_message.nil?
mail(:to => @user.email, :subject => "Spree: Import Products #{error_message.nil? ? "Success" : "Failure"}")
end
end
end
end
end
| module ImportProducts
module UserMailerExt
def self.included(base)
base.class_eval do
def product_import_results(user, error_message = nil)
@user = user
@error_message = error_message
attachments["import_products.log"] = File.read(IMPORT_PRODUCT_SETTINGS[:log_to]) if @error_message.nil?
mail(:to => @user.email, :subject => "Spree: Import Products #{error_message.nil? ? "Success" : "Failure"}")
end
end
end
end
end
| Update mailer to use attachments[] instead of attachment[] | Update mailer to use attachments[] instead of attachment[]
| Ruby | bsd-3-clause | fonemstr/spree-import-products,fonemstr/spree-import-products,joshmcarthur/spree-import-products | ruby | ## Code Before:
module ImportProducts
module UserMailerExt
def self.included(base)
base.class_eval do
def product_import_results(user, error_message = nil)
@user = user
@error_message = error_message
attachment["import_products.log"] = File.read(ImportProductSettings::LOGFILE) if @error_message.nil?
mail(:to => @user.email, :subject => "Spree: Import Products #{error_message.nil? ? "Success" : "Failure"}")
end
end
end
end
end
## Instruction:
Update mailer to use attachments[] instead of attachment[]
## Code After:
module ImportProducts
module UserMailerExt
def self.included(base)
base.class_eval do
def product_import_results(user, error_message = nil)
@user = user
@error_message = error_message
attachments["import_products.log"] = File.read(IMPORT_PRODUCT_SETTINGS[:log_to]) if @error_message.nil?
mail(:to => @user.email, :subject => "Spree: Import Products #{error_message.nil? ? "Success" : "Failure"}")
end
end
end
end
end
| module ImportProducts
module UserMailerExt
def self.included(base)
base.class_eval do
def product_import_results(user, error_message = nil)
@user = user
@error_message = error_message
- attachment["import_products.log"] = File.read(ImportProductSettings::LOGFILE) if @error_message.nil?
? ^^ ^ -- ^^^^^^^^^^^^^^^^^^^^^
+ attachments["import_products.log"] = File.read(IMPORT_PRODUCT_SETTINGS[:log_to]) if @error_message.nil?
? + ^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^
mail(:to => @user.email, :subject => "Spree: Import Products #{error_message.nil? ? "Success" : "Failure"}")
end
end
end
end
end | 2 | 0.142857 | 1 | 1 |
2328de89d07a4040d9dc53f9ee75d7794498f204 | Apptentive/Apptentive/Misc/ApptentiveSafeCollections.h | Apptentive/Apptentive/Misc/ApptentiveSafeCollections.h | //
// ApptentiveSafeCollections.h
// Apptentive
//
// Created by Alex Lementuev on 3/20/17.
// Copyright © 2017 Apptentive, Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
/**
Returns non-nil value or NSNull
*/
id ApptentiveCollectionValue(id value);
/**
Safely adds key and value into the dictionary
*/
void ApptentiveDictionarySetKeyValue(NSMutableDictionary *dictionary, id<NSCopying> key, id value);
/**
Tries to add nullable value into the dictionary
*/
BOOL ApptentiveDictionaryTrySetKeyValue(NSMutableDictionary *dictionary, id<NSCopying> key, id value);
/**
Safely retrieves string from a dictionary (or returns nil if failed)
*/
NSString *ApptentiveDictionaryGetString(NSDictionary *dictionary, id<NSCopying> key);
/**
Safely retrieves array from a dictionary (or returns nil if failed)
*/
NSArray *ApptentiveDictionaryGetArray(NSDictionary *dictionary, id<NSCopying> key);
/**
Safely adds an object to the array.
*/
void ApptentiveArrayAddObject(NSMutableArray *array, id object);
NS_ASSUME_NONNULL_END
| //
// ApptentiveSafeCollections.h
// Apptentive
//
// Created by Alex Lementuev on 3/20/17.
// Copyright © 2017 Apptentive, Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
/**
Returns non-nil value or NSNull
*/
id ApptentiveCollectionValue(id value);
/**
Safely adds key and value into the dictionary
*/
void ApptentiveDictionarySetKeyValue(NSMutableDictionary *dictionary, id<NSCopying> key, id value);
/**
Tries to add nullable value into the dictionary
*/
BOOL ApptentiveDictionaryTrySetKeyValue(NSMutableDictionary *dictionary, id<NSCopying> key, id value);
/**
Safely retrieves string from a dictionary (or returns nil if failed)
*/
NSString * _Nullable ApptentiveDictionaryGetString (NSDictionary *dictionary, id<NSCopying> key);
/**
Safely retrieves array from a dictionary (or returns nil if failed)
*/
NSArray * _Nullable ApptentiveDictionaryGetArray(NSDictionary *dictionary, id<NSCopying> key);
/**
Safely adds an object to the array.
*/
void ApptentiveArrayAddObject(NSMutableArray *array, id object);
NS_ASSUME_NONNULL_END
| Add nullable flag to ApptentiveDictionaryGetArray and -String | Add nullable flag to ApptentiveDictionaryGetArray and -String
| C | bsd-3-clause | apptentive/apptentive-ios,apptentive/apptentive-ios,apptentive/apptentive-ios | c | ## Code Before:
//
// ApptentiveSafeCollections.h
// Apptentive
//
// Created by Alex Lementuev on 3/20/17.
// Copyright © 2017 Apptentive, Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
/**
Returns non-nil value or NSNull
*/
id ApptentiveCollectionValue(id value);
/**
Safely adds key and value into the dictionary
*/
void ApptentiveDictionarySetKeyValue(NSMutableDictionary *dictionary, id<NSCopying> key, id value);
/**
Tries to add nullable value into the dictionary
*/
BOOL ApptentiveDictionaryTrySetKeyValue(NSMutableDictionary *dictionary, id<NSCopying> key, id value);
/**
Safely retrieves string from a dictionary (or returns nil if failed)
*/
NSString *ApptentiveDictionaryGetString(NSDictionary *dictionary, id<NSCopying> key);
/**
Safely retrieves array from a dictionary (or returns nil if failed)
*/
NSArray *ApptentiveDictionaryGetArray(NSDictionary *dictionary, id<NSCopying> key);
/**
Safely adds an object to the array.
*/
void ApptentiveArrayAddObject(NSMutableArray *array, id object);
NS_ASSUME_NONNULL_END
## Instruction:
Add nullable flag to ApptentiveDictionaryGetArray and -String
## Code After:
//
// ApptentiveSafeCollections.h
// Apptentive
//
// Created by Alex Lementuev on 3/20/17.
// Copyright © 2017 Apptentive, Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
/**
Returns non-nil value or NSNull
*/
id ApptentiveCollectionValue(id value);
/**
Safely adds key and value into the dictionary
*/
void ApptentiveDictionarySetKeyValue(NSMutableDictionary *dictionary, id<NSCopying> key, id value);
/**
Tries to add nullable value into the dictionary
*/
BOOL ApptentiveDictionaryTrySetKeyValue(NSMutableDictionary *dictionary, id<NSCopying> key, id value);
/**
Safely retrieves string from a dictionary (or returns nil if failed)
*/
NSString * _Nullable ApptentiveDictionaryGetString (NSDictionary *dictionary, id<NSCopying> key);
/**
Safely retrieves array from a dictionary (or returns nil if failed)
*/
NSArray * _Nullable ApptentiveDictionaryGetArray(NSDictionary *dictionary, id<NSCopying> key);
/**
Safely adds an object to the array.
*/
void ApptentiveArrayAddObject(NSMutableArray *array, id object);
NS_ASSUME_NONNULL_END
| //
// ApptentiveSafeCollections.h
// Apptentive
//
// Created by Alex Lementuev on 3/20/17.
// Copyright © 2017 Apptentive, Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
/**
Returns non-nil value or NSNull
*/
id ApptentiveCollectionValue(id value);
/**
Safely adds key and value into the dictionary
*/
void ApptentiveDictionarySetKeyValue(NSMutableDictionary *dictionary, id<NSCopying> key, id value);
/**
Tries to add nullable value into the dictionary
*/
BOOL ApptentiveDictionaryTrySetKeyValue(NSMutableDictionary *dictionary, id<NSCopying> key, id value);
/**
Safely retrieves string from a dictionary (or returns nil if failed)
*/
- NSString *ApptentiveDictionaryGetString(NSDictionary *dictionary, id<NSCopying> key);
+ NSString * _Nullable ApptentiveDictionaryGetString (NSDictionary *dictionary, id<NSCopying> key);
? +++++++++++ +
/**
Safely retrieves array from a dictionary (or returns nil if failed)
*/
- NSArray *ApptentiveDictionaryGetArray(NSDictionary *dictionary, id<NSCopying> key);
+ NSArray * _Nullable ApptentiveDictionaryGetArray(NSDictionary *dictionary, id<NSCopying> key);
? +++++++++++
/**
Safely adds an object to the array.
*/
void ApptentiveArrayAddObject(NSMutableArray *array, id object);
NS_ASSUME_NONNULL_END | 4 | 0.093023 | 2 | 2 |
0aff1976ef4f4f23c12db54afde98ad793e34512 | Casks/apns-pusher.rb | Casks/apns-pusher.rb | cask :v1 => 'apns-pusher' do
version '2.3'
sha256 '6aa54050bea8603b45e6737bf2cc6997180b1a58f1d02095f5141176a1335205'
url "https://github.com/blommegard/APNS-Pusher/releases/download/v#{version}/APNS.Pusher.app.zip"
appcast 'https://github.com/blommegard/APNS-Pusher/releases.atom'
name 'APNS Pusher'
homepage 'https://github.com/blommegard/APNS-Pusher'
license :mit
app 'APNS Pusher.app'
end
| cask :v1 => 'apns-pusher' do
version '2.3'
sha256 '6aa54050bea8603b45e6737bf2cc6997180b1a58f1d02095f5141176a1335205'
url "https://github.com/KnuffApp/APNS-Pusher/releases/download/v#{version}/APNS.Pusher.app.zip"
appcast 'https://github.com/KnuffApp/APNS-Pusher/releases.atom'
name 'APNS Pusher'
homepage 'https://github.com/KnuffApp/APNS-Pusher'
license :mit
app 'APNS Pusher.app'
end
| Fix the URLs of APNS Pusher | Fix the URLs of APNS Pusher
| Ruby | bsd-2-clause | lcasey001/homebrew-cask,BahtiyarB/homebrew-cask,sanyer/homebrew-cask,fanquake/homebrew-cask,nshemonsky/homebrew-cask,sjackman/homebrew-cask,jellyfishcoder/homebrew-cask,esebastian/homebrew-cask,slack4u/homebrew-cask,kpearson/homebrew-cask,vitorgalvao/homebrew-cask,MoOx/homebrew-cask,KosherBacon/homebrew-cask,kteru/homebrew-cask,mauricerkelly/homebrew-cask,julionc/homebrew-cask,claui/homebrew-cask,mazehall/homebrew-cask,Amorymeltzer/homebrew-cask,tolbkni/homebrew-cask,MichaelPei/homebrew-cask,albertico/homebrew-cask,deanmorin/homebrew-cask,mlocher/homebrew-cask,miku/homebrew-cask,vigosan/homebrew-cask,imgarylai/homebrew-cask,julionc/homebrew-cask,seanorama/homebrew-cask,FinalDes/homebrew-cask,reitermarkus/homebrew-cask,shorshe/homebrew-cask,lcasey001/homebrew-cask,andrewdisley/homebrew-cask,colindean/homebrew-cask,alebcay/homebrew-cask,greg5green/homebrew-cask,dictcp/homebrew-cask,moimikey/homebrew-cask,BenjaminHCCarr/homebrew-cask,mingzhi22/homebrew-cask,santoshsahoo/homebrew-cask,yumitsu/homebrew-cask,shorshe/homebrew-cask,jgarber623/homebrew-cask,SentinelWarren/homebrew-cask,JikkuJose/homebrew-cask,pacav69/homebrew-cask,bdhess/homebrew-cask,jeroenj/homebrew-cask,MerelyAPseudonym/homebrew-cask,reelsense/homebrew-cask,mariusbutuc/homebrew-cask,elyscape/homebrew-cask,dwihn0r/homebrew-cask,guerrero/homebrew-cask,ptb/homebrew-cask,kTitan/homebrew-cask,axodys/homebrew-cask,miccal/homebrew-cask,riyad/homebrew-cask,winkelsdorf/homebrew-cask,tsparber/homebrew-cask,Ngrd/homebrew-cask,optikfluffel/homebrew-cask,jasmas/homebrew-cask,stephenwade/homebrew-cask,tarwich/homebrew-cask,CameronGarrett/homebrew-cask,imgarylai/homebrew-cask,troyxmccall/homebrew-cask,usami-k/homebrew-cask,drostron/homebrew-cask,jbeagley52/homebrew-cask,tangestani/homebrew-cask,miku/homebrew-cask,diguage/homebrew-cask,athrunsun/homebrew-cask,nightscape/homebrew-cask,ksato9700/homebrew-cask,toonetown/homebrew-cask,okket/homebrew-cask,gmkey/homebrew-cask,johnjelinek/homebrew-cask,JosephViolago/homebrew-cask,RJHsiao/homebrew-cask,exherb/homebrew-cask,mchlrmrz/homebrew-cask,hyuna917/homebrew-cask,FredLackeyOfficial/homebrew-cask,ftiff/homebrew-cask,casidiablo/homebrew-cask,optikfluffel/homebrew-cask,claui/homebrew-cask,yutarody/homebrew-cask,mahori/homebrew-cask,sanyer/homebrew-cask,onlynone/homebrew-cask,cprecioso/homebrew-cask,xight/homebrew-cask,n8henrie/homebrew-cask,elyscape/homebrew-cask,bosr/homebrew-cask,alebcay/homebrew-cask,hellosky806/homebrew-cask,neverfox/homebrew-cask,feigaochn/homebrew-cask,retbrown/homebrew-cask,artdevjs/homebrew-cask,xight/homebrew-cask,goxberry/homebrew-cask,moogar0880/homebrew-cask,joshka/homebrew-cask,dieterdemeyer/homebrew-cask,inz/homebrew-cask,antogg/homebrew-cask,kiliankoe/homebrew-cask,robertgzr/homebrew-cask,samnung/homebrew-cask,JacopKane/homebrew-cask,usami-k/homebrew-cask,linc01n/homebrew-cask,My2ndAngelic/homebrew-cask,a1russell/homebrew-cask,jaredsampson/homebrew-cask,gyndav/homebrew-cask,mrmachine/homebrew-cask,mchlrmrz/homebrew-cask,a1russell/homebrew-cask,lantrix/homebrew-cask,forevergenin/homebrew-cask,mathbunnyru/homebrew-cask,julionc/homebrew-cask,moimikey/homebrew-cask,sanyer/homebrew-cask,jhowtan/homebrew-cask,brianshumate/homebrew-cask,BenjaminHCCarr/homebrew-cask,lumaxis/homebrew-cask,m3nu/homebrew-cask,gabrielizaias/homebrew-cask,retrography/homebrew-cask,markthetech/homebrew-cask,daften/homebrew-cask,xyb/homebrew-cask,haha1903/homebrew-cask,mishari/homebrew-cask,hovancik/homebrew-cask,wickedsp1d3r/homebrew-cask,amatos/homebrew-cask,wmorin/homebrew-cask,Ibuprofen/homebrew-cask,y00rb/homebrew-cask,joschi/homebrew-cask,sjackman/homebrew-cask,m3nu/homebrew-cask,nrlquaker/homebrew-cask,syscrusher/homebrew-cask,mrmachine/homebrew-cask,patresi/homebrew-cask,janlugt/homebrew-cask,albertico/homebrew-cask,gibsjose/homebrew-cask,muan/homebrew-cask,0xadada/homebrew-cask,fharbe/homebrew-cask,Gasol/homebrew-cask,tjnycum/homebrew-cask,michelegera/homebrew-cask,alexg0/homebrew-cask,JosephViolago/homebrew-cask,uetchy/homebrew-cask,lifepillar/homebrew-cask,alexg0/homebrew-cask,winkelsdorf/homebrew-cask,yurikoles/homebrew-cask,jppelteret/homebrew-cask,santoshsahoo/homebrew-cask,inta/homebrew-cask,jawshooah/homebrew-cask,13k/homebrew-cask,ericbn/homebrew-cask,scribblemaniac/homebrew-cask,vin047/homebrew-cask,xight/homebrew-cask,andyli/homebrew-cask,MerelyAPseudonym/homebrew-cask,jedahan/homebrew-cask,xcezx/homebrew-cask,cblecker/homebrew-cask,diguage/homebrew-cask,Saklad5/homebrew-cask,mattrobenolt/homebrew-cask,dieterdemeyer/homebrew-cask,jayshao/homebrew-cask,bric3/homebrew-cask,sohtsuka/homebrew-cask,fkrone/homebrew-cask,phpwutz/homebrew-cask,Gasol/homebrew-cask,markhuber/homebrew-cask,Ketouem/homebrew-cask,klane/homebrew-cask,n0ts/homebrew-cask,mazehall/homebrew-cask,Ephemera/homebrew-cask,mchlrmrz/homebrew-cask,jppelteret/homebrew-cask,anbotero/homebrew-cask,kingthorin/homebrew-cask,zmwangx/homebrew-cask,arronmabrey/homebrew-cask,chadcatlett/caskroom-homebrew-cask,kteru/homebrew-cask,crzrcn/homebrew-cask,hanxue/caskroom,seanzxx/homebrew-cask,ericbn/homebrew-cask,perfide/homebrew-cask,joschi/homebrew-cask,FranklinChen/homebrew-cask,flaviocamilo/homebrew-cask,n0ts/homebrew-cask,SentinelWarren/homebrew-cask,mwean/homebrew-cask,0rax/homebrew-cask,farmerchris/homebrew-cask,FranklinChen/homebrew-cask,timsutton/homebrew-cask,nathanielvarona/homebrew-cask,puffdad/homebrew-cask,My2ndAngelic/homebrew-cask,yurikoles/homebrew-cask,toonetown/homebrew-cask,markthetech/homebrew-cask,mwean/homebrew-cask,gmkey/homebrew-cask,esebastian/homebrew-cask,malob/homebrew-cask,fkrone/homebrew-cask,tjnycum/homebrew-cask,MoOx/homebrew-cask,goxberry/homebrew-cask,cedwardsmedia/homebrew-cask,dustinblackman/homebrew-cask,kpearson/homebrew-cask,pacav69/homebrew-cask,skatsuta/homebrew-cask,stigkj/homebrew-caskroom-cask,coeligena/homebrew-customized,hristozov/homebrew-cask,aguynamedryan/homebrew-cask,KosherBacon/homebrew-cask,Saklad5/homebrew-cask,lucasmezencio/homebrew-cask,tyage/homebrew-cask,chrisfinazzo/homebrew-cask,rogeriopradoj/homebrew-cask,MichaelPei/homebrew-cask,shonjir/homebrew-cask,lukeadams/homebrew-cask,nightscape/homebrew-cask,yuhki50/homebrew-cask,moogar0880/homebrew-cask,squid314/homebrew-cask,jacobbednarz/homebrew-cask,MircoT/homebrew-cask,nathanielvarona/homebrew-cask,pablote/homebrew-cask,paour/homebrew-cask,winkelsdorf/homebrew-cask,adrianchia/homebrew-cask,shonjir/homebrew-cask,lantrix/homebrew-cask,samshadwell/homebrew-cask,cobyism/homebrew-cask,markhuber/homebrew-cask,blainesch/homebrew-cask,jeanregisser/homebrew-cask,ayohrling/homebrew-cask,helloIAmPau/homebrew-cask,reitermarkus/homebrew-cask,opsdev-ws/homebrew-cask,riyad/homebrew-cask,Amorymeltzer/homebrew-cask,nathancahill/homebrew-cask,tedski/homebrew-cask,leipert/homebrew-cask,nysthee/homebrew-cask,joshka/homebrew-cask,adrianchia/homebrew-cask,ftiff/homebrew-cask,koenrh/homebrew-cask,tmoreira2020/homebrew,danielbayley/homebrew-cask,wickedsp1d3r/homebrew-cask,zerrot/homebrew-cask,kassi/homebrew-cask,zerrot/homebrew-cask,tan9/homebrew-cask,elnappo/homebrew-cask,maxnordlund/homebrew-cask,elnappo/homebrew-cask,hanxue/caskroom,tangestani/homebrew-cask,napaxton/homebrew-cask,kronicd/homebrew-cask,kassi/homebrew-cask,dictcp/homebrew-cask,13k/homebrew-cask,mjdescy/homebrew-cask,jedahan/homebrew-cask,forevergenin/homebrew-cask,moimikey/homebrew-cask,malford/homebrew-cask,jalaziz/homebrew-cask,malob/homebrew-cask,ianyh/homebrew-cask,Dremora/homebrew-cask,imgarylai/homebrew-cask,sanchezm/homebrew-cask,mingzhi22/homebrew-cask,gerrymiller/homebrew-cask,renard/homebrew-cask,kongslund/homebrew-cask,jgarber623/homebrew-cask,jhowtan/homebrew-cask,joshka/homebrew-cask,sscotth/homebrew-cask,uetchy/homebrew-cask,Ephemera/homebrew-cask,jbeagley52/homebrew-cask,gilesdring/homebrew-cask,ywfwj2008/homebrew-cask,optikfluffel/homebrew-cask,crzrcn/homebrew-cask,hovancik/homebrew-cask,malob/homebrew-cask,Fedalto/homebrew-cask,cprecioso/homebrew-cask,BenjaminHCCarr/homebrew-cask,tarwich/homebrew-cask,jalaziz/homebrew-cask,theoriginalgri/homebrew-cask,michelegera/homebrew-cask,tedbundyjr/homebrew-cask,dwkns/homebrew-cask,6uclz1/homebrew-cask,rajiv/homebrew-cask,fly19890211/homebrew-cask,deiga/homebrew-cask,opsdev-ws/homebrew-cask,mhubig/homebrew-cask,0xadada/homebrew-cask,athrunsun/homebrew-cask,tjnycum/homebrew-cask,seanzxx/homebrew-cask,Bombenleger/homebrew-cask,dustinblackman/homebrew-cask,Fedalto/homebrew-cask,paour/homebrew-cask,kamilboratynski/homebrew-cask,gerrymiller/homebrew-cask,ddm/homebrew-cask,sohtsuka/homebrew-cask,jgarber623/homebrew-cask,stephenwade/homebrew-cask,johan/homebrew-cask,flaviocamilo/homebrew-cask,farmerchris/homebrew-cask,mjgardner/homebrew-cask,anbotero/homebrew-cask,stevehedrick/homebrew-cask,mgryszko/homebrew-cask,stonehippo/homebrew-cask,Bombenleger/homebrew-cask,diogodamiani/homebrew-cask,ericbn/homebrew-cask,wmorin/homebrew-cask,sgnh/homebrew-cask,ksylvan/homebrew-cask,johndbritton/homebrew-cask,jiashuw/homebrew-cask,larseggert/homebrew-cask,colindean/homebrew-cask,xtian/homebrew-cask,corbt/homebrew-cask,koenrh/homebrew-cask,feniix/homebrew-cask,jconley/homebrew-cask,BahtiyarB/homebrew-cask,phpwutz/homebrew-cask,xcezx/homebrew-cask,y00rb/homebrew-cask,jaredsampson/homebrew-cask,rickychilcott/homebrew-cask,shoichiaizawa/homebrew-cask,ianyh/homebrew-cask,englishm/homebrew-cask,JikkuJose/homebrew-cask,amatos/homebrew-cask,lvicentesanchez/homebrew-cask,robbiethegeek/homebrew-cask,wickles/homebrew-cask,sgnh/homebrew-cask,nathancahill/homebrew-cask,Ibuprofen/homebrew-cask,morganestes/homebrew-cask,kesara/homebrew-cask,jmeridth/homebrew-cask,gyndav/homebrew-cask,jonathanwiesel/homebrew-cask,dcondrey/homebrew-cask,JosephViolago/homebrew-cask,a1russell/homebrew-cask,ninjahoahong/homebrew-cask,Cottser/homebrew-cask,kiliankoe/homebrew-cask,chrisfinazzo/homebrew-cask,inz/homebrew-cask,jeanregisser/homebrew-cask,danielbayley/homebrew-cask,faun/homebrew-cask,johnjelinek/homebrew-cask,rogeriopradoj/homebrew-cask,dwihn0r/homebrew-cask,asbachb/homebrew-cask,kingthorin/homebrew-cask,josa42/homebrew-cask,robbiethegeek/homebrew-cask,codeurge/homebrew-cask,retbrown/homebrew-cask,blogabe/homebrew-cask,chuanxd/homebrew-cask,mjgardner/homebrew-cask,lumaxis/homebrew-cask,sscotth/homebrew-cask,howie/homebrew-cask,doits/homebrew-cask,sosedoff/homebrew-cask,mjdescy/homebrew-cask,cedwardsmedia/homebrew-cask,asins/homebrew-cask,bcomnes/homebrew-cask,josa42/homebrew-cask,morganestes/homebrew-cask,franklouwers/homebrew-cask,mariusbutuc/homebrew-cask,codeurge/homebrew-cask,deanmorin/homebrew-cask,0rax/homebrew-cask,RJHsiao/homebrew-cask,theoriginalgri/homebrew-cask,hakamadare/homebrew-cask,kingthorin/homebrew-cask,josa42/homebrew-cask,nshemonsky/homebrew-cask,Ketouem/homebrew-cask,rickychilcott/homebrew-cask,okket/homebrew-cask,renaudguerin/homebrew-cask,slack4u/homebrew-cask,stevehedrick/homebrew-cask,diogodamiani/homebrew-cask,brianshumate/homebrew-cask,timsutton/homebrew-cask,bric3/homebrew-cask,exherb/homebrew-cask,esebastian/homebrew-cask,reelsense/homebrew-cask,otaran/homebrew-cask,tmoreira2020/homebrew,hanxue/caskroom,colindunn/homebrew-cask,andrewdisley/homebrew-cask,tyage/homebrew-cask,kongslund/homebrew-cask,ywfwj2008/homebrew-cask,giannitm/homebrew-cask,n8henrie/homebrew-cask,inta/homebrew-cask,wickles/homebrew-cask,gerrypower/homebrew-cask,hellosky806/homebrew-cask,nathanielvarona/homebrew-cask,singingwolfboy/homebrew-cask,johan/homebrew-cask,lifepillar/homebrew-cask,stephenwade/homebrew-cask,blogabe/homebrew-cask,larseggert/homebrew-cask,alebcay/homebrew-cask,howie/homebrew-cask,boecko/homebrew-cask,yurikoles/homebrew-cask,renard/homebrew-cask,nathansgreen/homebrew-cask,mindriot101/homebrew-cask,mindriot101/homebrew-cask,jconley/homebrew-cask,colindunn/homebrew-cask,mauricerkelly/homebrew-cask,Labutin/homebrew-cask,yumitsu/homebrew-cask,schneidmaster/homebrew-cask,puffdad/homebrew-cask,mahori/homebrew-cask,gilesdring/homebrew-cask,tedbundyjr/homebrew-cask,singingwolfboy/homebrew-cask,corbt/homebrew-cask,nathansgreen/homebrew-cask,CameronGarrett/homebrew-cask,tolbkni/homebrew-cask,williamboman/homebrew-cask,kkdd/homebrew-cask,mathbunnyru/homebrew-cask,gurghet/homebrew-cask,miguelfrde/homebrew-cask,cblecker/homebrew-cask,jeroenj/homebrew-cask,kTitan/homebrew-cask,scribblemaniac/homebrew-cask,ptb/homebrew-cask,artdevjs/homebrew-cask,napaxton/homebrew-cask,mikem/homebrew-cask,guerrero/homebrew-cask,sscotth/homebrew-cask,pkq/homebrew-cask,rajiv/homebrew-cask,patresi/homebrew-cask,jmeridth/homebrew-cask,retrography/homebrew-cask,decrement/homebrew-cask,nrlquaker/homebrew-cask,tsparber/homebrew-cask,mikem/homebrew-cask,cblecker/homebrew-cask,thii/homebrew-cask,thehunmonkgroup/homebrew-cask,ldong/homebrew-cask,cliffcotino/homebrew-cask,Ephemera/homebrew-cask,xtian/homebrew-cask,jasmas/homebrew-cask,bric3/homebrew-cask,FredLackeyOfficial/homebrew-cask,stigkj/homebrew-caskroom-cask,fharbe/homebrew-cask,jacobbednarz/homebrew-cask,thehunmonkgroup/homebrew-cask,danielbayley/homebrew-cask,boydj/homebrew-cask,helloIAmPau/homebrew-cask,lukasbestle/homebrew-cask,pkq/homebrew-cask,thii/homebrew-cask,Dremora/homebrew-cask,williamboman/homebrew-cask,englishm/homebrew-cask,kkdd/homebrew-cask,AnastasiaSulyagina/homebrew-cask,dcondrey/homebrew-cask,caskroom/homebrew-cask,psibre/homebrew-cask,mlocher/homebrew-cask,hristozov/homebrew-cask,buo/homebrew-cask,faun/homebrew-cask,caskroom/homebrew-cask,asbachb/homebrew-cask,jawshooah/homebrew-cask,neverfox/homebrew-cask,cobyism/homebrew-cask,mathbunnyru/homebrew-cask,doits/homebrew-cask,Cottser/homebrew-cask,ayohrling/homebrew-cask,wKovacs64/homebrew-cask,JacopKane/homebrew-cask,scottsuch/homebrew-cask,wastrachan/homebrew-cask,devmynd/homebrew-cask,tjt263/homebrew-cask,wastrachan/homebrew-cask,afh/homebrew-cask,xakraz/homebrew-cask,dvdoliveira/homebrew-cask,cliffcotino/homebrew-cask,timsutton/homebrew-cask,tangestani/homebrew-cask,nysthee/homebrew-cask,Ngrd/homebrew-cask,scottsuch/homebrew-cask,rajiv/homebrew-cask,syscrusher/homebrew-cask,robertgzr/homebrew-cask,JacopKane/homebrew-cask,joschi/homebrew-cask,dvdoliveira/homebrew-cask,giannitm/homebrew-cask,onlynone/homebrew-cask,miguelfrde/homebrew-cask,neverfox/homebrew-cask,samdoran/homebrew-cask,vitorgalvao/homebrew-cask,otaran/homebrew-cask,victorpopkov/homebrew-cask,feigaochn/homebrew-cask,skatsuta/homebrew-cask,lukasbestle/homebrew-cask,lvicentesanchez/homebrew-cask,sosedoff/homebrew-cask,rogeriopradoj/homebrew-cask,leipert/homebrew-cask,dwkns/homebrew-cask,renaudguerin/homebrew-cask,antogg/homebrew-cask,deiga/homebrew-cask,gyndav/homebrew-cask,6uclz1/homebrew-cask,jonathanwiesel/homebrew-cask,Amorymeltzer/homebrew-cask,ahundt/homebrew-cask,arronmabrey/homebrew-cask,fanquake/homebrew-cask,chuanxd/homebrew-cask,tan9/homebrew-cask,Labutin/homebrew-cask,franklouwers/homebrew-cask,malford/homebrew-cask,bosr/homebrew-cask,haha1903/homebrew-cask,jeroenseegers/homebrew-cask,cobyism/homebrew-cask,hyuna917/homebrew-cask,ldong/homebrew-cask,bdhess/homebrew-cask,drostron/homebrew-cask,janlugt/homebrew-cask,ebraminio/homebrew-cask,xakraz/homebrew-cask,xyb/homebrew-cask,sanchezm/homebrew-cask,adrianchia/homebrew-cask,claui/homebrew-cask,hakamadare/homebrew-cask,chrisfinazzo/homebrew-cask,victorpopkov/homebrew-cask,gibsjose/homebrew-cask,jellyfishcoder/homebrew-cask,shoichiaizawa/homebrew-cask,pkq/homebrew-cask,singingwolfboy/homebrew-cask,dictcp/homebrew-cask,boydj/homebrew-cask,stonehippo/homebrew-cask,ddm/homebrew-cask,FinalDes/homebrew-cask,klane/homebrew-cask,andrewdisley/homebrew-cask,jiashuw/homebrew-cask,mishari/homebrew-cask,fly19890211/homebrew-cask,blainesch/homebrew-cask,kesara/homebrew-cask,zmwangx/homebrew-cask,decrement/homebrew-cask,jpmat296/homebrew-cask,scribblemaniac/homebrew-cask,maxnordlund/homebrew-cask,scottsuch/homebrew-cask,ksato9700/homebrew-cask,gurghet/homebrew-cask,jayshao/homebrew-cask,ebraminio/homebrew-cask,squid314/homebrew-cask,xyb/homebrew-cask,shoichiaizawa/homebrew-cask,m3nu/homebrew-cask,pablote/homebrew-cask,asins/homebrew-cask,reitermarkus/homebrew-cask,Keloran/homebrew-cask,paour/homebrew-cask,stonehippo/homebrew-cask,kronicd/homebrew-cask,kesara/homebrew-cask,lukeadams/homebrew-cask,thomanq/homebrew-cask,uetchy/homebrew-cask,lucasmezencio/homebrew-cask,coeligena/homebrew-customized,yutarody/homebrew-cask,AnastasiaSulyagina/homebrew-cask,buo/homebrew-cask,mahori/homebrew-cask,yuhki50/homebrew-cask,samnung/homebrew-cask,axodys/homebrew-cask,wKovacs64/homebrew-cask,jalaziz/homebrew-cask,vin047/homebrew-cask,deiga/homebrew-cask,samshadwell/homebrew-cask,jpmat296/homebrew-cask,gabrielizaias/homebrew-cask,boecko/homebrew-cask,antogg/homebrew-cask,johndbritton/homebrew-cask,sebcode/homebrew-cask,miccal/homebrew-cask,nrlquaker/homebrew-cask,afh/homebrew-cask,kamilboratynski/homebrew-cask,jangalinski/homebrew-cask,schneidmaster/homebrew-cask,chadcatlett/caskroom-homebrew-cask,vigosan/homebrew-cask,mgryszko/homebrew-cask,ninjahoahong/homebrew-cask,tjt263/homebrew-cask,mhubig/homebrew-cask,psibre/homebrew-cask,troyxmccall/homebrew-cask,blogabe/homebrew-cask,Keloran/homebrew-cask,seanorama/homebrew-cask,cfillion/homebrew-cask,shonjir/homebrew-cask,miccal/homebrew-cask,ksylvan/homebrew-cask,gerrypower/homebrew-cask,ahundt/homebrew-cask,linc01n/homebrew-cask,casidiablo/homebrew-cask,wmorin/homebrew-cask,mattrobenolt/homebrew-cask,devmynd/homebrew-cask,perfide/homebrew-cask,tedski/homebrew-cask,mattrobenolt/homebrew-cask,cfillion/homebrew-cask,bcomnes/homebrew-cask,jeroenseegers/homebrew-cask,mjgardner/homebrew-cask,thomanq/homebrew-cask,feniix/homebrew-cask,muan/homebrew-cask,aguynamedryan/homebrew-cask,jangalinski/homebrew-cask,greg5green/homebrew-cask,samdoran/homebrew-cask,yutarody/homebrew-cask,alexg0/homebrew-cask,MircoT/homebrew-cask,sebcode/homebrew-cask,daften/homebrew-cask,coeligena/homebrew-customized,andyli/homebrew-cask | ruby | ## Code Before:
cask :v1 => 'apns-pusher' do
version '2.3'
sha256 '6aa54050bea8603b45e6737bf2cc6997180b1a58f1d02095f5141176a1335205'
url "https://github.com/blommegard/APNS-Pusher/releases/download/v#{version}/APNS.Pusher.app.zip"
appcast 'https://github.com/blommegard/APNS-Pusher/releases.atom'
name 'APNS Pusher'
homepage 'https://github.com/blommegard/APNS-Pusher'
license :mit
app 'APNS Pusher.app'
end
## Instruction:
Fix the URLs of APNS Pusher
## Code After:
cask :v1 => 'apns-pusher' do
version '2.3'
sha256 '6aa54050bea8603b45e6737bf2cc6997180b1a58f1d02095f5141176a1335205'
url "https://github.com/KnuffApp/APNS-Pusher/releases/download/v#{version}/APNS.Pusher.app.zip"
appcast 'https://github.com/KnuffApp/APNS-Pusher/releases.atom'
name 'APNS Pusher'
homepage 'https://github.com/KnuffApp/APNS-Pusher'
license :mit
app 'APNS Pusher.app'
end
| cask :v1 => 'apns-pusher' do
version '2.3'
sha256 '6aa54050bea8603b45e6737bf2cc6997180b1a58f1d02095f5141176a1335205'
- url "https://github.com/blommegard/APNS-Pusher/releases/download/v#{version}/APNS.Pusher.app.zip"
? ^^^^^^^^^^
+ url "https://github.com/KnuffApp/APNS-Pusher/releases/download/v#{version}/APNS.Pusher.app.zip"
? ^^^^^^^^
- appcast 'https://github.com/blommegard/APNS-Pusher/releases.atom'
? ^^^^^^^^^^
+ appcast 'https://github.com/KnuffApp/APNS-Pusher/releases.atom'
? ^^^^^^^^
name 'APNS Pusher'
- homepage 'https://github.com/blommegard/APNS-Pusher'
? ^^^^^^^^^^
+ homepage 'https://github.com/KnuffApp/APNS-Pusher'
? ^^^^^^^^
license :mit
app 'APNS Pusher.app'
end | 6 | 0.5 | 3 | 3 |
730c73693386b384e9db51fc4f8aa4c993df0a40 | circle.yml | circle.yml | notify:
webhooks:
- url: http://requestb.in/1m81mf41 | notify:
webhooks:
- url: https://dockbit.com/webhooks/2f4beddc7744f5a9dee5eb047512d3043234af9e | Add Dockbit Circle CI integration | Add Dockbit Circle CI integration
| YAML | mit | Dockbit/demo-rails-capistrano,Dockbit/demo-rails-capistrano,Dockbit/demo-rails-capistrano,Dockbit/demo-rails-capistrano | yaml | ## Code Before:
notify:
webhooks:
- url: http://requestb.in/1m81mf41
## Instruction:
Add Dockbit Circle CI integration
## Code After:
notify:
webhooks:
- url: https://dockbit.com/webhooks/2f4beddc7744f5a9dee5eb047512d3043234af9e | notify:
webhooks:
- - url: http://requestb.in/1m81mf41
+ - url: https://dockbit.com/webhooks/2f4beddc7744f5a9dee5eb047512d3043234af9e | 2 | 0.666667 | 1 | 1 |
5bbdfb6d38878e2e1688fe37415662ec0dc176ee | sphinxcontrib/openstreetmap.py | sphinxcontrib/openstreetmap.py | from docutils import nodes
from docutils.parsers.rst import directives
from sphinx.util.compat import Directive
class openstreetmap(nodes.General, nodes.Element):
pass
class OpenStreetMapDirective(Directive):
"""Directive for embedding OpenStreetMap"""
has_content = False
option_spec = {
'id': directives.unchanged,
'label': directives.unchanged,
'marker': directives.unchanged,
}
def run(self):
node = openstreetmap()
return [node]
def visit_openstreetmap_node(self, node):
self.body.append("<div id='openstreetmap' style='color:red'>OpenStreetMap directive</div>")
def depart_openstreetmap_node(self, node):
pass
def setup(app):
app.add_node(openstreetmap,
html=(visit_openstreetmap_node, depart_openstreetmap_node))
app.add_directive('openstreetmap', OpenStreetMapDirective)
| from docutils import nodes
from docutils.parsers.rst import directives
from sphinx.util.compat import Directive
class openstreetmap(nodes.General, nodes.Element):
pass
class OpenStreetMapDirective(Directive):
"""Directive for embedding OpenStreetMap"""
has_content = False
option_spec = {
'id': directives.unchanged,
'label': directives.unchanged,
'marker': directives.unchanged,
}
def run(self):
node = openstreetmap()
if 'id' in self.options:
node['id'] = self.options['id']
else:
msg = ('openstreetmap directive needs uniqueue id for map data')
return [document.reporter.warning(msg, line=self.lineno)]
return [node]
def visit_openstreetmap_node(self, node):
self.body.append("<div id='openstreetmap' style='color:red'>OpenStreetMap directive</div>")
def depart_openstreetmap_node(self, node):
pass
def setup(app):
app.add_node(openstreetmap,
html=(visit_openstreetmap_node, depart_openstreetmap_node))
app.add_directive('openstreetmap', OpenStreetMapDirective)
| Check whether required id parameter is specified | Check whether required id parameter is specified
| Python | bsd-2-clause | kenhys/sphinxcontrib-openstreetmap,kenhys/sphinxcontrib-openstreetmap | python | ## Code Before:
from docutils import nodes
from docutils.parsers.rst import directives
from sphinx.util.compat import Directive
class openstreetmap(nodes.General, nodes.Element):
pass
class OpenStreetMapDirective(Directive):
"""Directive for embedding OpenStreetMap"""
has_content = False
option_spec = {
'id': directives.unchanged,
'label': directives.unchanged,
'marker': directives.unchanged,
}
def run(self):
node = openstreetmap()
return [node]
def visit_openstreetmap_node(self, node):
self.body.append("<div id='openstreetmap' style='color:red'>OpenStreetMap directive</div>")
def depart_openstreetmap_node(self, node):
pass
def setup(app):
app.add_node(openstreetmap,
html=(visit_openstreetmap_node, depart_openstreetmap_node))
app.add_directive('openstreetmap', OpenStreetMapDirective)
## Instruction:
Check whether required id parameter is specified
## Code After:
from docutils import nodes
from docutils.parsers.rst import directives
from sphinx.util.compat import Directive
class openstreetmap(nodes.General, nodes.Element):
pass
class OpenStreetMapDirective(Directive):
"""Directive for embedding OpenStreetMap"""
has_content = False
option_spec = {
'id': directives.unchanged,
'label': directives.unchanged,
'marker': directives.unchanged,
}
def run(self):
node = openstreetmap()
if 'id' in self.options:
node['id'] = self.options['id']
else:
msg = ('openstreetmap directive needs uniqueue id for map data')
return [document.reporter.warning(msg, line=self.lineno)]
return [node]
def visit_openstreetmap_node(self, node):
self.body.append("<div id='openstreetmap' style='color:red'>OpenStreetMap directive</div>")
def depart_openstreetmap_node(self, node):
pass
def setup(app):
app.add_node(openstreetmap,
html=(visit_openstreetmap_node, depart_openstreetmap_node))
app.add_directive('openstreetmap', OpenStreetMapDirective)
| from docutils import nodes
from docutils.parsers.rst import directives
from sphinx.util.compat import Directive
class openstreetmap(nodes.General, nodes.Element):
pass
class OpenStreetMapDirective(Directive):
"""Directive for embedding OpenStreetMap"""
has_content = False
option_spec = {
'id': directives.unchanged,
'label': directives.unchanged,
'marker': directives.unchanged,
}
def run(self):
node = openstreetmap()
+ if 'id' in self.options:
+ node['id'] = self.options['id']
+ else:
+ msg = ('openstreetmap directive needs uniqueue id for map data')
+ return [document.reporter.warning(msg, line=self.lineno)]
return [node]
def visit_openstreetmap_node(self, node):
self.body.append("<div id='openstreetmap' style='color:red'>OpenStreetMap directive</div>")
def depart_openstreetmap_node(self, node):
pass
def setup(app):
app.add_node(openstreetmap,
html=(visit_openstreetmap_node, depart_openstreetmap_node))
app.add_directive('openstreetmap', OpenStreetMapDirective)
| 5 | 0.16129 | 5 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.