Skip to content

Instantly share code, notes, and snippets.

View gideondsouza's full-sized avatar

Gideon Israel Dsouza gideondsouza

  • Dransfeld, Germany
View GitHub Profile
@gideondsouza
gideondsouza / ExportToCsvExtension.cs
Created December 2, 2011 11:46
An extension to export any IEnumerable<T> to CSV
using System.Text;
using System.Linq;
using System.Collections.Generic;
namespace Gideon.Extensions
{
static class ExportToCsvExtension
{
//awesomeness!! XD
//found this at http://mikehadlow.blogspot.com/2008/06/linq-to-csv.html tweaked and fixed it
@gideondsouza
gideondsouza / gist:2864370
Created June 3, 2012 18:03
Getting users location via network
Button btnLocation = (Button)findViewById(R.id.btnLocation);
btnLocation.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
// Acquire a reference to the system Location Manager
LocationManager locationManager =
(LocationManager) AddressPOCActivity.this.getSystemService(Context.LOCATION_SERVICE);
// Define a listener that responds to location updates
LocationListener locationListener = new LocationListener() {
public void onLocationChanged(Location location) {
// Called when a new location is found by the network location provider.
@gideondsouza
gideondsouza / 0001-Updated-known_pod_issues-by-running-.-perl-podcheck..patch
Created October 3, 2013 15:40
0001-Updated-known_pod_issues-by-running-.-perl-podcheck..patch
From d233e024722a0d05ce9d70eeeaaffa0517579ea2 Mon Sep 17 00:00:00 2001
From: Gideon Israel Dsouza <gidisrael@gmail.com>
Date: Wed, 2 Oct 2013 21:12:21 +0530
Subject: [PATCH 1/3] Updated known_pod_issues by running ./perl podcheck.t
--regen
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------1.7.12.4 (Apple Git-37)"
This is a multi-part message in MIME format.
--------------1.7.12.4 (Apple Git-37)
@gideondsouza
gideondsouza / build.log
Created September 3, 2013 07:54
build log for Dist::Zilla install.
cpanm (App::cpanminus) 1.6005 on perl 5.016003 built for MSWin32-x64-multi-thread
Work directory is C:\Users\GIDEON~1.CON/.cpanm/work/1378190596.8644
You have make C:\strawberry\c\bin\dmake.exe
You have LWP 6.04
Falling back to Archive::Tar 1.90
Searching Dist::Zilla on cpanmetadb ...
--> Working on Dist::Zilla
Fetching http://www.cpan.org/authors/id/R/RJ/RJBS/Dist-Zilla-4.300037.tar.gz
-> OK
Unpacking Dist-Zilla-4.300037.tar.gz
@gideondsouza
gideondsouza / SieveofEratosthenes.cs
Created March 5, 2012 15:49
Sieve of Eratosthenes C# implementation
long sum = 0;
long n = 2000000;
bool[] e = new bool[n];//by default they're all false
for (int i = 2; i < n; i++)
{
e[i] = true;//set all numbers to true
}
//weed out the non primes by finding mutiples
for (int j = 2; j < n; j++)
{
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
public ActionResult Upload()
{
var file = Request.Files["Filedata"];
string savePath = Server.MapPath(@"~\Content\" + file.FileName);
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>::Uploadify Example::</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="@Url.Content("~/Scripts/jquery.uploadify-3.1.min.js")"></script>
require 'sinatra'
get '/' do
erb :form_multiple
end
post '/upload' do
#this method will get as ajax call for every file uploaded
@filename = params[:Filename]
file = params[:Filedata][:tempfile]
<html>
<head>
<title>Image Upload</title>
<link rel="stylesheet" type="text/css" href="uploadify.css" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="jquery.uploadify.min.js"></script>
</head>
<body>
<h1>Upload Images</h1>
<html>
<head>
<title>Show Image</title>
</head>
<body>
<h1>See Image</h1>
<img src="<%= @filename %>" />
</body>
</html>