Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@tonysneed
tonysneed / Mac OS X: Open in Visual Studio Code
Last active March 27, 2024 10:02
Add a command to Finder services in Mac OSX to open a folder in VS Code
- Open Automator
- File -> New -> Service
- Change "Service Receives" to "files or folders" in "Finder"
- Add a "Run Shell Script" action
- Change "Pass input" to "as arguments"
- Paste the following in the shell script box: open -n -b "com.microsoft.VSCode" --args "$*"
- Save it as something like "Open in Visual Studio Code"
@DamianEdwards
DamianEdwards / Default.aspx
Created July 17, 2013 04:00
Simple way to do async UI loading in ASP.NET Web Forms with standard controls
<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Import Namespace="System.Threading" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
uint viewIndex = 0;
uint.TryParse(Request.QueryString["view"], out viewIndex);
views.ActiveViewIndex = (int)(viewIndex < views.Views.Count ? viewIndex : 0);
@jakemmarsh
jakemmarsh / controllers.js
Last active May 20, 2019 10:15
AngularJS Service with Controller for access to Google API with Javascript Client (and RequireJS)
define(['angular', 'services'], function (angular) {
'use strict';
return angular.module('myApp.controllers', ['myApp.services'])
.controller('IndexCtrl', ['$scope', 'googleService', function ($scope, googleService) {
$scope.login = function () {
googleService.login().then(function (data) {
// do something with returned data
console.log(data.email);
@robertmclaws
robertmclaws / DecryptingSqlMembershipProvider.cs
Created May 10, 2013 23:36
Code to use SimpleMembership if your logins are encrypted and not hashed. Works in conjunction with the concepts and Account Controller code outlined at http://pretzelsteelersfan.blogspot.com/2012/11/migrating-legacy-apps-to-new.html
using System;
using System.Text;
using System.Web.Security;
namespace AdvancedREI.Providers
{
public class DecryptingSqlMembershipProvider : SqlMembershipProvider
{
/// <summary>
// Load the Facebook API
window.fbAsyncInit = function() {
FB.init({
appId : 'YOUR_APP_ID',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
// Browser-specific hacks to make FB Connect more reliable
//detect Internet Explorer and version number through injected conditional comments (no UA detect, no need for cond. compilation / jscript check)
//version arg is for IE version (optional)
//comparison arg supports 'lte', 'gte', etc (optional)
var isIE = (function(undefined){
var doc = document,
doc_elem = doc.documentElement,
cache = {},