file_name
large_stringlengths
4
140
prefix
large_stringlengths
0
39k
suffix
large_stringlengths
0
36.1k
middle
large_stringlengths
0
29.4k
fim_type
large_stringclasses
4 values
ajax.js
jQuery(document).ready(function(){ jQuery("#ResponsiveContactForm").validate({ submitHandler: function(form) { jQuery.ajax({ type: "POST", dataType: "json", url:MyAjax, data:{ action: 'ai_action', fdata : jQuery(document.formValidate).serialize() }, success:function(respon...
}else{ alert(response); } } }); } }); });
jQuery('#captcha').val(''); refreshCaptcha();
random_line_split
consolidate_HERA_CST_beams.py
import numpy as NP import healpy as HP from astropy.io import fits import glob rootdir = '/data3/t_nithyanandan/project_HERA/' beams_dir = 'power_patterns/CST/mdl03/' prefix = 'X4Y2H_490_' suffix = '.hmap' pols = ['X'] colnum = 0 outdata = [] schemes = [] nsides = [] npixs = [] frequencies = [] for pol in pols: f...
outdata += [beam] schemes += [scheme] npixs += [beam[:,0].size] nsides += [HP.npix2nside(beam[:,0].size)] outfile = rootdir + beams_dir + '{0[0]}_{0[1]}'.format(fnames[0].split('_')[:2])+suffix hdulist = [] hdulist += [fits.PrimaryHDU()] hdulist[0].header['EXTNAME'] = 'PRIMARY' hdulist[0].header['NPO...
inhdulist = fits.open(fname) hdu1 = inhdulist[1] data = hdu1.data.field(colnum) data = data.flatten() if not data.dtype.isnative: data.dtype = data.dtype.newbyteorder() data.byteswap(True) scheme = hdu1.header['ORDERING'][:4] if beam is None: ...
conditional_block
consolidate_HERA_CST_beams.py
import numpy as NP import healpy as HP from astropy.io import fits import glob rootdir = '/data3/t_nithyanandan/project_HERA/' beams_dir = 'power_patterns/CST/mdl03/' prefix = 'X4Y2H_490_' suffix = '.hmap' pols = ['X'] colnum = 0 outdata = [] schemes = [] nsides = [] npixs = [] frequencies = [] for pol in pols: f...
fnames = NP.asarray(fnames) freqs_str = [fname.split('_')[2].split('.')[0] for fname in fnames] freqs = NP.asarray(map(float, freqs_str)) sortind = NP.argsort(freqs) fullfnames = fullfnames[sortind] fnames = fnames[sortind] freqs = freqs[sortind] frequencies += [freqs] beam = None ...
random_line_split
myVidInGUI.py
from Tkinter import * import cv2 from PIL import Image, ImageTk import pyautogui width, height = 302, 270 screenwidth, screenheight = pyautogui.size() cap = cv2.VideoCapture(0) cap.set(cv2.cv.CV_CAP_PROP_FRAME_WIDTH, width) cap.set(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT, height) root = Tk() root.title("Testing Mode") root.b...
(): _, frame = cap.read() frame = cv2.flip(frame, 1) cv2image = cv2.cvtColor(frame, cv2.COLOR_BGR2RGBA) img = Image.fromarray(cv2image) imgtk = ImageTk.PhotoImage(image=img) videoStream.imgtk = imgtk videoStream.configure(image=imgtk) videoStream.after(10, show_frame) show_frame() root....
show_frame
identifier_name
myVidInGUI.py
from Tkinter import * import cv2 from PIL import Image, ImageTk import pyautogui width, height = 302, 270 screenwidth, screenheight = pyautogui.size() cap = cv2.VideoCapture(0) cap.set(cv2.cv.CV_CAP_PROP_FRAME_WIDTH, width) cap.set(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT, height) root = Tk() root.title("Testing Mode") root.b...
show_frame() root.mainloop()
random_line_split
myVidInGUI.py
from Tkinter import * import cv2 from PIL import Image, ImageTk import pyautogui width, height = 302, 270 screenwidth, screenheight = pyautogui.size() cap = cv2.VideoCapture(0) cap.set(cv2.cv.CV_CAP_PROP_FRAME_WIDTH, width) cap.set(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT, height) root = Tk() root.title("Testing Mode") root.b...
show_frame() root.mainloop()
_, frame = cap.read() frame = cv2.flip(frame, 1) cv2image = cv2.cvtColor(frame, cv2.COLOR_BGR2RGBA) img = Image.fromarray(cv2image) imgtk = ImageTk.PhotoImage(image=img) videoStream.imgtk = imgtk videoStream.configure(image=imgtk) videoStream.after(10, show_frame)
identifier_body
unit.ts
import { Move } from './move'; import { Serializable } from './iserializable'; interface IUnit { unitName: String; reflect: Number; life: Number; speed: Number; imageUrl: String; affinity: String; moves: any[]; } export class Unit implements Serializable<IUnit>, IUnit { unitName: Stri...
this.imageUrl = _unit.imageUrl; this.affinity = _unit.affinity; // Rajoute des noms fictifs aux différents moves. if(_unit.moves != undefined) _unit.moves.forEach(move => { nb++; move.moveName = "Move" + nb; }); this.moves...
this.reflect = _unit.reflect; this.life = _unit.life; this.speed = _unit.speed;
random_line_split
unit.ts
import { Move } from './move'; import { Serializable } from './iserializable'; interface IUnit { unitName: String; reflect: Number; life: Number; speed: Number; imageUrl: String; affinity: String; moves: any[]; } export class Unit implements Serializable<IUnit>, IUnit { unitName: Stri...
}
{ let nb = 0; this.unitName = _unit.unitName; this.reflect = _unit.reflect; this.life = _unit.life; this.speed = _unit.speed; this.imageUrl = _unit.imageUrl; this.affinity = _unit.affinity; // Rajoute des noms fictifs aux différents moves. if(_u...
identifier_body
unit.ts
import { Move } from './move'; import { Serializable } from './iserializable'; interface IUnit { unitName: String; reflect: Number; life: Number; speed: Number; imageUrl: String; affinity: String; moves: any[]; } export class
implements Serializable<IUnit>, IUnit { unitName: String; reflect: Number; life: Number; speed: Number; imageUrl: String; affinity: String; moves: any[]; deserialize(_unit: IUnit) { let nb = 0; this.unitName = _unit.unitName; this.reflect = _unit.reflect; ...
Unit
identifier_name
mirroring.py
# -*- coding: utf-8 -*- import flask import functools import logging import requests from .. import storage from .. import toolkit from . import cache from . import config DEFAULT_CACHE_TAGS_TTL = 48 * 3600 logger = logging.getLogger(__name__) def is_mirror(): cfg = config.load() return bool(cfg.get('mirr...
if not stream: logger.debug('JSON data found on source, writing response') resp_data = source_resp.content if cache: store_mirrored_data( resp_data, flask.request.url_rule.rule, kwargs, stor...
headers['x-docker-endpoints'] = toolkit.get_endpoints()
conditional_block
mirroring.py
# -*- coding: utf-8 -*- import flask import functools import logging import requests from .. import storage from .. import toolkit from . import cache from . import config DEFAULT_CACHE_TAGS_TTL = 48 * 3600 logger = logging.getLogger(__name__) def is_mirror(): cfg = config.load() return bool(cfg.get('mirr...
(): for chunk in sr.iterate(store.buffer_size): yield chunk # FIXME: this could be done outside of the request context tmp.seek(0) store.stream_write(layer_path, tmp) tmp.close() return flask.Response(generate(), headers=headers) def store_mirrored_data(data, en...
generate
identifier_name
mirroring.py
# -*- coding: utf-8 -*- import flask import functools import logging import requests from .. import storage from .. import toolkit from . import cache from . import config DEFAULT_CACHE_TAGS_TTL = 48 * 3600 logger = logging.getLogger(__name__) def is_mirror(): cfg = config.load() return bool(cfg.get('mirr...
request_path = flask.request.path if request_path.endswith('/tags'): # client GETs a list of tags tag_path = store.tag_path(namespace, repository) else: # client GETs a single tag tag_path = store.tag_path(namespace, repository, kwargs['tag']) ...
store = storage.load()
random_line_split
mirroring.py
# -*- coding: utf-8 -*- import flask import functools import logging import requests from .. import storage from .. import toolkit from . import cache from . import config DEFAULT_CACHE_TAGS_TTL = 48 * 3600 logger = logging.getLogger(__name__) def is_mirror(): cfg = config.load() return bool(cfg.get('mirr...
def store_mirrored_data(data, endpoint, args, store): logger.debug('Endpoint: {0}'.format(endpoint)) path_method, arglist = ({ '/v1/images/<image_id>/json': ('image_json_path', ('image_id',)), '/v1/images/<image_id>/ancestry': ( 'image_ancestry_path', ('image_id',) ), ...
sr = toolkit.SocketReader(source_resp) tmp, hndlr = storage.temp_store_handler() sr.add_handler(hndlr) def generate(): for chunk in sr.iterate(store.buffer_size): yield chunk # FIXME: this could be done outside of the request context tmp.seek(0) store.stream_writ...
identifier_body
utils.py
# -*- coding: utf-8 -*- """This file contains utility functions.""" import logging import re # Illegal Unicode characters for XML. ILLEGAL_XML_RE = re.compile( ur'[\x00-\x08\x0b-\x1f\x7f-\x84\x86-\x9f' ur'\ud800-\udfff\ufdd0-\ufddf\ufffe-\uffff]') def IsText(bytes_in, encoding=None): """Examine the bytes...
(string): """Converts the string to Unicode if necessary.""" if not isinstance(string, unicode): return str(string).decode('utf8', 'ignore') return string def GetInodeValue(inode_raw): """Read in a 'raw' inode value and try to convert it into an integer. Args: inode_raw: A string or an int inode va...
GetUnicodeString
identifier_name
utils.py
# -*- coding: utf-8 -*- """This file contains utility functions.""" import logging import re # Illegal Unicode characters for XML. ILLEGAL_XML_RE = re.compile( ur'[\x00-\x08\x0b-\x1f\x7f-\x84\x86-\x9f' ur'\ud800-\udfff\ufdd0-\ufddf\ufffe-\uffff]') def IsText(bytes_in, encoding=None): """Examine the bytes...
return string
return ILLEGAL_XML_RE.sub(replacement, string)
conditional_block
utils.py
# -*- coding: utf-8 -*- """This file contains utility functions.""" import logging import re # Illegal Unicode characters for XML. ILLEGAL_XML_RE = re.compile( ur'[\x00-\x08\x0b-\x1f\x7f-\x84\x86-\x9f' ur'\ud800-\udfff\ufdd0-\ufddf\ufffe-\uffff]') def IsText(bytes_in, encoding=None): """Examine the bytes...
def RemoveIllegalXMLCharacters(string, replacement=u'\ufffd'): """Removes illegal Unicode characters for XML. Args: string: A string to replace all illegal characters for XML. replacement: A replacement character to use in replacement of all found illegal characters. Return: A string wher...
"""Read in a 'raw' inode value and try to convert it into an integer. Args: inode_raw: A string or an int inode value. Returns: An integer inode value. """ if isinstance(inode_raw, (int, long)): return inode_raw if isinstance(inode_raw, float): return int(inode_raw) try: return int(i...
identifier_body
utils.py
# -*- coding: utf-8 -*- """This file contains utility functions.""" import logging import re
ILLEGAL_XML_RE = re.compile( ur'[\x00-\x08\x0b-\x1f\x7f-\x84\x86-\x9f' ur'\ud800-\udfff\ufdd0-\ufddf\ufffe-\uffff]') def IsText(bytes_in, encoding=None): """Examine the bytes in and determine if they are indicative of a text. Parsers need quick and at least semi reliable method of discovering whether o...
# Illegal Unicode characters for XML.
random_line_split
supportbundle.rs
use crate::{common::ui::{Status, UIWriter, UI}, error::{Error, Result}, hcore::{fs::FS_ROOT_PATH, os::net::hostname}}; use chrono::Local; use flate2::{write::GzEncoder, Compression}; use std::{...
{ let dt = Local::now(); ui.status(Status::Generating, format!("New Support Bundle at {}", dt.format("%Y-%m-%d %H:%M:%S")))?; let host = match lookup_hostname() { Ok(host) => host, Err(e) => { let host = String::from("localhost"); ui.warn(format!("Hostna...
identifier_body
supportbundle.rs
use crate::{common::ui::{Status, UIWriter, UI}, error::{Error, Result}, hcore::{fs::FS_ROOT_PATH, os::net::hostname}}; use chrono::Local; use flate2::{write::GzEncoder, Compression}; use std::{...
Ok(()) }
process::exit(1) } ui.status(Status::Created, format!("{}{}{}", cwd.display(), MAIN_SEPARATOR, &tarball_name))?;
random_line_split
supportbundle.rs
use crate::{common::ui::{Status, UIWriter, UI}, error::{Error, Result}, hcore::{fs::FS_ROOT_PATH, os::net::hostname}}; use chrono::Local; use flate2::{write::GzEncoder, Compression}; use std::{...
() -> Result<String> { match hostname() { Ok(hostname) => Ok(hostname), Err(_) => Err(Error::NameLookup), } } pub fn start(ui: &mut UI) -> Result<()> { let dt = Local::now(); ui.status(Status::Generating, format!("New Support Bundle at {}", dt.format("%Y-%m-%d %H:%M:%S")))...
lookup_hostname
identifier_name
fmt.rs
//! Utilities for formatting and printing `String`s. //! //! This module contains the runtime support for the [`format!`] syntax extension. //! This macro is implemented in the compiler to emit calls to this module in //! order to format arguments at runtime into strings. //! //! # Usage //! //! The [`format!`] macro i...
rgs.estimated_capacity(); let mut output = string::String::with_capacity(capacity); output.write_fmt(args).expect("a formatting trait implementation returned an error"); output }
identifier_body
fmt.rs
//! Utilities for formatting and printing `String`s. //! //! This module contains the runtime support for the [`format!`] syntax extension. //! This macro is implemented in the compiler to emit calls to this module in //! order to format arguments at runtime into strings. //! //! # Usage //! //! The [`format!`] macro i...
-> string::String { let capacity = args.estimated_capacity(); let mut output = string::String::with_capacity(capacity); output.write_fmt(args).expect("a formatting trait implementation returned an error"); output }
<'_>)
identifier_name
fmt.rs
//! Utilities for formatting and printing `String`s. //! //! This module contains the runtime support for the [`format!`] syntax extension. //! This macro is implemented in the compiler to emit calls to this module in //! order to format arguments at runtime into strings. //! //! # Usage //! //! The [`format!`] macro i...
//! println!("Hello {:1$}!", "x", 5); //! println!("Hello {1:0$}!", 5, "x"); //! println!("Hello {:width$}!", "x", width = 5); //! let width = 5; //! println!("Hello {:width$}!", "x"); //! ``` //! //! This is a parameter for the "minimum width" that the format should take up. //! If the value's string does not fill up ...
//! ``` //! // All of these print "Hello x !" //! println!("Hello {:5}!", "x");
random_line_split
gendocert.py
#!/usr/bin/env python import sys from httplib import HTTPConnection from urllib import urlencode from urlparse import urljoin from json import loads from reportlab.pdfgen import canvas OUTPUTFILE = 'certificate.pdf' def get_brooklyn_integer(): ''' Ask Brooklyn Integers for a single integer. Returns ...
if __name__ == "__main__": if len(sys.argv) != 2: print 'Usage: gendocert.py "Firstname Lastname"' sys.exit(1) else: # TODO if this is run as a CGI need to sanitize input draw_pdf(sys.argv[1])
certimage = './devops.cert.png' # TODO make this a function of image size width = 1116 height = 1553 # Times Roman better fits the other fonts on the template font_name = "Times-Roman" # TODO make font size a function of name length font_size = 72 c = canvas.Canvas(OUTPUTFILE, pagesi...
identifier_body
gendocert.py
#!/usr/bin/env python import sys from httplib import HTTPConnection from urllib import urlencode from urlparse import urljoin from json import loads from reportlab.pdfgen import canvas OUTPUTFILE = 'certificate.pdf' def
(): ''' Ask Brooklyn Integers for a single integer. Returns a tuple with number and integer permalink. From: https://github.com/migurski/ArtisinalInts/ ''' body = 'method=brooklyn.integers.create' head = {'Content-Type': 'application/x-www-form-urlencoded'} conn = HTTPConnection('api.b...
get_brooklyn_integer
identifier_name
gendocert.py
#!/usr/bin/env python import sys from httplib import HTTPConnection from urllib import urlencode from urlparse import urljoin from json import loads from reportlab.pdfgen import canvas OUTPUTFILE = 'certificate.pdf' def get_brooklyn_integer(): ''' Ask Brooklyn Integers for a single integer. Returns ...
print "I/O error trying to save %s" % OUTPUTFILE if __name__ == "__main__": if len(sys.argv) != 2: print 'Usage: gendocert.py "Firstname Lastname"' sys.exit(1) else: # TODO if this is run as a CGI need to sanitize input draw_pdf(sys.argv[1])
try: c.save() except IOError:
random_line_split
gendocert.py
#!/usr/bin/env python import sys from httplib import HTTPConnection from urllib import urlencode from urlparse import urljoin from json import loads from reportlab.pdfgen import canvas OUTPUTFILE = 'certificate.pdf' def get_brooklyn_integer(): ''' Ask Brooklyn Integers for a single integer. Returns ...
draw_pdf(sys.argv[1])
conditional_block
connector.py
#!/usr/bin/env python """ Copyright (c) 2006-2015 sqlmap developers (http://sqlmap.org/) See the file 'doc/COPYING' for copying permission """ try: import _mssql import pymssql except ImportError: pass import logging from lib.core.convert import utf8encode from lib.core.data import conf from lib.core.da...
retVal = None if self.execute(query): retVal = self.fetchall() try: self.connector.commit() except pymssql.OperationalError: pass return retVal
identifier_body
connector.py
#!/usr/bin/env python """ Copyright (c) 2006-2015 sqlmap developers (http://sqlmap.org/) See the file 'doc/COPYING' for copying permission """ try: import _mssql import pymssql except ImportError: pass import logging from lib.core.convert import utf8encode from lib.core.data import conf from lib.core.da...
(self): try: return self.cursor.fetchall() except (pymssql.ProgrammingError, pymssql.OperationalError, _mssql.MssqlDatabaseException), msg: logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % str(msg).replace("\n", " ")) return None de...
fetchall
identifier_name
connector.py
#!/usr/bin/env python """ Copyright (c) 2006-2015 sqlmap developers (http://sqlmap.org/) See the file 'doc/COPYING' for copying permission """ try: import _mssql import pymssql except ImportError: pass import logging from lib.core.convert import utf8encode from lib.core.data import conf from lib.core.da...
return retVal
retVal = self.fetchall() try: self.connector.commit() except pymssql.OperationalError: pass
conditional_block
connector.py
#!/usr/bin/env python """ Copyright (c) 2006-2015 sqlmap developers (http://sqlmap.org/) See the file 'doc/COPYING' for copying permission """ try: import _mssql import pymssql except ImportError: pass import logging from lib.core.convert import utf8encode from lib.core.data import conf from lib.core.da...
Debian package: python-pymssql License: LGPL Possible connectors: http://wiki.python.org/moin/SQL%20Server Important note: pymssql library on your system MUST be version 1.0.2 to work, get it from http://sourceforge.net/projects/pymssql/files/pymssql/1.0.2/ """ def __init__(self): ...
class Connector(GenericConnector): """ Homepage: http://pymssql.sourceforge.net/ User guide: http://pymssql.sourceforge.net/examples_pymssql.php API: http://pymssql.sourceforge.net/ref_pymssql.php
random_line_split
GPUVerify.py
# vim: set sw=2 ts=2 softtabstop=2 expandtab: from . RunnerBase import RunnerBaseClass from .. Analysers.GPUVerify import GPUVerifyAnalyser import logging import os import psutil import re import sys import yaml _logger = logging.getLogger(__name__) class GPUVerifyRunnerException(Exception): def __init__(self, msg)...
env['PATH'] = path cmdLine.extend(self.additionalArgs) # Add the boogie source file as last arg cmdLine.append(self.programPathArgument) backendResult = self.runTool(cmdLine, isDotNet=False, envExtra=env) if backendResult.outOfTime: _logger.warning('GPUVerify hit hard time...
path = ""
conditional_block
GPUVerify.py
# vim: set sw=2 ts=2 softtabstop=2 expandtab: from . RunnerBase import RunnerBaseClass from .. Analysers.GPUVerify import GPUVerifyAnalyser import logging import os import psutil import re import sys import yaml _logger = logging.getLogger(__name__) class GPUVerifyRunnerException(Exception): def __init__(self, msg)...
cmdLine = [ sys.executable, self.toolPath ] cmdLine.append('--timeout={}'.format(self.softTimeout)) # Note we ignore self.entryPoint _logger.info('Ignoring entry point {}'.format(self.entryPoint)) # GPUVerify needs PATH environment variable set env = {} path = os.getenv('PATH') if pat...
def run(self): # Run using python interpreter
random_line_split
GPUVerify.py
# vim: set sw=2 ts=2 softtabstop=2 expandtab: from . RunnerBase import RunnerBaseClass from .. Analysers.GPUVerify import GPUVerifyAnalyser import logging import os import psutil import re import sys import yaml _logger = logging.getLogger(__name__) class GPUVerifyRunnerException(Exception): def
(self, msg): self.msg = msg class GPUVerifyRunner(RunnerBaseClass): softTimeoutDiff = 5 def __init__(self, boogieProgram, workingDirectory, rc): _logger.debug('Initialising {}'.format(boogieProgram)) super(GPUVerifyRunner, self).__init__(boogieProgram, workingDirectory, rc) # Sanity checks # ...
__init__
identifier_name
GPUVerify.py
# vim: set sw=2 ts=2 softtabstop=2 expandtab: from . RunnerBase import RunnerBaseClass from .. Analysers.GPUVerify import GPUVerifyAnalyser import logging import os import psutil import re import sys import yaml _logger = logging.getLogger(__name__) class GPUVerifyRunnerException(Exception): def __init__(self, msg)...
return GPUVerifyRunner
identifier_body
FairCollections_fair.graphql.ts
/* tslint:disable */ /* eslint-disable */ import { ReaderFragment } from "relay-runtime"; import { FragmentRefs } from "relay-runtime"; export type FairCollections_fair = { readonly marketingCollections: ReadonlyArray<{ readonly id: string; readonly slug: string; readonly " $fragmentRefs": ...
}; (node as any).hash = '8ecebb5e5de44baf510cad3eaceda047'; export default node;
} ], "type": "Fair"
random_line_split
regions-fn-subtyping.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
fn test_fn<'x,'y,'z,T>(_x: &'x T, _y: &'y T, _z: &'z T) { // Here, x, y, and z are free. Other letters // are bound. Note that the arrangement // subtype::<T1>(of::<T2>()) will typecheck // iff T1 <: T2. subtype::<&fn<'a>(&'a T)>( of::<&fn<'a>(&'a T)>()); subtype::<&fn<'a>(&'a T)>(...
{ fail!(); }
identifier_body
regions-fn-subtyping.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
<T>(x: @fn(T)) { fail!(); } fn test_fn<'x,'y,'z,T>(_x: &'x T, _y: &'y T, _z: &'z T) { // Here, x, y, and z are free. Other letters // are bound. Note that the arrangement // subtype::<T1>(of::<T2>()) will typecheck // iff T1 <: T2. subtype::<&fn<'a>(&'a T)>( of::<&fn<'a>(&'a T)>()); ...
subtype
identifier_name
regions-fn-subtyping.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
} fn main() {}
subtype::<&fn<'a,'b>(&'a T) -> @fn(&'b T)>( of::<&fn<'a>(&'a T) -> @fn(&'a T)>());
random_line_split
index.ts
import { USER_AGENT } from "./user-agent"; import EventEmitter from "./events"; import { isSSR } from "./ssr"; export { EventEmitter }; /** * NetworkError defines an error occuring from the network. */ export class NetworkError extends Error { type: "CONNECTION"; constructor(message: string) { super(message...
ues: Record<string, ValueType | undefined>) { this._internalUpdate(values); this.emit( EVENT_VALUES_UPDATED, values, (values: Record<string, ValueType | undefined>) => this._internalUpdate(values) ); } get(): Record<string, string> { const values: Record<string, string> = ...
te(val
identifier_name
index.ts
import { USER_AGENT } from "./user-agent"; import EventEmitter from "./events"; import { isSSR } from "./ssr"; export { EventEmitter }; /** * NetworkError defines an error occuring from the network. */ export class NetworkError extends Error { type: "CONNECTION"; constructor(message: string) { super(message...
*/ type TokenProto = | undefined | { click: { token: string }; } | { pos: string; neg: string; } | { posNeg: { pos: string; neg: string; }; }; /** * @hidden */ type ValueProto = | { single: string } | { repeated: { values: string[] } } | { sing...
random_line_split
index.ts
import { USER_AGENT } from "./user-agent"; import EventEmitter from "./events"; import { isSSR } from "./ssr"; export { EventEmitter }; /** * NetworkError defines an error occuring from the network. */ export class NetworkError extends Error { type: "CONNECTION"; constructor(message: string) { super(message...
data[key] = val; return data; }, {} as Record<string, string>); if (data === undefined) { return cookieData; } Object.entries(cookieData).forEach(([key, val]) => { data[key] = val; }); return data; } /** * newQueryID constructs a new ID for a query. * @hidden */ function newQueryID...
data["ga"] = val; return data; }
conditional_block
index.ts
import { USER_AGENT } from "./user-agent"; import EventEmitter from "./events"; import { isSSR } from "./ssr"; export { EventEmitter }; /** * NetworkError defines an error occuring from the network. */ export class NetworkError extends Error { type: "CONNECTION"; constructor(message: string) { super(message...
export type TokenState = { token: PosNegToken; clickSubmitted: boolean; }; export const POS_NEG_STORAGE_KEY = "sajari_tokens"; // Just here to handle SSR execution (docs) const setItem = (key: string, value: string) => { if (isSSR()) { return; } return localStorage.setItem(key, value); }; const getItem =...
const values: Record<string, string> = {}; Object.entries(this.internal).forEach(([key, value]) => { if (typeof value === "function") { values[key] = value(); } else if (Array.isArray(value)) { values[key] = value.join(","); } else { values[key] = "" + value; } ...
identifier_body
types.ts
export interface ISchemaCodeProps { schema: any onChange?: Function } export interface ISchemaTreeProps { schema: any onSelect?: Function onChange?: Function } export interface IFieldEditorProps { schema: object components: any xProps: any xRules: any onChange?: (newSchema: any) => void } export ...
X_COMPONENT_PROPS = 'x-component-props', X_RULES = 'x-rules' }
random_line_split
dexter-util.js
/** * Copyright (c) 2015 Samsung Electronics, Inc., * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, this * li...
/* refer to : http://stackoverflow.com/questions/3653065/get-local-ip-address-in-node-js */ exports.getLocalIPAddress = function(){ var interfaces = require('os').networkInterfaces(); for (var devName in interfaces) { var iface = interfaces[devName]; for (var i = 0; i < iface.length; i++) { ...
var now = moment().format(); return now.replace(/\..+/, '').replace(/\-/g, '').replace(/\:/g, '').replace(/T/, '-').substr(0,15); };
random_line_split
dexter-util.js
/** * Copyright (c) 2015 Samsung Electronics, Inc., * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, this * li...
{ if(_.isArray(option) === false || option.length !== 2) return false; var key = _.trim(option[0]); var value = _.trim(option[1]); if(key.length < 2) return false; if(value.length < 1) return false; return key.startsWith('-'); }
identifier_body
dexter-util.js
/** * Copyright (c) 2015 Samsung Electronics, Inc., * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, this * li...
(option){ if(_.isArray(option) === false || option.length !== 2) return false; var key = _.trim(option[0]); var value = _.trim(option[1]); if(key.length < 2) return false; if(value.length < 1) return false; return key.startsWith('-'); }
isValidCliOption
identifier_name
dexter-util.js
/** * Copyright (c) 2015 Samsung Electronics, Inc., * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, this * li...
var _key = _.trim(key); if(this.options[_key]){ return this.options[_key]; } else if(defaultValue){ this.options[_key] = defaultValue; return defaultValue; } else { return undefined; } ...
{ return undefined; }
conditional_block
extract_i18n_plugin.js
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // @ignoreDep @angular/compiler-cli const ts = require("typescript"); const path = require("path"); const fs = require("fs"); const { __NGTOOLS_PRIVATE_API_2, VERSION } = require('@angular/compiler-cli'); const resource_loader_1 = require("./r...
(compiler) { this._compiler = compiler; compiler.plugin('make', (compilation, cb) => this._make(compilation, cb)); compiler.plugin('after-emit', (compilation, cb) => { this._donePromise = null; this._compilation = null; compilation._ngToolsWebpackXi18nPluginIn...
apply
identifier_name
extract_i18n_plugin.js
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // @ignoreDep @angular/compiler-cli const ts = require("typescript"); const path = require("path"); const fs = require("fs"); const { __NGTOOLS_PRIVATE_API_2, VERSION } = require('@angular/compiler-cli'); const resource_loader_1 = require("./r...
if (options.hasOwnProperty('outFile')) { if (VERSION.major === '2') { console.warn("The option '--out-file' is only available on the xi18n command" + ' starting from Angular v4, please update to a newer version.', '\n\n'); } this._outFile ...
{ if (VERSION.major === '2') { console.warn("The option '--locale' is only available on the xi18n command" + ' starting from Angular v4, please update to a newer version.', '\n\n'); } this._locale = options.locale; }
conditional_block
extract_i18n_plugin.js
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // @ignoreDep @angular/compiler-cli const ts = require("typescript"); const path = require("path"); const fs = require("fs"); const { __NGTOOLS_PRIVATE_API_2, VERSION } = require('@angular/compiler-cli'); const resource_loader_1 = require("./r...
} this._outFile = options.outFile; } } apply(compiler) { this._compiler = compiler; compiler.plugin('make', (compilation, cb) => this._make(compilation, cb)); compiler.plugin('after-emit', (compilation, cb) => { this._donePromise = null; ...
random_line_split
calendar-sw.js
// ** I18N Calendar._DN = new Array ("Söndag", "Måndag", "Tisdag", "Onsdag", "Torsdag", "Fredag", "Lördag", "Söndag"); Calendar._MN = new Array ("Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December"); // toolti...
Calendar._TT["NEXT_YEAR"] = "Nästa år (tryck för meny)"; Calendar._TT["SEL_DATE"] = "Välj dag"; Calendar._TT["DRAG_TO_MOVE"] = "Flytta fönstret"; Calendar._TT["PART_TODAY"] = " (idag)"; Calendar._TT["MON_FIRST"] = "Visa Måndag först"; Calendar._TT["SUN_FIRST"] = "Visa Söndag först"; Calendar._TT["CLOSE"] = "Stäng...
Calendar._TT["TOGGLE"] = "Skifta första veckodag"; Calendar._TT["PREV_YEAR"] = "Förra året (tryck för meny)"; Calendar._TT["PREV_MONTH"] = "Förra månaden (tryck för meny)"; Calendar._TT["GO_TODAY"] = "Gå till dagens datum"; Calendar._TT["NEXT_MONTH"] = "Nästa månad (tryck för meny)";
random_line_split
hilbert_curve.rs
use std::io::{Read, Write}; use std::collections::HashMap; use graph_iterator::EdgeMapper; use byteorder::{ReadBytesExt, WriteBytesExt};
pub fn encode<W: Write>(writer: &mut W, diff: u64) { assert!(diff > 0); for &shift in [56, 48, 40, 32, 24, 16, 8].iter() { if (diff >> shift) != 0 { writer.write_u8(0u8).ok().expect("write error"); } } for &shift in [56, 48, 40, 32, 24, 16, 8].iter() { if (diff >> shi...
#[inline]
random_line_split
hilbert_curve.rs
use std::io::{Read, Write}; use std::collections::HashMap; use graph_iterator::EdgeMapper; use byteorder::{ReadBytesExt, WriteBytesExt}; #[inline] pub fn encode<W: Write>(writer: &mut W, diff: u64) { assert!(diff > 0); for &shift in [56, 48, 40, 32, 24, 16, 8].iter() { if (diff >> shift) != 0 { ...
result.0 += (x_byte as u32) << (8 * log_s); result.1 += (y_byte as u32) << (8 * log_s); } debug_assert!(bit_detangle(init_tangle) == result); return result; } } fn bit_entangle(mut pair: (u32, u32)) -> u64 { let mut result = 0u64; for log_s_rev in 0..32 { ...
{ let temp = result.0; result.0 = result.1; result.1 = temp; }
conditional_block
hilbert_curve.rs
use std::io::{Read, Write}; use std::collections::HashMap; use graph_iterator::EdgeMapper; use byteorder::{ReadBytesExt, WriteBytesExt}; #[inline] pub fn encode<W: Write>(writer: &mut W, diff: u64) { assert!(diff > 0); for &shift in [56, 48, 40, 32, 24, 16, 8].iter() { if (diff >> shift) != 0 { ...
(&mut self, tangle: u64) -> (u32, u32) { let (mut x_byte, mut y_byte) = unsafe { *self.hilbert.detangle.get_unchecked(tangle as u16 as usize) }; // validate self.prev_rot, self.prev_out if self.prev_hi != (tangle >> 16) { self.prev_hi = tangle >> 16; // detangle with a ...
detangle
identifier_name
color-base.js
YUI.add('color-base', function (Y, NAME) { /** Color provides static methods for color conversion. Y.Color.toRGB('f00'); // rgb(255, 0, 0) Y.Color.toHex('rgb(255, 255, 0)'); // #ffff00 @module color @submodule color-base @class Color @since 3.8.0 **/ var REGEX_HEX = /^#?([\da-fA-F]{2})([\da-fA-F]{2})([\da...
clr.push(alpha); clr = Y.Color.fromArray(clr, originalTo.toUpperCase()); } return clr; }, /** Processes the hex string into r, g, b values. Will return values as an array, or as an rgb string. @protected @method _hexToRgb @param {String} str ...
{ clr = Y.Color.toArray(clr); }
conditional_block
color-base.js
YUI.add('color-base', function (Y, NAME) { /** Color provides static methods for color conversion. Y.Color.toRGB('f00'); // rgb(255, 0, 0) Y.Color.toHex('rgb(255, 255, 0)'); // #ffff00 @module color @submodule color-base @class Color @since 3.8.0 **/ var REGEX_HEX = /^#?([\da-fA-F]{2})([\da-fA-F]{2})([\da...
if (method) { clr = ((method)(clr, needsAlpha)); } // process clr from arrays to strings after conversions if alpha is needed if (needsAlpha) { if (!Y.Lang.isArray(clr)) { clr = Y.Color.toArray(clr); } clr.push(alpha); ...
random_line_split
LinuxIntelELF32.py
''' Author Joshua Pitts the.midnite.runr 'at' gmail <d ot > com Copyright (C) 2013,2014, Joshua Pitts License: GPLv3 This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, ei...
(self, CavesPicked={}): """ Modified metasploit linux/x64/shell_reverse_tcp shellcode to correctly fork the shellcode payload and contiue normal execution. """ if self.PORT is None: print ("Must provide port") sys.exit(1) self.shell...
reverse_shell_tcp
identifier_name
LinuxIntelELF32.py
''' Author Joshua Pitts the.midnite.runr 'at' gmail <d ot > com Copyright (C) 2013,2014, Joshua Pitts License: GPLv3 This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, ei...
""" Linux ELFIntel x32 shellcode class """ def __init__(self, HOST, PORT, e_entry, SUPPLIED_SHELLCODE=None): #could take this out HOST/PORT and put into each shellcode function self.HOST = HOST self.PORT = PORT self.e_entry = e_entry self.SUPPLIED_SHELLCODE = SUPPLIE...
identifier_body
LinuxIntelELF32.py
''' Author Joshua Pitts the.midnite.runr 'at' gmail <d ot > com Copyright (C) 2013,2014, Joshua Pitts License: GPLv3 This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, ei...
else: supplied_shellcode = open(self.SUPPLIED_SHELLCODE, 'r+b').read() self.shellcode1 = "\x6a\x02\x58\xcd\x80\x85\xc0\x74\x07" #will need to put resume execution shellcode here self.shellcode1 += "\xbd" self.shellcode1 += struct.pack("<I", self.e_entry) s...
print "[!] User must provide shellcode for this module (-U)" sys.exit(0)
conditional_block
LinuxIntelELF32.py
''' Author Joshua Pitts the.midnite.runr 'at' gmail <d ot > com Copyright (C) 2013,2014, Joshua Pitts License: GPLv3 This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, ei...
Public License Currently supports win32/64 PE and linux32/64 ELF only(intel architecture). This program is to be used for only legal activities by IT security professionals and researchers. Author not responsible for malicious uses. ''' import struct import sys class linux_elfI32_shellcode(): ...
See <http://www.gnu.org/licenses/> for a copy of the GNU General
random_line_split
RDFISelector.js
import React from 'react' /* interface RDFISelector{ rdfi, onRDFIChange } */ export default class
extends React.PureComponent{ render(){ const { rdfi, onRDFIChange } = this.props; return React.createElement( 'div', { className: 'rdfi', style: { padding: "1em" }, onClick: e => { ...
RDFISelector
identifier_name
RDFISelector.js
import React from 'react' /* interface RDFISelector{ rdfi, onRDFIChange }
return React.createElement( 'div', { className: 'rdfi', style: { padding: "1em" }, onClick: e => { const t = e.currentTarget; onRDFIChange( ...
*/ export default class RDFISelector extends React.PureComponent{ render(){ const { rdfi, onRDFIChange } = this.props;
random_line_split
sha2.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
/// * input - A vector of message data fn input(&mut self, input: &[u8]); /// Retrieve the digest result. This method may be called multiple times. /// /// # Arguments /// /// * out - the vector to hold the result. Must be large enough to contain output_bits(). fn result(&mut self, out:...
random_line_split
sha2.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
} /// The SHA-256 hash algorithm pub struct Sha256 { engine: Engine256 } impl Sha256 { /// Construct a new instance of a SHA-256 digest. pub fn new() -> Sha256 { Sha256 { engine: Engine256::new(&H256) } } } impl Digest for Sha256 { fn input(&mut self, d: &[u8]) { ...
{ if self.finished { return; } let self_state = &mut self.state; self.buffer.standard_padding(8, |input: &[u8]| { self_state.process_block(input) }); write_u32_be(self.buffer.next(4), (self.length_bits >> 32) as u32 ); write_u32_be(self.buffer.next(4), self.l...
identifier_body
sha2.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
(&self) -> uint { 64 - self.buffer_idx } fn size(&self) -> uint { 64 } } /// The StandardPadding trait adds a method useful for Sha256 to a FixedBuffer struct. trait StandardPadding { /// Add padding to the buffer. The buffer must not be full when this method is called and is /// guaranteed to have exactl...
remaining
identifier_name
ty_match.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
(&mut self, a: ty::Region, b: ty::Region) -> RelateResult<'tcx, ty::Region> { debug!("{}.regions({}, {})", self.tag(), a.repr(self.tcx()), b.repr(self.tcx())); Ok(a) } fn tys(&mut self, a: Ty<'tcx>, b: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> { ...
regions
identifier_name
ty_match.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
/// A type "A" *matches* "B" if the fresh types in B could be /// substituted with values so as to make it equal to A. Matching is /// intended to be used only on freshened types, and it basically /// indicates if the non-freshened versions of A and B could have been /// unified. /// /// It is only an approximation. If...
random_line_split
ty_match.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
(&ty::ty_err, _) | (_, &ty::ty_err) => { Ok(self.tcx().types.err) } _ => { ty_relate::super_relate_tys(self, a, b) } } } fn binders<T>(&mut self, a: &ty::Binder<T>, b: &ty::Binder<T>) -> RelateResult<'t...
{ Err(ty::terr_sorts(ty_relate::expected_found(self, &a, &b))) }
conditional_block
ty_match.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
fn tcx(&self) -> &'a ty::ctxt<'tcx> { self.tcx } fn a_is_expected(&self) -> bool { true } // irrelevant fn relate_with_variance<T:Relate<'a,'tcx>>(&mut self, _: ty::Variance, a: &T, ...
{ "Match" }
identifier_body
sizing.rs
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This software may be used and distributed according to the terms of the * GNU General Public License version 2. */ use crate::graph::{FileContentData, Node, NodeData, NodeType, WrappedPath}; use crate::progress::{ progress_stream, report_state, Progr...
{ let sizing_progress_state = ProgressStateMutex::new(ProgressStateCountByType::<SizingStats, SizingStats>::new( fb, repo_params.logger.clone(), COMPRESSION_BENEFIT, repo_params.repo.name().clone(), command.sampling_options.node_types.clone(), ...
identifier_body
sizing.rs
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This software may be used and distributed according to the terms of the * GNU General Public License version 2. */ use crate::graph::{FileContentData, Node, NodeData, NodeType, WrappedPath}; use crate::progress::{ progress_stream, report_state, Progr...
} } fn try_compress(raw_data: &Bytes, compressor_type: CompressorType) -> Result<SizingStats, Error> { let raw = raw_data.len() as u64; let compressed_buf = MeteredWrite::new(Cursor::new(Vec::with_capacity(4 * 1024))); let mut compressor = Compressor::new(compressed_buf, compressor_type); compresso...
random_line_split
sizing.rs
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This software may be used and distributed according to the terms of the * GNU General Public License version 2. */ use crate::graph::{FileContentData, Node, NodeData, NodeType, WrappedPath}; use crate::progress::{ progress_stream, report_state, Progr...
(&mut self) { if let Some(delta_time) = self.should_log_throttled() { self.report_progress_log(Some(delta_time)); } } } #[derive(Debug)] pub struct SizingSample { pub data: HashMap<String, BlobstoreBytes>, } impl Default for SizingSample { fn default() -> Self { Self { ...
report_throttled
identifier_name
sizing.rs
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This software may be used and distributed according to the terms of the * GNU General Public License version 2. */ use crate::graph::{FileContentData, Node, NodeData, NodeType, WrappedPath}; use crate::progress::{ progress_stream, report_state, Progr...
(_, data_opt) => { // Report the blobstore sizes in sizing stats, more accurate than stream sizes, as headers included let sizes = sampler .complete_step(&walk_key.node) .map(|sizing_sample| { sizing_sample ...
{ match fc { FileContentData::Consumed(_num_loaded_bytes) => { future::ok(_num_loaded_bytes).left_future() } // Consume the stream to make sure we loaded all blobs FileContentData::ContentStream(file_...
conditional_block
Events.js
'use strict'; var canUseDOM = require('./canUseDOM'); var one = function() { }; var on = function() { }; var off = function() { }; if (canUseDOM)
module.exports = { one: one, on: on, off: off };
{ var bind = window.addEventListener ? 'addEventListener' : 'attachEvent'; var unbind = window.removeEventListener ? 'removeEventListener' : 'detachEvent'; var prefix = bind !== 'addEventListener' ? 'on' : ''; one = function(node, eventNames, eventListener) { var typeArray = eventNames.split(' '); var ...
conditional_block
Events.js
'use strict'; var canUseDOM = require('./canUseDOM'); var one = function() { }; var on = function() { }; var off = function() { }; if (canUseDOM) { var bind = window.addEventListener ? 'addEventListener' : 'attachEvent'; var unbind = window.removeEventListener ? 'removeEventListener' : 'detachEvent'; var prefix...
for (var i = typeArray.length - 1; i >= 0; i--) { this.on(node, typeArray[i], recursiveFunction); } }; /** * Bind `node` event `eventName` to `eventListener`. * * @param {Element} node * @param {String} eventName * @param {Function} eventListener * @param {Boolean} capture * @r...
var typeArray = eventNames.split(' '); var recursiveFunction = function(e) { e.target.removeEventListener(e.type, recursiveFunction); return eventListener(e); };
random_line_split
blocks.py
"""An XBlock to use as a child when you don't care what child to show. This code is in the Workbench layer. """ from web_fragments.fragment import Fragment from xblock.core import XBlock from .util import make_safe_for_html class DebuggingChildBlock(XBlock): """A simple gray box, to use as a child placehold...
(self, view_name, context=None): # pylint: disable=W0613 """Provides a fallback view handler""" frag = Fragment("<div class='debug_child'>%s<br>%s</div>" % (make_safe_for_html(repr(self)), view_name)) frag.add_css(""" .debug_child { background-color: grey; ...
fallback_view
identifier_name
blocks.py
"""An XBlock to use as a child when you don't care what child to show. This code is in the Workbench layer. """ from web_fragments.fragment import Fragment from xblock.core import XBlock from .util import make_safe_for_html class DebuggingChildBlock(XBlock): """A simple gray box, to use as a child placehold...
return frag
""")
random_line_split
blocks.py
"""An XBlock to use as a child when you don't care what child to show. This code is in the Workbench layer. """ from web_fragments.fragment import Fragment from xblock.core import XBlock from .util import make_safe_for_html class DebuggingChildBlock(XBlock): """A simple gray box, to use as a child placehold...
"""Provides a fallback view handler""" frag = Fragment("<div class='debug_child'>%s<br>%s</div>" % (make_safe_for_html(repr(self)), view_name)) frag.add_css(""" .debug_child { background-color: grey; width: 300px; height: 100px; ...
identifier_body
state.js
// These two object contain information about the state of Ebl var GlobalState = Base.extend({ constructor: function() { this.isAdmin = false; this.authToken = null; this.docTitle = null; this.container = null; // default config this.config = { t...
// callbacks onBlogLoaded: null, onPostOpened: null, onPageChanged: null }; } }); var LocalState = Base.extend({ constructor: function() { this.page = 0; this.post = null; this.editors = null; } }); var PostStatus...
language: 'en', postsPerPage: 5, pageTitleFormat: "{ebl_title} | {doc_title}",
random_line_split
Slider.js
/* All functions related to creating a Slider item. */ var slideCount = 1; // SETTER function addSlide() { slideCount++; } // GETTER function getSlide() { return(slideCount); } // Adds the Slider as well as the 'Edit' and 'delete' buttons. function slider() { var node = document.createEl...
//Textbox for Label change. var node2 = document.createElement("LI"); var label = document.createTextNode("Label: "); var y = document.createElement('input'); y.setAttribute('type', 'text'); y.setAttribute('id', 'selector'); var elem = document.getElementById(myValue).parentNode;...
el_span.appendChild(x); node.appendChild(el_span); document.getElementById("list_3").appendChild(node);
random_line_split
Slider.js
/* All functions related to creating a Slider item. */ var slideCount = 1; // SETTER function addSlide() { slideCount++; } // GETTER function
() { return(slideCount); } // Adds the Slider as well as the 'Edit' and 'delete' buttons. function slider() { var node = document.createElement("LI"); node.setAttribute('class', 'base'); var x = document.createElement("DIV"); x.setAttribute('class', 'slideStuff'); var slideName = ...
getSlide
identifier_name
Slider.js
/* All functions related to creating a Slider item. */ var slideCount = 1; // SETTER function addSlide()
// GETTER function getSlide() { return(slideCount); } // Adds the Slider as well as the 'Edit' and 'delete' buttons. function slider() { var node = document.createElement("LI"); node.setAttribute('class', 'base'); var x = document.createElement("DIV"); x.setAttribute('class', 'slide...
{ slideCount++; }
identifier_body
Slider.js
/* All functions related to creating a Slider item. */ var slideCount = 1; // SETTER function addSlide() { slideCount++; } // GETTER function getSlide() { return(slideCount); } // Adds the Slider as well as the 'Edit' and 'delete' buttons. function slider() { var node = document.createEl...
} if(name != "") { y.setAttribute('value', name); } y.addEventListener("change", function() { setValues(myValue, y); }); function setValues(myVal, y) { var sturf = document.createTextNode(String(y.value)); var searching = document.getElementById(m...
{ name = String(node.data); }
conditional_block
cloud_scheduler.list_jobs.js
// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in ...
callListJobs(); // [END cloudscheduler_v1_generated_CloudScheduler_ListJobs_async] } process.on('unhandledRejection', err => { console.error(err.message); process.exitCode = 1; }); main(...process.argv.slice(2));
{ // Construct request const request = { parent, }; // Run request const iterable = await schedulerClient.listJobsAsync(request); for await (const response of iterable) { console.log(response); } }
identifier_body
cloud_scheduler.list_jobs.js
// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in ...
(parent) { // [START cloudscheduler_v1_generated_CloudScheduler_ListJobs_async] /** * TODO(developer): Uncomment these variables before running the sample. */ /** * Required. The location name. For example: * `projects/PROJECT_ID/locations/LOCATION_ID`. */ // const parent = 'abc123' /** * ...
main
identifier_name
cloud_scheduler.list_jobs.js
// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in ...
const {CloudSchedulerClient} = require('@google-cloud/scheduler').v1; // Instantiates a client const schedulerClient = new CloudSchedulerClient(); async function callListJobs() { // Construct request const request = { parent, }; // Run request const iterable = await schedulerClient....
// const pageToken = 'abc123' // Imports the Scheduler library
random_line_split
script.ts
document.addEventListener('DOMContentLoaded', function() { var canvas = document.getElementById('canvas') as HTMLCanvasElement; var ctx = canvas.getContext("2d"); function
() { console.log('redraw') canvas.width = window.innerWidth; canvas.height = window.innerHeight; ctx.fillRect(0,0,100,100) ctx.font="30px Arial"; ctx.fillText("Hello", 100,100) } window.addEventListener('resize', redraw); redraw(); var old:...
redraw
identifier_name
script.ts
document.addEventListener('DOMContentLoaded', function() { var canvas = document.getElementById('canvas') as HTMLCanvasElement;
ctx.fillRect(0,0,100,100) ctx.font="30px Arial"; ctx.fillText("Hello", 100,100) } window.addEventListener('resize', redraw); redraw(); var old:{x:number, y:number}; canvas.addEventListener('mouseout', function(e) { old = undefined; }); canvas.a...
var ctx = canvas.getContext("2d"); function redraw() { console.log('redraw') canvas.width = window.innerWidth; canvas.height = window.innerHeight;
random_line_split
script.ts
document.addEventListener('DOMContentLoaded', function() { var canvas = document.getElementById('canvas') as HTMLCanvasElement; var ctx = canvas.getContext("2d"); function redraw()
window.addEventListener('resize', redraw); redraw(); var old:{x:number, y:number}; canvas.addEventListener('mouseout', function(e) { old = undefined; }); canvas.addEventListener('click', function(e) { redraw(); }); canvas.addEventListener('mousemove', fun...
{ console.log('redraw') canvas.width = window.innerWidth; canvas.height = window.innerHeight; ctx.fillRect(0,0,100,100) ctx.font="30px Arial"; ctx.fillText("Hello", 100,100) }
identifier_body
script.ts
document.addEventListener('DOMContentLoaded', function() { var canvas = document.getElementById('canvas') as HTMLCanvasElement; var ctx = canvas.getContext("2d"); function redraw() { console.log('redraw') canvas.width = window.innerWidth; canvas.height = window.innerHeight; ...
old = { x, y }; }); });
{ var qx = x-old.x; var qy = y-old.y; var a = Math.atan2(qy, qx) + Math.PI/2; var r = Math.sqrt(qx*qx+qy*qy); var dx = Math.cos(a)*r; var dy = Math.sin(a)*r; ctx.beginPath(); ctx.moveTo(x-dx, y-dy); ctx....
conditional_block
echo-inline.js
var WS = require('../') var tape = require('tape') var pull = require('pull-stream') var JSONDL = require('pull-json-doubleline') tape('simple echo server', function (t) { var server = WS.createServer(function (stream) { pull(stream, stream) }).listen(5678, function () { pull( pull.values([1,2,3]),...
})
random_line_split
detectFlash.js
// ----------------------------------------------------------------------------- // Globals // Major version of Flash required var requiredMajorVersion = 8; // Minor version of Flash required var requiredMinorVersion = 0; // Minor version of Flash required var requiredRevision = 0; // the version of javascript ...
{ reqVer = parseFloat(reqMajorVer + "." + reqRevision); // loop backwards through the versions until we find the newest version for (i=25;i>0;i--) { if (isIE && isWin && !isOpera) { versionStr = VBGetSwfVer(i); } else { versionStr = JSGetSwfVer(i); } if (versionStr == -1 ) { retur...
identifier_body
detectFlash.js
// ----------------------------------------------------------------------------- // Globals // Major version of Flash required var requiredMajorVersion = 8; // Minor version of Flash required var requiredMinorVersion = 0; // Minor version of Flash required var requiredRevision = 0; // the version of javascript ...
(reqMajorVer, reqMinorVer, reqRevision) { reqVer = parseFloat(reqMajorVer + "." + reqRevision); // loop backwards through the versions until we find the newest version for (i=25;i>0;i--) { if (isIE && isWin && !isOpera) { versionStr = VBGetSwfVer(i); } else { versionStr = JSGetSwfVer(i); ...
DetectFlashVer
identifier_name
detectFlash.js
// ----------------------------------------------------------------------------- // Globals // Major version of Flash required var requiredMajorVersion = 8; // Minor version of Flash required var requiredMinorVersion = 0; // Minor version of Flash required var requiredRevision = 0; // the version of javascript ...
else { tempArrayMinor = descArray[4].split("r"); } versionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0; flashVer = versionMajor + "." + versionMinor + "." + versionRevision; } else { flashVer = -1; } } // MSN/WebTV 2.6 supports Flash 4 else if (navigator....
{ tempArrayMinor = descArray[3].split("r"); }
conditional_block
detectFlash.js
// ----------------------------------------------------------------------------- // Globals // Major version of Flash required var requiredMajorVersion = 8; // Minor version of Flash required
// the version of javascript supported var jsVersion = 1.0; // ----------------------------------------------------------------------------- var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false; var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false; var isOpera = (...
var requiredMinorVersion = 0; // Minor version of Flash required var requiredRevision = 0;
random_line_split
LinkButton.js
import Button from './Button'; /** * The `LinkButton` component defines a `Button` which links to a route. * * ### Props * * All of the props accepted by `Button`, plus: * * - `active` Whether or not the page that this button links to is currently * active. * - `href` The URL to link to. If the current URL ...
}
random_line_split
LinkButton.js
import Button from './Button'; /** * The `LinkButton` component defines a `Button` which links to a route. * * ### Props * * All of the props accepted by `Button`, plus: * * - `active` Whether or not the page that this button links to is currently * active. * - `href` The URL to link to. If the current URL ...
() { const vdom = super.view(); vdom.tag = 'a'; return vdom; } /** * Determine whether a component with the given props is 'active'. * * @param {Object} props * @return {Boolean} */ static isActive(props) { return typeof props.active !== 'undefined' ? props.active : m...
view
identifier_name
LinkButton.js
import Button from './Button'; /** * The `LinkButton` component defines a `Button` which links to a route. * * ### Props * * All of the props accepted by `Button`, plus: * * - `active` Whether or not the page that this button links to is currently * active. * - `href` The URL to link to. If the current URL ...
}
{ return typeof props.active !== 'undefined' ? props.active : m.route() === props.href; }
identifier_body
user-settings.component.ts
import { Component, OnInit } from '@angular/core'; import { Router } from '@angular/router'; import { UserService } from '../../userShared/user.service'; import * as Rx from 'rxjs/Rx'; import * as firebase from 'firebase'; @Component({ templateUrl: './user-settings.component.html', styleUrls: ['./user-settin...
}).then(() => this.isDataAvailable = true); } blockedUsers() { this.router.navigate(['/user/settings/blockedUsers']); } securityQuestion() { this.router.navigate(['/user/settings/securityQuestion']); } resetPassword() { const verify = confirm(`Send a p...
{ this.blockedUserList = ['None']; }
conditional_block