Skip to content

Instantly share code, notes, and snippets.

View loic-sharma's full-sized avatar

Loïc Sharma loic-sharma

View GitHub Profile
@loic-sharma
loic-sharma / gist:823f5377c227481cce20
Created September 12, 2015 18:00
GeoFire example
func relevantEventsForLocation(location: CLLocation, withBlock: ([Event]) -> ()) {
let root = Firebase(url: "https://pikapic.firebaseio.com")
let geoFire = GeoFire(firebaseRef: root)
var circleQuery = geoFire.queryAtLocation(location, withRadius: 0.6)
let span = MKCoordinateSpanMake(0.001, 0.001)
let region = MKCoordinateRegionMake(location.coordinate, span)
var query = geoFire.queryWithRegion(region)
@loic-sharma
loic-sharma / Program.cs
Last active December 15, 2016 08:30
CLR Bytecode Generation to Get All Properties/Set All Fields from Types Unknown At Build-Time
using System;
using System.Reflection;
using System.Reflection.Emit;
namespace ConsoleApplication1
{
public class From
{
public string Hello { get; set; }
public int World { get; set; }
@loic-sharma
loic-sharma / 0001-Added-tab-for-Paket.patch
Last active September 1, 2017 22:58
Add Paket tab to NuGet Gallery
From 0c8eb16ecaeedf9ddfd1fc10944dbdef5bd094f0 Mon Sep 17 00:00:00 2001
From: Loic Sharma <sharma.loic@gmail.com>
Date: Fri, 1 Sep 2017 15:56:49 -0700
Subject: [PATCH] Added tab for Paket
---
src/NuGetGallery/Views/Packages/DisplayPackage.cshtml | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/NuGetGallery/Views/Packages/DisplayPackage.cshtml b/src/NuGetGallery/Views/Packages/DisplayPackage.cshtml
AjaxMin
AjaxGridScaffolder
AntiXSS
AspNetMvc
AspNetSprites-MvcAndRazorHelper
AspNetWebPagesCore
AspNetSprites-Core
AspNetSprites-WebFormsControl
Calendar.Template
DynamicData.EFCodeFirstProvider
@loic-sharma
loic-sharma / CreateNonCommunityPackageSet.ps1
Created November 7, 2017 17:02
[NuGet] Powershell script to import Non-Community Packages to Statistics Database
# The query that should be used to generate the CSV file from the Gallery DB:
#
# SELECT pr.[Id]
# FROM [dbo].[PackageRegistrations] pr
# INNER JOIN [dbo].[PackageRegistrationOwners] pro
# ON pr.[Key] = pro.[PackageRegistrationKey]
# INNER JOIN [dbo].[Users] u
# ON pro.[UserKey] = u.[Key]
# WHERE u.[Username] IN ('microsoft', 'dotnetframework')
# GROUP BY pr.[Id]
@loic-sharma
loic-sharma / CreateNonCommunityPackageSet.sql
Created November 7, 2017 17:04
[NuGet] SQL Queries to Create the Non-Community Package Set in Statistics DB
BEGIN TRANSACTION;
IF NOT EXISTS (SELECT * FROM [dbo].[Dimension_PackageSet] WHERE [Name] = 'NonCommunityPackages')
BEGIN
INSERT INTO [dbo].[Dimension_PackageSet] (Name) VALUES ('NonCommunityPackages')
END
DECLARE @NonCommunityPackagesId int = (SELECT [Id] FROM [dbo].[Dimension_PackageSet] WHERE [Name] = 'NonCommunityPackages');
DELETE FROM [dbo].[Fact_Package_PackageSet]
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:async/async.dart';
import 'package:watcher/watcher.dart';
watchCurrentDirectory(List<String> arguments) async {
var watcher = new DirectoryWatcher(Directory.current.path);
while (true) {
@loic-sharma
loic-sharma / Test.cs
Created February 6, 2018 21:40
Flag tests (for revocation)
using System;
using System.Linq;
public class Program
{
[Flags]
public enum E
{
None = 0,
[CmdletBinding()]
Param(
[Parameter(Mandatory = $true)]
[string]$Port
)
@(
"newtonsoft.json/10.0.3",
"owin/1.0.0",
"newtonsoft.json/9.0.1",
@loic-sharma
loic-sharma / Program.cs
Created April 30, 2018 23:20
Blob Storage Profiling Test
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Blob;
namespace ConsoleApp6
{
class Program