Skip to content

Instantly share code, notes, and snippets.

View techhahn's full-sized avatar

Pritesh Panjiker techhahn

View GitHub Profile
@techhahn
techhahn / The router
Last active December 13, 2015 17:18
Backbone
require.config({
paths: {
jquery: 'lib/jquery',
backbone: 'lib/backbone',
underscore: 'lib/underscore',
user: 'app/models/user'
},
shims: {
'backbone': {
deps: ['jquery', 'underscore'],
require.config({
paths: {
jquery: 'lib/jquery',
backbone: 'lib/backbone',
underscore: 'lib/underscore'
}
})
define(['jquery', 'underscore', 'backbone', 'text!templates/editprofile.html'], function($, _, backbone, editProfileTemplate) {
var editProfile = Backbone.View.extend({
el: $('#renderarea'),
var newTodo = todos.add(credentials).then(
function(response) {
$scope.todos.push(response);
console.log(response);
console.log($scope.todos);
$scope.new_desc = "";
}
)
package com.example.gpstraker;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.os.IBinder;
myApp.animation('.repeated-items', function() {
return {
enter: function(element, done) {
element.velocity("transition.slideUpIn", {stagger: 100, complete: done});
},
leave: function(element, done) {
element.velocity("transition.shrinkOut", {stagger: 100, complete: done});
},
move: function(element, done) {
element.velocity("transition.slideUpIn", {stagger: 100, complete: done});
cubic-bezier(0.77, 0, 0.175, 1)
.has-ripple {
position: relative;
overflow: hidden;
@include transition(.4s all);
}
.ripple {
background: #FFF;
position: absolute;
-webkit-animation: ripple 1s cubic-bezier(0.23, 1, 0.32, 1);
animation: ripple 1s cubic-bezier(0.23, 1, 0.32, 1);
function _ago($tm,$rcs = 0) {
$cur_tm = time(); $dif = $cur_tm-$tm;
$pds = array('sec','min','h','d','w','m','y','decade');
$lngh = array(1,60,3600,86400,604800,2630880,31570560,315705600);
for($v = sizeof($lngh)-1; ($v >= 0)&&(($no = $dif/$lngh[$v])<=1); $v--); if($v < 0) $v = 0; $_tm = $cur_tm-($dif%$lngh[$v]);
$no = floor($no); if($no <> 1) $pds[$v] .='s'; $x=sprintf("%d %s ",$no,$pds[$v]);
if(($rcs == 1)&&($v >= 1)&&(($cur_tm-$_tm) > 0)) $x .= time_ago($_tm);
return $x;
}
@techhahn
techhahn / new webpack config
Last active December 27, 2016 21:02
Webpack basic setup
module.exports = {
entry: './app/index.js',
output: {
path: './dist/',
filename: 'bundle.js'
},
devServer: {
inline: true,
@techhahn
techhahn / app.js
Created November 4, 2017 18:58
Smooth Scroll plugin with callback support
var section = document.querySelector('.vs-section')
var smooth = new Smooth({
native: true,
section: section,
ease: 0.1,
callback: function(current) {
console.log(current);
}
});