Skip to content

Instantly share code, notes, and snippets.

View hpstuff's full-sized avatar
🏠
Working from home

Rumen Rusanov hpstuff

🏠
Working from home
View GitHub Profile
@hpstuff
hpstuff / Ajax.js
Last active December 19, 2015 03:39
var Ajax = (function(){
function Ajax(){
this.xhr = new XMLHttpRequest();
this.handlers();
}
Ajax.prototype.handlers = function(){
var _this = this;
{
"name": "cinemacity.bg",
"preferGlobal": true,
"version": "0.1.0",
"author": "hpstuff <despario@gmail.com>",
"description": "cinemacity parcer",
"dependencies" : {
"request" : "",
"express" : "",
"iconv" : ""
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# enable programmable completion features (you don't need to enable
sudo apt-get install default-jre
sudo apt-get install default-jdk
sudo apt-get install ant
sudo npm install -g phonegap
@hpstuff
hpstuff / continents_country.json
Last active August 29, 2015 14:03
continents_country.json
[
{
"code":"AS",
"name":"Asia",
"countries":[
{
"name":"Bangladesh",
"code":"BGD",
"iso":"BD"
},
@hpstuff
hpstuff / init.js
Last active August 29, 2015 14:05
Icomoon local data save
var dbrequest = indexedDB.open("IDBWrapper-storage", 1);
var db;
dbrequest.onsuccess = function(e) {
db = e.target.result;
};
function getData(){
var trans = db.transaction(["storage"], "readwrite");
var store = trans.objectStore("storage");
var request = store.get('icomoon');
@hpstuff
hpstuff / 01-ugly.js
Last active August 29, 2015 14:10
Clean Code example
function getUser(){
var _this = this;
var ajax = new Ajax();
var header = { 'Authorization': this.tokenType+' '+this.accessToken };
ajax.setHeaders(header);
return new Promise(function(resolve, reject){
if(_this.userData){
resolve({data: _this.userData});
}else{
ajax.get(_this.userUrl).then(function(res){
@hpstuff
hpstuff / index.html
Last active August 29, 2015 14:10
SVG Loader
<html>
<head>
<link rel="stylesheet" type="text/css" href="loader.css" />
</head>
<body>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" class="ui-loader">
<rect x="0" y="0" width="100" height="100" fill="none" class="bk"></rect>
<rect x="46.5" y="40" width="7" height="20" rx="5" ry="5" fill="#00b2ff" transform="rotate(0 50 50) translate(0 -30)">
<animate attributeName="opacity" from="1" to="0" dur="1s" begin="0s" repeatCount="indefinite"/>
</rect>
@hpstuff
hpstuff / Example.js
Last active August 29, 2015 14:10
Message Dialog
//Simple default example
var _this = this;
var message = new Message();
message.setTitle('Login required');
message.setContent('You must be logged in to create an event.<br />Go to settings to sign in with your google account.');
_this.context.messageManager.showMessage(message).then(function(){
//TODO go to settings
}, function(){
//TODO reject action
@hpstuff
hpstuff / SassMeister-input.scss
Created January 23, 2015 09:29
Generated by SassMeister.com.
// ----
// Sass (v3.4.9)
// Compass (v1.0.1)
// ----
$media-break: 1024px;
@function strip-units($number) {
@return $number / ($number * 0 + 1);
}