Skip to content

Instantly share code, notes, and snippets.

@mallain
mallain / template.cs
Created September 12, 2011 21:26
Extract from my QVSource Yammer Connector
/*******************************************************************************
* Write Table for Messages Table Yammer
* *****************************************************************************/
private DataTable writeTableMessages(IProgress prog, ITableWriter tblWriter)
{
if (_dtMessages == null)
{
// Requete sur API Yammer
string res = _oauth.Get("https://www.yammer.com/api/v1/messages.json");
@mallain
mallain / car.cs
Created September 11, 2011 20:57
//La syntaxe de développement n'est pas respecté.
//Juste un exemple de POO.
// Ma classe Car
public class Car{
public integer roues;
public integer porte;
public integer puissance;
// Mon constructeur
@mallain
mallain / YammerConnector.cs
Created September 11, 2011 18:24
YammerConnector for QVSource
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IndustrialCodeBox.APIConnector;
using IndustrialCodeBox.APIConnector.Interfaces;
using System.Data;
using System.Collections.Specialized;
using System.Windows.Forms;
@mallain
mallain / alerteBC.rb
Created August 24, 2011 22:22
Ruby File for parsing RSS
#!/usr/bin/ruby
require 'rss/1.0'
require 'rss/2.0'
require 'open-uri'
require 'rss/maker'
source = "rss_voiture.xhtml" # url or local file
#source = "http://alerte-leboncoin.ilatumi.org/feed/rss?link=http%3A%2F%2Fwww.leboncoin.fr%2Fvoitures%2Foffres%2Fpays_de_la_loire%2F%3Ff%3Da%26th%3D1"
content = "" # raw content of rss feed will be loaded here
@mallain
mallain / gist:1147060
Created August 15, 2011 15:59
SQLite Tips
//Add several columns on a table
alter table tfa_data add column TEMP1 float;
alter table tfa_data add column TEMP2 float;
alter table tfa_data add column TEMP3 float;
// Update columns with randoms float (20 to 40)
update tfa_data
<?php
$var = 'niii';
// Quote simple
$query = 'SELECT password from users where login = "' . $var . '"';
echo $query;
// Exemples disponibles sur siteduzero.com
\documentclass[a4paper,11pt]{report}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{microtype}
\usepackage{hyperref}
@mallain
mallain / OUTPUT
Created September 13, 2010 12:44
mickael@mickael-laptop:~/projects/pabd/test (master*!) 14:40:08
2040/93 > ruby unit/validation_state_test.rb
Loaded suite unit/validation_state_test
Started
.........
Finished in 1.42106 seconds.
9 tests, 9 assertions, 0 failures, 0 errors
>> a = User.find(2)
=> #<User id: 2, email: "vincent.riviere@company.com", crypted_password: "ef0e221eed190211d5f3c5e74c82da3ac24a5a5a0ac18027a7a...", password_salt: "eetQTWZfnLG7KZmKfaH", persistence_token: "706a2857e2e4c6e80eec3ed0b779fe3c755b4b7446f3d1aa482...", created_at: "2010-09-07 15:23:00", updated_at: "2010-09-07 15:34:22", role: "poweruser", failed_login_count: 0>
# Test validate avec save callback
>> a.agencies
=> [#<Agency id: 19, name: "Nord", division_id: 1, created_at: "2010-09-07 15:22:00", updated_at: "2010-09-07 15:22:00", parent_id: nil>, #<Agency id: 1, name: "Nord-Ouest", division_id: 1, created_at: "2010-09-07 15:21:58", updated_at: "2010-09-07 15:21:58", parent_id: nil>]
>> a.valid?
=> true
>> a.agencies = []
=> []
# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
helper :all # include all helpers, all the time
protect_from_forgery # See ActionController::RequestForgeryProtection for details
before_filter :set_locale
# Scrub sensitive parameters from your log
filter_parameter_logging :password, :password_confirmation