Skip to content

Instantly share code, notes, and snippets.

View davidjsalazarmoreno's full-sized avatar
🔥
Creating

David Salazar davidjsalazarmoreno

🔥
Creating
View GitHub Profile

Angular2 + JSPM cheat sheet

First time setup

  • install jspm beta: npm install -g jspm@beta
  • set up your project: jspm init
  • install dependencies: jspm install angular2 reflect-metadata zone.js es6-shim

This will create a jspm_packages folder, and a config.js file.

Open the config.js file - this file manages options for the System.js loader - tweak it as appropriate

@cloudbring
cloudbring / README.md
Last active May 1, 2017 02:42
Building an Phoenix / Elixir Web App in June 2015
@paulirish
paulirish / bling.js
Last active May 1, 2024 19:56
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;
@Couto
Couto / webpack.js
Last active November 11, 2020 17:53
Fetch polyfill with webpack
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var path = require('path');
var folders = {
APP: path.resolve(__dirname, '../app'),
BUILD: path.resolve(__dirname, '../build'),
BOWER: path.resolve(__dirname, '../bower_components'),
NPM: path.resolve(__dirname, '../node_modules')
};
function randInt(min,max){
var range = max - min;
// it actually does work the other way...
// if (range < 0) { throw new RangeError("min must be less than max"); }
var rand = Math.floor(Math.random() * (range + 1));
return min + rand;
}
@sebmarkbage
sebmarkbage / Enhance.js
Last active January 31, 2024 18:33
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() {
@danielpataki
danielpataki / full-code.php
Last active December 26, 2017 16:51
Adding Your Own welcome screen
register_activation_hook( __FILE__, 'welcome_screen_activate' );
function welcome_screen_activate() {
set_transient( '_welcome_screen_activation_redirect', true, 30 );
}
add_action( 'admin_init', 'welcome_screen_do_activation_redirect' );
function welcome_screen_do_activation_redirect() {
// Bail if no activation redirect
if ( ! get_transient( '_welcome_screen_activation_redirect' ) ) {
return;
@LeoIannacone
LeoIannacone / monokai-exteded.xml
Last active October 26, 2023 15:50
Monokai Extended - GtkSourceView Theme
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2014 Leo Iannacone <info@leoiannacone.com>
This file was generated from a textmate theme named Monokai Extended
with tm2gtksw2 tool. (Alexandre da Silva)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
@elgalu
elgalu / waitReady.js
Last active February 2, 2021 07:14
Actively wait for an element present and displayed up to specTimeoutMs ignoring useless webdriver errors like StaleElementError.
/**
* Actively wait for an element present and displayed up to specTimeoutMs
* ignoring useless webdriver errors like StaleElementError.
*
* Usage:
* Add `require('./waitReady.js');` in your onPrepare block or file.
*
* @example
* expect($('.some-html-class').waitReady()).toBeTruthy();
*/
@fraserxu
fraserxu / loadMore.js
Last active August 9, 2023 05:37
Simple load more function for ng-repeat with limitTo filter
// set the default amount of items being displayed
$scope.limit= 5;
// loadMore function
$scope.loadMore = function() {
$scope.limit = $scope.items.length
}