Skip to content

Instantly share code, notes, and snippets.

View hashplus's full-sized avatar
🇨🇳

p(^-^q) hashplus

🇨🇳
  • CN
View GitHub Profile
<?xml version="1.0" encoding="UTF-8" ?>
<opml version="1.0">
<head>
<title>寸志 subscriptions in Digg Reader</title>
</head>
<body>
<outline text="Framer Blog" title="Framer Blog" type="rss" xmlUrl="http://framerjs.tumblr.com/rss" htmlUrl="http://framerjs.tumblr.com/" />
<outline text="粉丝日志" title="粉丝日志" type="rss" xmlUrl="http://blog.fens.me/feed/" htmlUrl="http://blog.fens.me" />
<outline text="AngularJS" title="AngularJS" type="rss" xmlUrl="http://blog.angularjs.org/feeds/posts/default" htmlUrl="http://blog.angularjs.org/" />
<outline text="blog.izs.me" title="blog.izs.me" type="rss" xmlUrl="http://blog.izs.me/rss" htmlUrl="http://blog.izs.me/" />

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@hashplus
hashplus / bezier.js
Last active August 29, 2015 14:12 — forked from LiuJi-Jim/bezier.js
function DeCasteljauBezier(points, density, step){
//if (points.length < 3) return null;
console.time('bezier');
var ps = points.map(function(p){
return {
x: p.x,
y: p.y
};
}),
results = [],
@hashplus
hashplus / 01_auth.js
Last active August 29, 2015 14:10 — forked from vojto/01_auth.js
// JavaScript
auth: function(username, password, callback) {
var self = this;
var hash = this._encodePassword(password);
this.model.find({name: username, encoded_password: hash}, function(err, docs) {
if (docs.length == 0) return callback(false);
var user = docs[0];
self._generateToken(user, function(token) {
callback(user, token);
Array.prototype.shuffle = function() {
var i = this.length;
var j;
var temp;
if(i > 1) {
while(--i) {
j = Math.floor(Math.random() * (i + 1));
temp = this[i];
this[i] = this[j];
@hashplus
hashplus / gulpfile.js
Last active August 29, 2015 14:08 — forked from fenbox/gulpfile.js
// Include gulp
var gulp = require('gulp');
// Include Our Plugins
var sass = require('gulp-sass');
var lr = require('tiny-lr'),
refresh = require('gulp-livereload'),
server = lr();
@hashplus
hashplus / app.js
Last active August 29, 2015 14:06 — forked from auser/app.js
angular.module('myApp',
['ngRoute', 'myApp.services', 'myApp.directives']
)
.config(function(AWSServiceProvider) {
AWSServiceProvider.setArn('arn:aws:iam::<ACCOUNT_ID>:role/google-web-role');
})
.config(function(StripeServiceProvider) {
StripeServiceProvider.setPublishableKey('pk_test_YOURKEY');
})
.config(function($routeProvider) {
@hashplus
hashplus / index.html
Last active August 29, 2015 14:06 — forked from anonymous/index.html
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.5/angular.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body ng-app="myApp">
<div ng-controller="MyController">
<input ng-model="to"
/**
* Module dependencies.
*/
var express = require('express')
, routes = require('./routes')
, http = require('http');
var app = express();
var server = app.listen(3000);
@hashplus
hashplus / day1.js
Created April 16, 2014 08:25 — forked from auser/day1.js
angular.module('myApp.services', [])
.factory('UserFactory', function($http, $q) {
var service = {
// our factory definition
user: {},
setName: function(newName) {
service.user['name'] = newName;
},
setEmail: function(newEmail) {
service.user['email'] = newEmail;