copy from https://github.com/angular/angular.js/blob/master/src/Angular.js
423247
function(str) {
      var SNAKE_CASE_REGEXP = /[A-Z]/g;
      return str.replace(SNAKE_CASE_REGEXP, function(letter, pos) {
        return (pos ? '-' : '') + letter.toLowerCase();
      });
    }
376378
function copyComponentFiles( name, files ) {
		grunt.verbose.writeln( 'BowerMap::copyComponentFiles - ' + name );
		//get map of files to copy
		var componentMap = getComponentMapping( name, files );

		//copy files
		for ( var k in componentMap ) {
			if ( componentMap.hasOwnProperty( k ) ) {
				//console.log( path.fix( k ) );
				//console.log( path.fix( componentMap[ k ] ) );
				//grunt.file.copy( path.fix( k ), path.fix( componentMap[ k ] ) );
				var replacements = replace ? replace[ name ] || false : false;

                if (  componentMap[ k ] !== false){
                    copyReplace( path.fix( k ), path.fix( componentMap[ k ] ), replacements );
                }
			}
		}

	}
1142697
function (next) {
            var source = fs.readFileSync(path.join('out', 'wiki', 'REFERENCE.md')).toString(),
                home,
                sidebar;

            // extract sidebar from source
            sidebar = source.replace(/<a name="Collection"><\/a>[\s\S]+/g, '');

            // remove sidebar data from home
            home = source.substr(sidebar.length);

            // add timestamp to sidebar
            sidebar += '\n\n ' + (new Date()).toUTCString();

            async.each([{
                path: path.join('.tmp', 'github-wiki', '_Sidebar.md'),
                data: sidebar
            }, {
                path: path.join('.tmp', 'github-wiki', 'Home.md'),
                data: home
            }], function (opts, next) {
                fs.writeFile(opts.path, opts.data, next);
            }, next);
        }
683652
def ng_save(self, request, *args, **kwargs):
        
        form = self.get_form(self.get_form_class())
        if form.is_valid():
            obj = form.save()
            return self.build_json_response(obj)

        raise ValidationError(form.errors)
875573
private function copyApp()
    {
        // copy MODELS
        $this->copyFilesFromSource($this->appPath . 'Models', app_path('Models'));

        // copy VIEWS
        // replace
        // @include('titan::
        // @extends('titan::
        // $this->view('titan::

        $source = $this->basePath . "resources" . $this->ds . "views";
        $this->copyFilesFromSource($source, resource_path("views"));

        // copy CONTROLLERS
        $this->copyFilesFromSource($this->appPath . "Controllers",
            app_path("Http{$this->ds}Controllers"));

        // copy RouteServiceProvider
        $this->copyRoutesAndProvider();
    }
749290
function angularTemplate (p, json) {

    var prefix = (p.prefix !== "") ? p.prefix + "." : "",
        tpl = 'angular.module("'+ prefix +  p.filename +'",["ng"]).run(["$templateCache",';

    tpl += 'function($templateCache) {';

    for (var key in json) {
        if (json.hasOwnProperty(key)) {
            tpl += '$templateCache.put("'+ key +'",';
            tpl += JSON.stringify(json[key]);
            tpl += ');'
        }
    }

    tpl += '}])';

    return tpl;
}
850168
function clone(git_url, git_ref, clone_dir){
    
    var needsGitCheckout = !!git_ref;
    if (!shell.which('git')) {
        return Q.reject(new Error('"git" command line tool is not installed: make sure it is accessible on your PATH.'));
    }

    // If no clone_dir is specified, create a tmp dir which git will clone into.
    var tmp_dir = clone_dir;
    if(!tmp_dir){
        tmp_dir = path.join(os.tmpdir(), 'git', String((new Date()).valueOf()));
    }
    shell.rm('-rf', tmp_dir);
    shell.mkdir('-p', tmp_dir);
    
    var cloneArgs = ['clone'];
    if(!needsGitCheckout) {
        // only get depth of 1 if there is no branch/commit specified
        cloneArgs.push('--depth=1');
    }
    cloneArgs.push(git_url, tmp_dir);
    return superspawn.spawn('git', cloneArgs)
    .then(function() {
        if (needsGitCheckout){
            return superspawn.spawn('git', ['checkout', git_ref], {
                cwd: tmp_dir
            });
        }
    })
    .then(function(){
        events.emit('log', 'Repository "' + git_url + '" checked out to git ref "' + (git_ref || 'master') + '".');
        return tmp_dir;
    })
    .fail(function (err) {
        shell.rm('-rf', tmp_dir);
        return Q.reject(err);
    });
}
1073442
function copyJekyllConfig() {
    return streamToPromise(
        gulp.src(paths.src.jekyll)
            .pipe(rename('_config.yaml'))
            .pipe(gulp.dest(paths.out.docs.base))
    );
}
293337
function copyFile(srcPath, destPath) {
        let srcFileInfo = path.parse(srcPath) || {};
        if (!path.extname(destPath) && srcFileInfo.ext) {
            // destination is a directory!
            return copyFileIntoDirectory(srcPath, destPath);
        } else {
            return new Promise(function (resolve, reject) {
                fs.copy(srcPath, destPath, function (err) {
                    if (!err) {
                        resolve();
                    } else {
                        reject(err);
                    }
                });
            });
        }
    }
992712
function (scope, iAttrs, newValue) {
    'use strict';
    var ngModelArr = iAttrs.ngModel.split('.');
    // console.log(JSON.stringify(ngModelArr, null, 2));


    switch (ngModelArr.length) {
    case 1:
        scope.$apply(function () {scope[ngModelArr[0]] = newValue;});
        break;
    case 2:
        scope.$apply(function () {scope[ngModelArr[0]][ngModelArr[1]] = newValue;});
        break;
    case 3:
        scope.$apply(function () {scope[ngModelArr[0]][ngModelArr[1]][ngModelArr[2]] = newValue;});
        break;
    case 4:
        scope.$apply(function () {scope[ngModelArr[0]][ngModelArr[1]][ngModelArr[2]][ngModelArr[3]] = newValue;});
        break;
    case 5:
        scope.$apply(function () {scope[ngModelArr[0]][ngModelArr[1]][ngModelArr[2]][ngModelArr[3]][ngModelArr[4]] = newValue;});
        break;
    default:
        scope.$apply(function () {scope[iAttrs.ngModel] = newValue;});
    }

}
602229
function cloneMetadata(source) {
			var backupMetadata = initMetadata(source.__ui5version);
			for (var index in source.__byIndex__) {
				backupMetadata.__byIndex__[index] = source.__byIndex__[index];
			}
			for (var key in source.__byKey__) {
				backupMetadata.__byKey__[key] = source.__byKey__[key];
			}
			return backupMetadata;
		}
460258
function clone(url, target, ref, key, log, fn) {
  var urlObj = parseurl(url);
  urlObj.auth = key + ':x-oauth-basic';
  var authurl = formaturl(urlObj) + '.git';

  var dir = target + '/.git';

  log('creating dir ' + dir);
  mkdirp(dir, function(err) {
    if (err) return fn(err);

    var remote = git.remote(authurl);
    var repo = git.repo(dir);
    var opts = {};
    opts.want = ref;
    log('fetching ' + url);
    repo.fetch(remote, opts, function(err) {
      if (err) return fn(err);
      log('checking out ' + ref);
      repo.resolveHashish(ref, function(err, hash) {
        if (err) return fn(err);
        log('updating head to ' + hash);
        repo.updateHead(hash, function(err) {
          if (err) return fn(err);
          exec('git checkout ' + hash, {cwd: target}, function(err, stdout, stderr) {
            fn(err);
          });
        });
      });
    });
  });
}
988368
def copy(self, src, dst, suppress_layouts=False):
        
        url = '/'.join([src.drive,
                        'api/copy',
                        str(src.relative_to(src.drive)).rstrip('/')])

        params = {'to': str(dst.relative_to(dst.drive)).rstrip('/'),
                  'suppressLayouts': int(suppress_layouts)}

        text, code = self.rest_post(url,
                                    params=params,
                                    session=src.session,
                                    verify=src.verify,
                                    cert=src.cert)

        if code not in [200, 201]:
            raise RuntimeError("%s" % text)
339
function mdlPublish(pubScope) {
  let cacheTtl = null;
  let src = null;
  let dest = null;

  if (pubScope === 'staging') {
    // Set staging specific vars here.
    cacheTtl = 0;
    src = 'dist/*';
    dest = bucketStaging;
  } else if (pubScope === 'prod') {
    // Set prod specific vars here.
    cacheTtl = 60;
    src = 'dist/*';
    dest = bucketProd;
  } else if (pubScope === 'promote') {
    // Set promote (essentially prod) specific vars here.
    cacheTtl = 60;
    src = `${bucketStaging}/*`;
    dest = bucketProd;
  }

  let infoMsg = `Publishing ${pubScope}/${pkg.version} to GCS (${dest})`;
  if (src) {
    infoMsg += ` from ${src}`;
  }
  console.log(infoMsg);

  // Build gsutil commands:
  // The gsutil -h option is used to set metadata headers.
  // The gsutil -m option requests parallel copies.
  // The gsutil -R option is used for recursive file copy.
  const cacheControl = `-h "Cache-Control:public,max-age=${cacheTtl}"`;
  const gsutilCacheCmd = `gsutil -m setmeta ${cacheControl} ${dest}/**`;
  const gsutilCpCmd = `gsutil -m cp -r -z html,css,js,svg ${src} ${dest}`;

  gulp.src('').pipe($.shell([gsutilCpCmd, gsutilCacheCmd]));
}
1140833
function embed(sourcePath, relativePaths, name, done) {
  var items = '';
  each(relativePaths, function(relativePath, next) {
    var fullPath = path.join(sourcePath, relativePath);
    fs.readFile(fullPath, 'utf8', function(err, text) {
      if (err) return next(err);
      items += '  $templateCache.put(\'' +
        inline(relativePath) + '\', \'' +
        inline(text.trim()) + '\');\n';
      next();
    });
  }, function(err) {
    if (err) return done(err);
    console.log(
      'angular.module(\'' + inline(name) + '\', []).run([\'$templateCache\', function($templateCache) {\n' +
      items +
      '}]);');
    done();
  });
}
699598
def copy(self, src_url, dst_url):
        """"""
        src_bucket, src_key = _parse_url(src_url)
        dst_bucket, dst_key = _parse_url(dst_url)

        if not dst_bucket:
            dst_bucket = src_bucket
        params = {
            'copy_source': '/'.join((src_bucket, src_key)),
            'bucket': dst_bucket,
            'key': dst_key,
        }
        return self.call("CopyObject", **params)
705160
function buildJs() {
  const jsFiles = config.jsCoreFiles;
  config.componentPaths.forEach(component => {
    jsFiles.push(path.join(component, '*.js'));
    jsFiles.push(path.join(component, '**/*.js'));
  });

  gutil.log("building js files...");

  const jsBuildStream = gulp.src(jsFiles)
  .pipe(filterNonCodeFiles())
  .pipe(utils.buildNgMaterialDefinition())
  .pipe(plumber())
  .pipe(ngAnnotate())
  .pipe(utils.addJsWrapper(true));

  const jsProcess = series(jsBuildStream, themeBuildStream())
  .pipe(concat('angular-material.js'))
  .pipe(BUILD_MODE.transform())
  .pipe(insert.prepend(config.banner))
  .pipe(insert.append(';window.ngMaterial={version:{full: "' + VERSION + '"}};'))
  .pipe(gulp.dest(config.outputDir))
  .pipe(gulpif(!IS_DEV, uglify({output: {comments: 'some'}})))
  .pipe(rename({extname: '.min.js'}))
  .pipe(gulp.dest(config.outputDir));

  return series(jsProcess, deployMaterialMocks());

  // Deploy the `angular-material-mocks.js` file to the `dist` directory
  function deployMaterialMocks() {
    return gulp.src(config.mockFiles)
    .pipe(gulp.dest(config.outputDir));
  }
}