Skip to content

Instantly share code, notes, and snippets.

View KushalP's full-sized avatar

Kushal Pisavadia KushalP

View GitHub Profile
@KushalP
KushalP / file_metadata_test.cc
Created June 24, 2011 12:11
File would be placed in src/chrome/browser/mac/ and is testing the file_metadata::_ functionality
// Copyright (c) 2011 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.
#include "base/file_path.h"
#include "base/path_service.h"
#include "base/scoped_temp_dir.h"
#include "chrome/browser/mac/file_metadata.h"
#include "googleurl/src/gurl.h"
#include "testing/gtest/include/gtest/gtest.h"
@KushalP
KushalP / chrome_tests.diff
Created June 27, 2011 13:57
Adding file_metadata_test.cc to the test files for Chromium
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index fe02711..3a000dc 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -535,6 +535,7 @@
'sources!': [
# TODO(port)
'browser/debugger/devtools_sanity_unittest.cc',
+ 'browser/mac/file_metadata_test.cc',
'browser/ui/views/bookmarks/bookmark_bar_view_test.cc',
ps -eo pid,pcpu,args | sort +1n | grep -i java
[user]
name = X
email = [email protected]
[color]
diff = auto
status = auto
branch = auto
ui = auto
alias chrup="cd ~/chromium/src; git checkout trunk; git pull; cd ..; gclient sync --force; cd src/; GYP_GENERATORS=make gclient runhooks"
alias chrclang="cd ~/chromium/src; GYP_GENERATORS=make GYP_DEFINES=clang=1 ./build/gyp_chromium; export CC=$PWD/third_party/llvm-build/Release+Asserts/bin/clang; export CXX=$PWD/third_party/llvm-build/Release+Asserts/bin/clang++;"
@KushalP
KushalP / cat.clj
Created September 10, 2011 14:30
A bad imitation of unix cat
(defn cat [f]
^{:doc "A bad imitation of unix cat"}
(println (slurp f)))
(cat "cat.clj")
namespace base {
namespace mac {
template<typename T> T CFCast(CFTypeRef cf_val) {
if (!cf_val) return NULL;
if (CFGetTypeID(cf_val) == CFStringGetTypeID()) {
return (CFStringRef)cf_val;
}
@KushalP
KushalP / auth.js
Created October 20, 2011 12:58
Capture the 401 Authentication code
// A lazy raw JS function to quickly play with this.
function getHTTPObject() {
if (typeof XMLHttpRequest != 'undefined') {
return new XMLHttpRequest();
}
try {
return new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
return new ActiveXObject("Microsoft.XMLHTTP");
@KushalP
KushalP / spike.coffee
Created December 28, 2011 22:22
CoffeeScript API Example
class Server
constructor: (@name = "Base Server", @host = "", @port = 80, @uri = "/") ->
parse: (json) ->
false
url: ->
@host + ":" @port + @uri
toString: ->
{
'target_name': 'cloud_policy_proto_compile',
'type': 'static_library',
'sources': [ '<(SHARED_INTERMEDIATE_DIR)/policy/cloud_policy.proto' ],
'variables': {
'proto_in_dir': '????',
'proto_out_dir': '<(SHARED_INTERMEDIATE_DIR)/protoc_out',
},
'includes': [ '../build/protoc.gypi' ]
},