Skip to content

Instantly share code, notes, and snippets.

@xjinza
xjinza / 0_reuse_code.js
Created March 14, 2016 06:40
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@xjinza
xjinza / gist:7f222a5c168f6da603a97a96bb1b7de1
Created November 28, 2016 09:13
angular set cookies expired
var expireDate = new Date();
expireDate.setDate(expireDate.getDate() + 1);
$cookies.put('myFavorite', 'oatmeal', {'expires': expireDate});
@xjinza
xjinza / gist:ee11418088f1442b6dfcc3c3ea962946
Created December 9, 2016 07:48
app.core.js 核心模块
define([
'angular',
// 'domReady',
'ui-router',
'ngCookies',
'angularAnimate',
'angularTouch',
], function(angular) {
define([
'angular',
'domReady',
'app/app.core',
// 'ui-router',
// 'ngStorage',
// 'ngCookies',
// 'angularAnimate',
// 'angularTouch',
@xjinza
xjinza / angular ajax
Last active December 26, 2016 10:10
angular http ajax
tips:from http://jsfiddle.net/tjsteinhaus/fo3y41rn/
var myControllers = angular.module( 'myControllers', [] );
myControllers.controller( 'FormController', function( $scope, $http, $httpParamSerializerJQLike ) {
$scope.master = {};
$scope.update = function( user ) {
$scope.master = angular.copy( user );
console.log( $scope.master );
@xjinza
xjinza / angular image upload directive
Last active October 18, 2017 11:41
angular image upload directive
define(['jquery', 'message'], function($, scojs_message) {
'use strict';
/**
* The image upload directive
* @author: kehefu
* @version: 0.1.0, 2016-12-27
*/
var uploadModule = angular.module('upload', []);
uploadModule.directive('upload', ['$window', function($window) {
@xjinza
xjinza / node-sass generator
Created January 5, 2017 12:18
node-sass@1.0.1: [Windows Error ] %1 is not a valid win32 application
problem:node-sass@1.0.1: [Windows Error ] %1 is not a valid win32 application
solution:npm rm node-sass
npm install node-sass
d3spis3d/generator-angular-es6-webpack:
https://github.com/d3spis3d/generator-angular-es6-webpack/blob/master/generators/app/templates/_webpack.config.js
@xjinza
xjinza / delete node module diretory
Created January 19, 2017 08:12
delete node module diretory
npm install rimraf -g
rimraf node_modules
@xjinza
xjinza / css 省略号
Created April 1, 2017 02:55
css 省略号
overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;
@xjinza
xjinza / js判断是否数字
Last active September 6, 2017 12:53
js判断是否数字
function isNumeric( obj ) {
return (obj - parseFloat( obj ) + 1) >= 0;
},