Skip to content

Instantly share code, notes, and snippets.

View OlivierPerceboisGarve's full-sized avatar

Olivier Percebois-Garve OlivierPerceboisGarve

View GitHub Profile
@wottpal
wottpal / date-formats.ts
Created April 18, 2019 15:10
Custom DateFormats & DateAdapter for Angular Material MatDatepicker using Day.js
import { Platform } from '@angular/cdk/platform';
import { NativeDateAdapter } from '@angular/material';
import * as dayjs from 'dayjs';
import 'dayjs/locale/de';
import * as customParseFormat from 'dayjs/plugin/customParseFormat';
import * as localizedFormat from 'dayjs/plugin/localizedFormat';
/**
* Custom Date-Formats and Adapter (using https://github.com/iamkun/dayjs)
@Tuizi
Tuizi / test-helper.spec.ts
Last active March 19, 2021 19:47
MockStore for Angular ngrx/store unit tests
import { Action, ActionReducer, Store } from '@ngrx/store';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { Observable } from 'rxjs/Observable';
import { map } from 'rxjs/operator/map';
import { Observer } from 'rxjs/Observer';
// TODO: How to initialize those variables?
const dispatcherMock: Observer<Action>,
reducerMock: Observer<ActionReducer<any>>,
stateMock: Observable<any>;
@OrganicPanda
OrganicPanda / mouse-plugin.js
Created July 28, 2016 16:06
Track the mouse position in Protractor
// Hook in to `addEventListener` to track the mouse and display it as a circle
exports.onPageLoad = function() {
return browser.executeScript(function() {
(function() {
var EventSniffer = function() {
this.history = [];
this.callbacks = {};
this.minCacheSize = 100;
this.maxCacheSize = 500;
};

This is the French translation of Manuel Rego's (@regocas) post "Deep Dive into Grid Layout Placement", published on February 1st, 2016. All images and code samples come from the original article, with the author's permission. Translation: Patrick Brosset (@patrickbrosset).

Ceci est la traduction française de l'article "Deep Dive into Grid Layout Placement" par Manuel Rego (@regocas), publié le 1er Février 2016. Toutes les images et extraits de code viennent de l'article original avec la permission de l'auteur. Traduction: Patrick Brosset (@patrickbrosset).

Le positionnement dans les Grilles CSS

Une revue complète des différentes méthodes de positionnement offertes par les grilles CSS.

anonymous
anonymous / Halo.markdown
Created January 29, 2016 17:19
Halo

Halo

[ MouseMove / TouchSwipe ]
Scientists have recently discovered that the Milky Way Galaxy began with Globular Star Clusters and Dwarf Galaxies which formed a few hundred million years after the big bang, settling into what is now the galaxy's halo, merging over billions of years to form the structure of our Milky Way. Stars in the inner halo were born during the assembly process. Over time, the Milky Way gobbled up older dwarf galaxies that formed less than 2 billion years after the big bang, with their ancient stars settling into the outskirts of the halo, creating the outer halo.

A Pen by Tiffany Rayside on CodePen.

License.

anonymous
anonymous / Floating cells.markdown
Created January 22, 2016 17:47
Floating cells
console.highlight = function(text, sample) {
var escapedSample = sample.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
var reSample = new RegExp(escapedSample, 'g');
var args = [''];
var highlightedText = text.replace(reSample, function(match) {
args.push('background-color: #ffc', 'background-color: none');
return '%c' + match + '%c';
});
args[0] = highlightedText;
console.log.apply(console, args);
@vladikoff
vladikoff / resource.js
Created April 17, 2014 17:52
Angular $resource and transformResponse
angular.module('itemServices', ['ngResource'])
.factory('Item', ['$resource',
function ($resource) {
return $resource('items/:id',
{id: '@id'},
{
query: {
isArray: true,
method: 'GET',
params: {},
@madrobby
madrobby / gist:9476733
Created March 10, 2014 23:34
Download a single file from a private GitHub repo. You'll need an access token as described in this GitHub Help article: https://help.github.com/articles/creating-an-access-token-for-command-line-use
curl -H 'Authorization: token INSERTACCESSTOKENHERE' -H 'Accept: application/vnd.github.v3.raw' -O -L https://api.github.com/repos/owner/repo/contents/path
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}