Skip to content

Instantly share code, notes, and snippets.

View guenodz's full-sized avatar

Mohamed Guendouz guenodz

View GitHub Profile
@guenodz
guenodz / addition.l
Created November 27, 2017 12:30
Sample lex+yacc program
%{
#include <stdlib.h>
#include "y.tab.h"
%}
%%
[0-9]+ {
yylval = atoi(yytext);
return ENTIER;
}
[-+\n] return *yytext;
// Find the total number of posts
db.getCollection('COLLECTION_NAME').find({}).count()
// Find posts published before a particular date (Ex: before April 4th, 2016)
db.getCollection('COLLECTION_NAME').find({"created_time" : {$lt: ISODate("2016-04-04T00:00:00.000Z")} })
// Find posts published after a particular date (Ex: after April 4th, 2016)
db.getCollection('COLLECTION_NAME').find({"created_time" : {$gt: ISODate("2016-04-04T00:00:00.000Z")} })
// Find posts published between two particular dates sorted in an ascending order (Ex: between April 4th, 2016 and May 4th, 2016)
[
...
{
"_id" : ObjectId("59766c9dd95ba6044cbfa8d7"),
"created_time" : ISODate("2016-12-30T21:38:05.000Z"),
"from" : {
"name" : "Belghit Ismail",
"id" : "586200464846313"
},
"message" : "salam ala'ikom ,\nany one interested in Nodejs here \njust asking :).",
@guenodz
guenodz / SplashScreenActivity.java
Created September 16, 2016 17:59
This gist shows a splash screen animation in Android like in Tinder mobile app
package org.gdgsba.gdgdevfest.view.activity;
import android.animation.AnimatorInflater;
import android.animation.AnimatorSet;
import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import org.gdgsba.gdgdevfest.R;
import org.gdgsba.gdgdevfest.databinding.SplashScreenActivityBinding;
@guenodz
guenodz / TFIDFCalculator.java
Created February 17, 2015 11:35
a simple implementation of TF-IDF algorithm in Java.
package com.guendouz.textclustering.preprocessing;
import java.util.Arrays;
import java.util.List;
/**
* @author Mohamed Guendouz
*/
public class TFIDFCalculator {
/**
@guenodz
guenodz / ConnectionManager.java
Last active December 14, 2015 06:09
A Java class for SQLite conection Helper.
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class ConnectionManager {
private static Connection connection;
// path to the database file
private static final String dbPath = "tips.db";