Skip to content

Instantly share code, notes, and snippets.

@sebmarkbage
sebmarkbage / Enhance.js
Last active November 7, 2024 13:05
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
@revolunet
revolunet / cordova-bridge.js
Last active December 28, 2015 19:59
Sample cordova with web fallback fonctions for AngularJS
/*
* angular-phonegap-bridges
* (c) 2013 Julien Bouquillon - [email protected]
* License: MIT
*/
(function() {
'use strict';
@revolunet
revolunet / Gruntfile.js
Created October 15, 2013 09:32
Sample minimal grunt+angular
/*global module:false*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
// Metadata.
pkg: grunt.file.readJSON('package.json'),
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
@revolunet
revolunet / mobile.css
Created July 10, 2013 07:49
some mobile css fixes
html {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-touch-callout: none;
-webkit-user-drag: none;
-webkit-tap-highlight-color: rgba(0,0,0,0);
}
@revolunet
revolunet / slice.js
Last active May 1, 2021 09:02
Python-like JS slice
'use strict';
/**
* @ngdoc function
* @name ng.filter:slice
* @function
*
* @description
* Creates a new array limited to the specified range, and optionnaly extracts only n-th items
* with the `step` argument, similar to Python slice operators.
@revolunet
revolunet / angular-google-analytics.js
Last active December 16, 2015 23:30
Sample angular-google-analytics usage
var app = angular.module('app', ['angular-google-analytics'])
.config(function(AnalyticsProvider) {
// initial configuration
AnalyticsProvider.setAccount('UA-XXXXX-xx');
// track all routes (or not)
AnalyticsProvider.trackPages(true);
}))
.controller('SampleController', function(Analytics) {
// create a new pageview event
@revolunet
revolunet / landing-pages.md
Last active February 28, 2018 05:01
Beautiful SAAS landing pages
@revolunet
revolunet / colorpicker.html
Created April 3, 2013 10:43
Sample AngularJS colorpicker example
<!doctype html>
<html ng-app="MyApp" >
<head>
<script src="http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.1/angular.js"></script>
<script type="text/javascript">
var app = angular.module('MyApp', []);
app.directive('colorpicker', function($parse) {
// sample color picker directive
// todo : bound to a ng-model
@revolunet
revolunet / demo.html
Last active May 21, 2020 11:13
AngularJS ngLoading directive. show a loader based on an attribute and restore content when ready.
<!DOCTYPE html>
<html ng-app >
<head lang="en">
<meta charset="utf-8">
<title>ngLoading demo</title>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.min.js"></script>
<link rel="stylesheet" href="style.css">
<script src="ngLoading.js"></script>
</head>
@revolunet
revolunet / icon-packs.md
Last active December 28, 2019 16:36
List of free icon packs

Icon ressources collection