Skip to content

Instantly share code, notes, and snippets.

View smoothscrolling.coffee
app.run ($rootScope, $state, SessionService, $window) ->
$rootScope.$state = $state
$rootScope.logout = -> SessionService.logout true
win = $($window)
scrollTime = 0.3
scrollDistance = 200
win.on 'mousewheel DOMMouseScroll', (evt) ->
evt.preventDefault()
@weisk
weisk / parallax.coffee
Last active Aug 29, 2015
Angular Parallax image & background
View parallax.coffee
angular.module 'directives'
### Usage:
<div
parallax-background
parallax-background-ratio="0.6"
parallax-background-src="assets/image.png"
parallax-background-gradient="linear-gradient(rgba(0, 0, 0, 0) 60%, rgba(0, 0, 0, 0.4) 100%)">
</div>
###
@weisk
weisk / arrayzing.md
Last active Aug 28, 2016 — forked from ourmaninamsterdam/LICENSE
Arrayzing - The JavaScript array cheatsheet
View arrayzing.md
@weisk
weisk / multiple_ssh_setting.md
Last active Aug 27, 2015 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts
View multiple_ssh_setting.md

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@weisk
weisk / connecthistoryapi.coffee
Created Nov 7, 2015
gulp task connect history api enhanced
View connecthistoryapi.coffee
gulp.task 'connect', [], -> connect.server
root: ['build']
port: 9000
livereload: true
middleware: (connect, opt) -> [
historyApiFallback = (req, res, next) ->
headers = req.headers
rewriteTarget = '/index.html'
appBaseDir = 'build'
@weisk
weisk / introrx.md
Created Dec 25, 2015 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
View introrx.md
@weisk
weisk / levenshtein.js
Created Jul 2, 2016 — forked from andrei-m/levenshtein.js
Levenshtein distance between two given strings implemented in JavaScript and usable as a Node.js module
View levenshtein.js
/*
Copyright (c) 2011 Andrei Mackenzie
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
@weisk
weisk / lodash-data-transformation.md
Created Aug 6, 2016
Lodash snippets - data transformation
View lodash-data-transformation.md

Sort object by values

let doo = {Derp: 17, Herp: 2, Asd: 5, Foo: 8, Qwe: 12};

let foo = _.chain(doo)
  .map((val, key) => {
    return { name: key, count: val }
  })
  .sortBy('count')
  .reverse()
@weisk
weisk / promise_deferred.js
Created Aug 8, 2016
Promise ES6 deferred helper
View promise_deferred.js
function Deferred() {
var resolve, reject;
var promise = new Promise((resolver, rejector) => {
resolve = resolver;
reject = rejector;
});
return {
promise,
resolve,
reject
@weisk
weisk / 13-async.js
Created Aug 12, 2016
learnyounode 13 async
View 13-async.js
var http = require('http');
var requests = process.argv.slice(2);
var results = [];
var count = 0;
for (var i = 0, len = requests.length; i < len; i++) {
getRequest(requests[i], i);
}