Skip to content

Instantly share code, notes, and snippets.

View Naouak's full-sized avatar
👻

Quentin B Naouak

👻
View GitHub Profile
@Naouak
Naouak / words.sh
Last active August 29, 2015 14:06
Random French Noun generator Bash based on words frequency in corpus
#!/bin/bash
# Liste des mots disponible ici : http://www.lexique.org/telLexique.php
WORD_COUNT=$1
if [ -z "$WORD_COUNT" ]; then
WORD_COUNT=1
fi
LC_NUMERIC="C"
@Naouak
Naouak / matrix_multiplication.js
Created October 6, 2014 20:03
Matrices Multiplication
function multiply(a,b){
return a.map(function(v,i){
v.map(function(w,j){
var sum = 0;
for(var k = 0; k < v.length; k++){
sum+=a[i][k]*b[k][j];
}
return sum;
});
});
@Naouak
Naouak / mymodellist
Created December 9, 2011 16:59
Some modellist test
YUI.add("mymodellist",function(Y){
Y.namespace('mymvc').MyModellist = Y.Base.create(
"mymodellist",
Y.ModelList,
[],
{
model: Y.mymvc.MyModel,
fetch: function(start,count,callback){
Y.io("somejson.json",{
data: {
@Naouak
Naouak / jpackage.sh
Created January 10, 2012 17:10
Joomla Auto Packager
#!/bin/bash
function JPackage {
echo -e "\\033[1;34m" Removing all zip files from folder;
rm *.zip;
echo -e "\\033[1;34m" Done;
for file in *; do
if [ -d $file ]; then
@Naouak
Naouak / test.js
Created January 31, 2012 20:32
Model Bug
YUI({
combine: false,
base: "/yui3/build/"
}).use("app","handlebars","jsonp",function(Y){
/**
* Article Model
**/
var Article = Y.Base.create("article",Y.Model,[],{
idAttribute: 'articleId'
},{
@Naouak
Naouak / gist:1952656
Created March 1, 2012 19:55
WHERE with "AND" AND "OR"
<?php
/**
* Add a single condition, or an array of conditions to the WHERE clause of the query.
*
* Usage:
* $query->where('a = 1')->where('b = 2');
* $query->where(array('a = 1', 'b = 2'));
*
* @param mixed $conditions A string or array of where conditions.
* @param string $glue The glue by which to join the conditions. Defaults to AND.
@Naouak
Naouak / jtranslate
Created March 29, 2012 20:33
Auto translation script for joomla
function JTranslate {
COMPONENT=$1;
COMPONENTUPPER=`echo $COMPONENT | sed y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/`;
touch ../../language/en-GB/en-GB.$COMPONENT.ini;
{ find . -exec grep -o `echo $COMPONENTUPPER"[A-Z0-9_]*"` {} \; | sort -u && find ../../language/en-GB/en-GB.$COMPONENT.ini -exec grep -o `echo $COMPONENTUPPER"[A-Z0-9_]*"` {} \; | sort -u;} | sort | uniq -u | sed s/$/=\"\"/ >> ../../language/en-GB/en-GB.$COMPONENT.ini;
vim ../../language/en-GB/en-GB.$COMPONENT.ini;
}
@Naouak
Naouak / gist:270df7ee30bc232e77b6
Created July 11, 2012 16:36
TextNode near Input finder
(function(){
function nativeTreeWalker() {
var walker = document.createTreeWalker(
document.body,
NodeFilter.SHOW_TEXT,
null,
false
),node,textNodes = [];
while (node = walker.nextNode()) {
if (node.nodeValue) {
@Naouak
Naouak / install.sh
Created February 13, 2012 18:33
Joomla Extension installation with command line
#!/bin/sh
# Joomla extension auto installation
# Use that for development purpose, don't ever think of using it on a production website.
# The developer of that script won't endorse any problem you may encounter by using this script: Use it at your own risk!
# Please configure the three first params before using it.
# Usage :
# ./install.sh
# Will try to install every dir in the current dir
# ./install.sh directory
@Naouak
Naouak / script.js
Created January 15, 2013 22:19
A short script that will inject on any animelist on MyAnimeList scores that are scaled from 0 to 10. It means that if your lowest score is 5, it will become 0. It also calculate some values that you may find interesting and put it in variables. To use it, just paste this in your chrome console when you are on an anime list.
var n = document.querySelectorAll(".animetitle");
var arr = [];
var min = null;
var max = null;
var total = 0;
var count = 0;
var noteCount = {};
for (var i = n.length - 1; i >= 0; i--) {
(function(n){