Skip to content

Instantly share code, notes, and snippets.

View gmolveau's full-sized avatar

Grégoire MOLVEAU gmolveau

View GitHub Profile
@hmbilal
hmbilal / README.md
Last active June 18, 2019 15:05
Long polling service in AngularJS

Then in your controller, inject $polling and start polling like this.

General use

$polling.startPolling({name_of_this_polling}, {url_to_fetch_data_from}, {time_in_milli_seconds}, {callback});

Example,

$polling.startPolling('fetchNotifications', 'http://localserver.local/fetch/notifications', 10000, $scope.processData);

@alekseykulikov
alekseykulikov / index.md
Last active April 14, 2024 00:32
Principles we use to write CSS for modern browsers

Recently CSS has got a lot of negativity. But I would like to defend it and show, that with good naming convention CSS works pretty well.

My 3 developers team has just developed React.js application with 7668 lines of CSS (and just 2 !important). During one year of development we had 0 issues with CSS. No refactoring typos, no style leaks, no performance problems, possibly, it is the most stable part of our application.

Here are main principles we use to write CSS for modern (IE11+) browsers:

@paceaux
paceaux / tinyRules.css.md
Last active May 19, 2024 11:15
Tiny rules for how to name things in CSS and JS

Tiny rules for how to name stuff

CSS

How to name CSS classes

Stateful Class names

Is it a state that is only one of two conditions? (i.e. a boolean)

@sirodoht
sirodoht / migrate-django.md
Last active April 20, 2024 09:52
How to migrate Django from SQLite to PostgreSQL

How to migrate Django from SQLite to PostgreSQL

Dump existing data:

python3 manage.py dumpdata > datadump.json

Change settings.py to Postgres backend.

Make sure you can connect on PostgreSQL. Then:

@ahmed-musallam
ahmed-musallam / compress_pdf.md
Last active June 10, 2024 07:51
How to compress PDF with ghostscript

How to compress PDF using ghostscript

As a developer, it bothers me when someone sends me a large pdf file compared to the number of pages. Recently, I recieved a 12MB scanned document for just one letter-sized page... so I got to googlin, like I usually do, and found ghostscript!

to learn more abot ghostscript (gs): https://www.ghostscript.com/

What we are interested in, is the gs command line tool, which provides many options for manipulating PDF, but we are interested in compressign those large PDF's into small yet legible documents.

credit goes to this answer on askubuntu forum: https://askubuntu.com/questions/3382/reduce-filesize-of-a-scanned-pdf/3387#3387?newreg=bceddef8bc334e5b88bbfd17a6e7c4f9

@mbinna
mbinna / effective_modern_cmake.md
Last active June 8, 2024 08:39
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

@enricofoltran
enricofoltran / main.go
Last active April 1, 2024 00:17
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@creack
creack / main.go
Created January 7, 2018 17:30 — forked from enricofoltran/main.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"fmt"
"log"
"net/http"
"os"
"os/signal"
"strconv"
@brodieG
brodieG / pwned2.R
Last active February 26, 2018 17:43
Use Troy Hunt's Have I Been Pwned Database from R
# Test your passwords against the "Pwned Passwords" V2 database
# as described in <https://www.troyhunt.com/ive-just-launched-pwned-passwords-version-2/>
#
# USE AT YOUR OWN RISK. I MAKE NO GUARANTEES THAT THIS CODE
# PROTECTS YOUR PASSWORDS.
#
# requires `digest` package (thanks @eddelbuettel)
#
# This code is published under the GPL-2 License
# <https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html>
@zthxxx
zthxxx / Activate Office 2019 for macOS VoL.md
Last active June 10, 2024 07:30
crack activate Office on mac with license file