Skip to content

Instantly share code, notes, and snippets.

Avatar
🐰

Rafael Cardoso rafaelcardoso

🐰
View GitHub Profile
@rafaelcardoso
rafaelcardoso / simple mithriljs
Created Jul 8, 2016
mithril source code without routing and ajax features for performance testing purpose
View simple mithriljs
/* global Promise */
;(function (global, factory) { // eslint-disable-line
"use strict"
/* eslint-disable no-undef */
var m = factory(global)
if (typeof module === "object" && module != null && module.exports) {
module.exports = m
} else if (typeof define === "function" && define.amd) {
define(function () { return m })
View file size mithriljs and vuejs
vue.js
26.3 KB
74.9 KB
mithril
8.1 KB
19.9 KB
mithril - no ajax
7.2 KB
View injector.js
(function(){
var modules = {};
window.require = function(id, callback) {
var exports = modules[id];
if(!exports) {
throw new Error('o módulo '+id+' não foi definido');
} else {
callback(exports);
View nginx.conf
server {
listen 80;
root /home/rafael/dev/app;
server_name meusite.com.br www.meusite.com.br;
index index.html;
location @upstream {
proxy_pass http://localhost:3000;
View accent.js
/*
* 1. Create new bookmar and add this snippet
* 2. Paste this color on URL field
*/
javascript:!function(){var a=prompt("Digite a palavra que gostaria de ouvir a pronúncia:");null!=a&&window.open("https://translate.google.co.uk/translate_tts?ie=UTF-8&q="+a+"&tl=en")}();
View gulp-spritesmith.js
var gulp = require('gulp');
var imagemin = require('gulp-imagemin');
var pngquant = require('imagemin-pngquant');
var spritesmith = require('gulp.spritesmith');
gulp.task('generate-sprites', function () {
var spriteData = gulp.src('path-das-suas-imagens/*.png')
.pipe(spritesmith({
retinaSrcFilter: ['filtro-para-as-imagens-de-retina/*-2x.png'],
imgName: 'nome-do-sprite-que-vai-ser-gerado.png',
View eleicoes
console.log("presidente",JSON.parse(require('system/util/storage').getItem('eleitos')).br);
var dados = {
presidente:{
eleito: {"oc":"p.c1","t":1,"ac":"BR","an":"BRASIL","cc":1,"cn":"Presidente","ca":[{"num":"38","nu":"LAURINHA","ps":"PJAG","v":"104.093","vp":"0,17","s":1},{"num":"71","nu":"MARCIO JORGE CALDERARO DA SILV","ps":"PLAN","v":"103.275","vp":"0,17","s":0},{"num":"66","nu":"MARIA NILDA PEREIRA DE SOUZA","ps":"PGAL","v":"100.404","vp":"0,16","s":0},{"num":"76","nu":"LUISINHO","ps":"PBAN","v":"84.136","vp":"0,14","s":0},{"num":"35","nu":"MARIA CICERA ARAUJO SILVA","ps":"PBAR","v":"19.785","vp":"0,03","s":0},{"num":"68","nu":"GABRIEL","ps":"PARA","v":"0","vp":"0,00","s":0},{"num":"42","nu":"ROBERT","ps":"PKUW","v":"0","vp":"0,00","s":0}],"vv":"61.547.849","vvp":"66,37","vb":"7.765.504","vn":"23.427.466","vnp":"25,26","vbp":"8,37","ab":"20.807.628","el":"86.206.188","si":"BR","sap":"129,66","vop":"81,60","abp":"18,40","lastModified":1410358900114,"prevModified":1410355800696,"channelName":"eleicoes-
View touchtest
mod = 'modernizr';
injectElementWithStyles = function( rule, callback, nodes, testnames ) {
var style, ret, node, docOverflow,
div = document.createElement('div'),
body = document.body,
fakeBody = body || document.createElement('body');
if ( parseInt(nodes, 10) ) {
while ( nodes-- ) {
View gist:5629419
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.tweestand"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
View StableArrayAdapter.java
public class StableArrayAdapter extends ArrayAdapter<Contact> {
HashMap<Contact, Integer> mIdMap = new HashMap<Contact, Integer>();
public StableArrayAdapter(Context context, int textViewResourceId, List<Contact> objects) {
super(context, textViewResourceId, objects);
for (int i = 0; i < objects.size(); ++i) {
mIdMap.put(objects.get(i), i);