Skip to content

Instantly share code, notes, and snippets.

@stonly
stonly / client.js
Last active December 29, 2015 14:59
Would this work and does it make sense what im trying to accomplish?
/*
scope -> non functions and non constats are regular objects, no functions allowed
services -> all functions are sent through a service that executes on the server (nodejs in this example but could be python. could also be a hosted service)
*/
angular.module('MVapp', [])
.factory('Service', function($http, $q){
return {
_: function(){
@stonly
stonly / stricthttp.js
Created November 19, 2013 19:07
strictHttp is an alternate $http.post service that checks for values before making the $http call.
var app = angular.module('app',[]);
app.factory('strictHttp', function ($http) {
return {
post: function(url, params, req, config){
var invalid;
for(var p in params){
if(req.indexOf(p) > -1 && (params[p] === '' || params[p] === undefined)){
invalid = 1;
}
}
@stonly
stonly / hashex.py
Last active September 22, 2017 14:35
hash table demonstration code
#!/usr/bin/python
"""
Hash Tables
Usage :
'python -i hashex.py'
The goal of a hash table is to map a keyword to a placeholder that contains the value you stored.
We will define 3 functions :