Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View fernandoacorreia's full-sized avatar

Fernando Correia fernandoacorreia

View GitHub Profile
@fernandoacorreia
fernandoacorreia / h5bp-twitter-bootstrap
Created February 2, 2012 00:31 — forked from mklabs/bootstrap-plugins.txt
h5bp + twitter bootstrap integration
#!/usr/bin/env bash
src=$PWD
ant_build_script_remote=https://github.com/h5bp/ant-build-script.git
h5bp_remote=git://github.com/h5bp/html5-boilerplate.git
bootstrap_remote=git://github.com/twitter/bootstrap.git
ant_build_script_branch=master
h5bp_branch=master
@fernandoacorreia
fernandoacorreia / Migrations_Configuration.cs
Created February 8, 2012 12:20
bidirectional relationships with EF Code First
using System;
namespace ConsoleApplication1.Migrations
{
using System.Data.Entity.Migrations;
internal sealed class Configuration : DbMigrationsConfiguration<DatabaseContext>
{
public Configuration()
{
@fernandoacorreia
fernandoacorreia / install-rbenv.sh
Created July 25, 2012 17:46
Install rbenv on Ubuntu 12.04
# pre-reqs
sudo apt-get install git-core build-essential libssl-dev libreadline-dev zlib1g-dev libxml2-dev libxslt-dev
# rbenv
cd
git clone https://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL
@fernandoacorreia
fernandoacorreia / restore-wallpaper-rights.ps1
Created November 1, 2012 22:43
Windows PowerShell script to restore the right to set your desktop wallpaper when a group policy blocked it.
# Windows PowerShell script to restore the right to set your desktop wallpaper when a group policy blocked it.
# Must be executed as administrator.
# Automates the steps described at http://neuralfibre.com/paul/it/how-to-block-your-corporate-wallpaper-in-windows
Set-StrictMode -Version 2.0
function enable-privilege {
param(
## The privilege to adjust. This set is taken from
@fernandoacorreia
fernandoacorreia / rssaggregator.groovy
Created November 20, 2012 13:37
Improved XWiki RSS Aggregator Macro
{{groovy}}
import java.util.TreeMap;
import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.io.SyndFeedInput;
import com.sun.syndication.io.XmlReader;
import org.apache.commons.codec.binary.Base64
def urls = [];
def entries = new TreeMap();
@fernandoacorreia
fernandoacorreia / Output.txt
Created December 6, 2012 00:11
Serializes to JSON preserving type information
{
"Id": "b9c9e21a-caa4-4ed9-9282-27a54ad63ac0",
"Body": {
"$type": "ScheduleJobCommand",
"JobName": "name",
"Url": "url"
}
}
{
"Id": "36f4716c-21ee-4854-8313-25adfdd03545",
using System;
using System.Data.Services.Client;
using System.Diagnostics;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.StorageClient;
namespace WorkerRole1
{
public class TableStorageWriter
{
@fernandoacorreia
fernandoacorreia / WorkerRole.cs
Created December 7, 2012 21:52
Asynchronous insert in Azure Tables
using System;
using System.Data.Services.Client;
using System.Diagnostics;
using System.Net;
using System.Threading;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.ServiceRuntime;
using Microsoft.WindowsAzure.StorageClient;
namespace WorkerRole1
@fernandoacorreia
fernandoacorreia / gist:4240367
Created December 8, 2012 14:02
Asynchronous insert in Azure Tables (fragment)
public void Write(TableServiceEntity entity)
{
TableServiceContext context = _tableClient.GetDataServiceContext();
context.AddObject(_tableName, entity);
context.BeginSaveChangesWithRetries((asyncResult => context.EndSaveChangesWithRetries(asyncResult)), null);
}
@fernandoacorreia
fernandoacorreia / WorkerRole.cs
Created December 8, 2012 14:02
Asynchronous insert in Azure Tables (complete example)
using System;
using System.Net;
using System.Threading;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.ServiceRuntime;
using Microsoft.WindowsAzure.StorageClient;
namespace WorkerRole1
{
public class WorkerRole : RoleEntryPoint