Skip to content

Instantly share code, notes, and snippets.

@agektmr
agektmr / Getting $promise as a result of $resource.js
Last active August 29, 2015 13:57
I'm getting $promise as a result for fetching css using $resource. Does anyone know how to resolve?
var app = angular.module('app', ['ngResource']);
app.service('fetch', ['$resource', function() {
return $resource('css/:id/:file_name', {id: '@id'}, {
'get': {
method: 'GET',
params: {
file_name: 'style.css'
}
}
}

Managing HTML5 Offline Storage

HTML5 introduced many storage APIs that let you store a large amount of data locally in your users' browsers. But the amount of space allocated for each app is, by default, restricted to a few megabytes. Google Chrome lets you ask for a larger storage quota, beyond the previous limit of just 5 MB.

This document introduces you to the basic concepts around the types of storage used in Chrome and describes the experimental Quota Management API, which lets you manage your storage quota. The document assumes that you are already familiar with the general concepts of client-side storage and know how to use offline APIs.

Contents

if (DEBUG === undefined) DEBUG = true;
DEBUG && console.log('test');
@agektmr
agektmr / gif animation using html5
Last active September 16, 2022 08:13
How to create gif animation
<html>
<head>
<style>
figure {
width: 200px;
height: 150px;
text-align: center;
float: left;
}
img {
@agektmr
agektmr / gist:5917056
Created July 3, 2013 11:05
Angular controller inheritance example
<!DOCTYPE html>
<html ng-app>
<head>
<title>Angular Example</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="styles/style.css">
<script src="scripts/angular.min.js"></script>
<script>
var ListCtrl = function($scope) {
$scope.list = [
@agektmr
agektmr / ws_echo_server
Created August 6, 2012 09:28
ws echo server
var WebSocket = require('ws').Server;
var ws = new WebSocket({port:8080});
var conn = [];
// Start accepting WebSocket connection
ws.on('connection', function(socket) {
// Add socket to list
conn.push(socket);
broadcast('1 peer connected.');