Skip to content

Instantly share code, notes, and snippets.

@JustinBeckwith
JustinBeckwith / gist:3978630
Created October 30, 2012 06:30
deploy script
@echo off
:: Specify project file
IF "%PROJECT%" == "" (
SET PROJECT="DeploymentScriptDemo\DeploymentScriptDemo.csproj"
)
IF "%PROJECT%" == "PROJECTFILEGOESHERE" goto MissingProject
:: Specify project configuration
@JustinBeckwith
JustinBeckwith / gist:4946453
Created February 13, 2013 17:39
snippets
<DataTemplate
x:Key="SnippetItemInGallery">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition
Width="*" />
<ColumnDefinition
Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel
@JustinBeckwith
JustinBeckwith / gist:5260480
Created March 28, 2013 03:58
Ask a user to install a Chrome extension given an extensionID from C#
var chromeAppDataPath = Path.Combine(Environment.GetEnvironmentVariable("localappdata"), @"Google\Chrome");
var chromeExtensionId = "clopmcfjibhgfnagfneonflajbjidfai";
if (Directory.Exists(chromeAppDataPath))
{
var extensionsPath = Path.Combine(chromeAppDataPath, @"User Data\Default\Extensions\" + chromeExtensionId);
if (!Directory.Exists(extensionsPath))
{
Process.Start(new ProcessStartInfo()
{
FileName = Path.Combine(chromeAppDataPath, @"Application\chrome.exe"),
@JustinBeckwith
JustinBeckwith / app.yaml
Created October 6, 2015 04:41
Using memcached for session state with express and nodejs on AppEngine
runtime: nodejs
api_version: 1
vm: true
env_variables:
PORT: 8080
MEMCACHE_URL: memcache:11211
@JustinBeckwith
JustinBeckwith / package.json
Created November 2, 2015 02:32
engines package.json
{
"name": "koa-appengine",
"version": "1.0.0",
"description": "An example of deploying a koa app to Google App Engine",
"main": "app.js",
"dependencies": {
"koa": "^0.21.0"
},
"devDependencies": {},
"scripts": {
@JustinBeckwith
JustinBeckwith / index.html
Created November 6, 2015 22:42
Quick example of server side events in nodejs
<!DOCTYPE html>
<html>
<head>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js'></script>
<script src='http://jquery-json.googlecode.com/files/jquery.json-2.2.min.js'></script>
<script>
var source = new EventSource('/streeeem');
source.addEventListener('message', function(e) {
console.log(e);
$('ul').append('<li>' + e.data + ' (message id: ' + e.lastEventId + ')</li>');
@JustinBeckwith
JustinBeckwith / package.json
Created January 5, 2016 17:04
deasync sample
{
"name": "inittest",
"version": "1.0.0",
"description": "",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js"
},
"author": "",
This file has been truncated, but you can view the full file.
12006 verbose get https://registry.npmjs.org/lru-cache not expired, no request
12007 silly addNameRange number 2 { name: 'lru-cache', range: '>=2.6.5 <3.0.0', hasData: true }
12008 silly addNameRange versions [ 'lru-cache',
12008 silly addNameRange [ '1.0.1',
12008 silly addNameRange '1.0.2',
12008 silly addNameRange '1.0.3',
12008 silly addNameRange '1.0.4',
12008 silly addNameRange '1.0.5',
12008 silly addNameRange '1.0.6',
12008 silly addNameRange '1.1.0',
@JustinBeckwith
JustinBeckwith / vision.js
Created March 18, 2016 21:12
Google Cloud Vision API with Node.js example
var gcloud = require('gcloud')({
projectId: 'my-project',
keyFilename: 'keyfile.json'
});
var vision = gcloud.vision();
vision.detectText('./image.jpg', function(err, text) {
if (text.length > 0) {
console.log('We found text on this image...');
}
-- warning: this query looks at ~2 TB of data and will cost ~$10 to run.
SELECT
COUNT(*) as cnt, package
FROM
JS(
(SELECT content FROM [bigquery-public-data:github_repos.contents] WHERE id IN (
SELECT id FROM [bigquery-public-data:github_repos.files] WHERE RIGHT(path, 12) = "package.json"
)),
content,
"[{ name: 'package', type: 'string'}]",