Skip to content

Instantly share code, notes, and snippets.

@yannbertrand
yannbertrand / DatepickerDirective.js
Created August 24, 2016 13:16
An Angular datepicker directive (angular-ui-bootstrap datepicker overlay)
(function () {
'use strict';
angular.module('solisPaiementApp.directives')
.directive('myDatepicker', ['$timeout', function ($timeout) {
return {
restrict: 'A',
require: ['^?form', 'ngModel'],
scope: {
@yannbertrand
yannbertrand / Preferences.sublime-settings
Last active November 14, 2016 21:40
My Sublime Text's user preferences settings
{
"color_scheme": "Packages/User/SublimeLinter/Monokai (SL).tmTheme",
"folder_exclude_patterns":
[
"dist",
"node_modules",
".git"
],
"font_options":
[
@yannbertrand
yannbertrand / autoexec.cfg
Last active January 30, 2022 01:11
CS:GO autoexec file
//C:\Program Files (x86)\Steam\steamapps\common\Counter-Strike Global Offensive\csgo\cfg
cl_autowepswitch "0" // we dont want to pick up & switch to a rifle up if we're in the middle of firing
cl_disablefreezecam "1"
cl_downloadfilter "nosounds"
cl_disablehtmlmotd "1" // Disables The Servers Message of The Day.
cl_forcepreload "1" // Preloads The Whole Map & Sounds.
https://www.linux.com/community/blogs/133-general-linux/850945-setup-mutt-with-gmail-on-centos-and-ubuntu
# Setup a service in /etc/init.d
https://www.debian-administration.org/article/28/Making_scripts_run_at_boot_time_with_Debian
# Don't forget the LSB tags
http://help.directadmin.com/item.php?id=379
# Example on a script called blah:
$ update-rc.d blah defaults
@yannbertrand
yannbertrand / debian-check-open-ports
Created February 18, 2016 09:11
List open ports and check one is up
# /!\ May change whether root or not
netstat -pln [| grep PORT_NB]
@yannbertrand
yannbertrand / better-index-of.js
Created January 18, 2016 10:15
Simplify the use of indexOf
// Array
var list = ['my', 'str', 'list'];
if (~list.indexOf('my')) {
console.log('the `list` array contains \'my\'');
}
if (!~list.indexOf('number')) {
console.log('the `list` array does not contain \'number\'');
}
@yannbertrand
yannbertrand / angular-bullshit.js
Last active June 13, 2018 17:48
Bullshit code from Angular
$resource(a, b, {
getSomething: {
method: 'GET',
url: baseUrl + ':id' // work if you pass the `id` param in the parameters object
},
postSomething: {
method: 'POST',
url: baseUrl + ':id', // you need to add the next line to make it work for post requests (didn't try with other verbs)
params: { id: '@id' }
}
@yannbertrand
yannbertrand / Naming things in programming
Created January 7, 2016 13:38
Some advices to apply good names for your programming entities
See http://fr.slideshare.net/pirhilton/how-to-name-things-the-hardest-problem-in-programming by @hilton
Summary of naming things badly :
- meaningless: foo
- too general: data
- too short: a
- too long: text_correction_by_editor
- abbreviated: acc (id is the only acceptable abbreviation)
- vague: InvoiceManager
- wrong: order
@yannbertrand
yannbertrand / implode-explode.js
Last active April 6, 2017 13:36
How to implode/explode an array in JS?
// explode -> .split
console.log(['Hello', 'World'].join()) // ',' is optional
// → "Hello,World"
// implode -> .join
console.log('Hello,World'.split(','))
// → Array [ "Hello", "World" ]