Skip to content

Instantly share code, notes, and snippets.

View paulodiogo's full-sized avatar
🤘

Paulo Leão paulodiogo

🤘
View GitHub Profile
@gipi
gipi / MyMapConverter.java
Created December 14, 2011 10:11
Java: using custom converter that maps an XML in a Map using an attribute as key.
package com.example.android;
import com.thoughtworks.xstream.*;
import com.thoughtworks.xstream.io.*;
import com.thoughtworks.xstream.mapper.*;
import com.thoughtworks.xstream.converters.*;
import com.thoughtworks.xstream.converters.collections.*;
import java.util.*;
@Takazudo
Takazudo / dateconvert.js
Created March 9, 2012 16:03
Backbone.js date convert
var MyModel = Backbone.Model.extend({
initialize: (attrs){
var self = this;
self.updateDate();
self.bind('change:date', function(){
self.updateDate();
});
},
updateDate: function(){
var date = this.get('date');
@huyderman
huyderman / Newline.cs
Created March 16, 2012 13:20
C# Normalize Newline
using System.Text.RegularExpressions;
public static class StringHelpers {
private const char _cr = '\u000D';
private const char _lf = '\u000A';
private const string _crlf = _cr + _lf;
private static Regex _crlfRegex = new Regex(_cr + '|' + _lf + '|' + _crlf);
public static string NormalizeNewline(this string str){
@dstroot
dstroot / install_postgresql.sh
Created June 13, 2012 00:26
Install PostgreSQL on Amazon AMI
#!/bin/bash
###############################################
# To use:
# https://raw.github.com/gist/2776351/???
# chmod 777 install_postgresql.sh
# ./install_postgresql.sh
###############################################
echo "*****************************************"
echo " Installing PostgreSQL"
echo "*****************************************"
@stevedonovan
stevedonovan / ChartExample.java
Last active January 13, 2022 09:36
Android Example using AChartEngine to plot JSON data
package com.example.testchart;
import java.util.*;
import java.io.*;
import java.text.DateFormat;
import android.os.Bundle;
import android.app.Activity;
import android.util.Log;
import android.view.*;
@mnewt
mnewt / bootstrap-tabs.html
Created December 6, 2012 20:28
bootstrap tabs example
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Le styles -->
<link href="../bootstrap/css/bootstrap.css" rel="stylesheet">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js"></script>
</head>
<body>
// Copyright (c) 2013 Daniel Grunwald
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
@arriolac
arriolac / Android Studio Tricks.md
Last active January 28, 2022 02:40
Some Android Studio Tricks.

Android Studio Notes

Android Studio keyboard shortcuts I use often.

Keyboard Shortcuts for Mac

  • SHIFT + F6 to refactor methods, classes, and variable names
  • CTRL + O to override methods
  • COMMAND + N
    • Generate getter, setter, and constructor method for a class (when in editor pane)
@Virtlink
Virtlink / TypeSwitch.cs
Last active March 9, 2019 17:11
Switch on type. The order of the Case() methods is important.
using System;
namespace Virtlink
{
/// <summary>
/// Executes a particular piece of code based on the type of the argument.
/// </summary>
/// <example>
/// Usage example:
/// <code>
@alexeyzimarev
alexeyzimarev / NHibernateSqlProcedureHelper.cs
Created December 12, 2014 10:21
Execute stored procedure and get return value, using NHibernate session
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using NHibernate;
namespace NHibernate.Helpers
{
public static class SqlProcedureHelper
{