Skip to content

Instantly share code, notes, and snippets.

View balexandre's full-sized avatar
🙃

Bruno Alexandre balexandre

🙃
View GitHub Profile
public class DataTranslator
{
public static Func<IDataRecord, T> CreateTranslator<T>(IDataRecord record)
{
Type targetType = typeof(T);
string cacheKey = string.Format("{0}-Translator", targetType);
var cachedTranslator = WebContextCache.GetItem<Func<IDataRecord, T>>(cacheKey);
if (cachedTranslator != null)
@mmriis
mmriis / gist:1286783
Created October 14, 2011 10:35
CVR.dk
http://cvr.dk/Site/Forms/PublicService/DisplayCompany.aspx?cvrnr=30505166
def extract_name(doc)
(doc/"div.titletext").inner_html.strip
end
def extract_address(doc)
(doc/"tr:contains('Adresse')/td.fieldvalue").inner_html =~ /^(.+)<br\W+\d{4}\W+(.+)$/
$~[1].strip.gsub("<br />", ", ")
end
public class Analytics
{
// Tracker version.
private const string Version = "4.4sa";
private const string CookieName = "__utmmobile";
// The path the cookie will be available to, edit this to use a different
// cookie path.
private const string CookiePath = "/";
@Korayem
Korayem / TrackEventsInGoogleAnalyticsAttribute.cs
Created June 4, 2012 15:58
A cool ActionFilter that when dropped over any controller or action, you got yourself google analytics event tracking! By default we assign controller name as category, and action name as the action. In the label we drop the user identity in case he/she i
using System.Configuration;
using System.Web.Mvc;
using GoogleAnalyticsTracker;
using SocialFruits.Domain;
using SocialFruits.Domain.Entities;
namespace SocialFruits.Extensions.Attributes
{
public class TrackEventsInGoogleAnalyticsAttribute : ActionFilterAttribute
{
@brianleroux
brianleroux / web-based-diagramming-tools.md
Created September 8, 2012 19:37
I asked about web based diagramming tools on twitter. Ppl answered!
@eddwo
eddwo / gist:5423102
Created April 19, 2013 20:44
Comment spam generator based on the template discovered by Scott Hanselman https://gist.github.com/shanselman/5422230
abstract class Comment
{
public abstract void Generate(StringBuilder builder);
public string Generate()
{
StringBuilder builder = new StringBuilder();
this.Generate(builder);
return builder.ToString();
}
#Function to fetch the data from Wolfram|Alpha API based on user query
Function Invoke-WolframAlphaAPI($Query)
{
Return (Invoke-RestMethod -Uri "http://api.wolframalpha.com/v2/query?appid=APIKEY&input=$($Query.Replace(' ','%20'))").queryresult
}
#Eventhandler and Flow control once the Search button is pressed
$EventHandler =[System.EventHandler]{
$Panel2.Visible = $False
@lmartins
lmartins / SassMeister-input-HTML.html
Created January 27, 2014 19:25
Creating SASS mixins aliases
<button>Alerted</button>
@lavoiesl
lavoiesl / bs3-stacked-tabs.less
Created September 18, 2013 15:21
Add tabs-left, tabs-right and tabs-below in bootstrap 3 Credit: http://stackoverflow.com/questions/18432577/stacked-tabs-in-bootstrap-3
// http://stackoverflow.com/questions/18432577/stacked-tabs-in-bootstrap-3
.tabs-below, .tabs-right, .tabs-left {
.nav-tabs {
border-bottom: 0;
}
}
.tab-content > .tab-pane,
.pill-content > .pill-pane {
display: none;
@benyanke
benyanke / sns-to-slack.js
Last active July 7, 2021 16:02 — forked from vgeshel/function.js
AWS Lambda function for forwarding SNS notifications to Slack
// Added by Ben Yanke
// from https://gist.github.com/benyanke/862e446e5a816551928d8acc2d98b752
console.log('Loading function');
const https = require('https');
const url = require('url');
// SETUP
// urlToUse = in this environment variable, place the name of another environment variable which contains the key.
// This allows easy dev/prod switching.