Skip to content

Instantly share code, notes, and snippets.

View kandros's full-sized avatar
:bowtie:
o.o

Jaga Santagostino kandros

:bowtie:
o.o
View GitHub Profile
@kandros
kandros / 0_reuse_code.js
Created May 19, 2014 03:05
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@kandros
kandros / css_resources.md
Created May 19, 2014 03:15 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides

@kandros
kandros / javascript_resources.md
Created May 19, 2014 03:15 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@kandros
kandros / provincie_from_sigla.sql
Created May 27, 2014 15:50
#SQL update a colum based on a select result provincia where pronincia_sm
UPDATE anagrafica
SET provincia='agrigento'
WHERE provincia_sm='Ag';
UPDATE anagrafica
SET provincia='alessandria'
WHERE provincia_sm='Al';
UPDATE anagrafica
SET provincia='ancona'
@kandros
kandros / gist:dcae43e4cdd20f1c793d
Created January 19, 2015 12:31
Bookmarklet dropbox folder files size
javascript:(function() { var kb = Object.values(BrowseFile._file_index).reduce(function(kb, file) { return kb + file.bytes/1000; }, 0); var units = ['kb', 'mb', 'gb', 'tb'], unit = units.shift(), size = kb; for (var i=0; i<3; i++) { if (size < 1000) { break; } size /= 1000; unit = units.shift(); } alert('Folder size: ' + (Math.round(size*1000)/1000) + ' ' + unit);})();
@kandros
kandros / metaTags listing
Created May 25, 2015 20:59
Bookmarklet for my copywriter to easely check stuff without having to search inside source code
javascript: ( function() {
var text = "";
var whiteList = [
"description",
"keywords",
"og:title"
];
text += "Title:\n" + document.title + "\n\n";
var metas = document.getElementsByTagName('meta');
for (var x = 0, y = metas.length; x < y; x++) {
@kandros
kandros / pesel_validation.js
Created September 10, 2015 09:07
Javascript validatio of pesel
function validatePesel (pesel) {
// PESEL:
// 11 digits numbers. Last digit is control digit verified against expression for the first 10 digits. Exp: (1*a + 3*b + 7*c + 9*d + 1*e + 3*f + 7*g + 9*h + 1*i + 3*j) last digit of the result is substracted from 10 and compared with the control digit.
var reg = /^\d{11}$/;
if (!reg.test(pesel)) {
return false;
}
var dig = (""+pesel).split("");
function validateID (id) {
//"If ID Document Type is 'Identity Card' then Document Number should be in format XXXDDDDDD (three letters and six digits). To verify the correctness letters
//should be changed to numbers using follwing table (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
//10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35). Each from received 9 numbers should be multiplied by corresponding
//number from the following list (7, 3, 1, 9, 7, 3, 1, 7, 3). After adding results division by 10 should be equal to 0."
if (id.length === 0) {
return false;
}
@kandros
kandros / code.js
Last active August 11, 2016 20:34
testing the obvious
function fetchAllProjects() {
return dispatch => {
console.log('1')
dispatch(xxx())
dispatch({ type: 'REQUEST_ALL_PROJECTS' });
console.log('2')
ProjectsApi.getAllProjects()
.then(projects => {
dispatch({ type: 'SUCCESS_ALL_PROJECTS', projects: fromJS(projects) });
})
@kandros
kandros / mongoose-findOrCreate.js
Created October 9, 2016 23:05 — forked from niksumeiko/mongoose-findOrCreate.js
Mongoose schema static `findOrCreate` method in ES6/7 async/await syntax
import mongoose from 'mongoose';
let schema = new mongoose.Schema({
email: { type: String, required: true, unique: true },
password: { type: String, required: true }
});
schema.statics.findOrCreate = async (conditions, opt_attr) => {
let document = await User.findOne(conditions);