Skip to content

Instantly share code, notes, and snippets.

View marti1125's full-sized avatar
🐍

Willy Aguirre marti1125

🐍
View GitHub Profile
@marti1125
marti1125 / gist:8876115
Created February 8, 2014 03:12
backgrid select of hours
var horas = ['07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21'];
var minutos = [':00',':05',':10',':15',':20',':25',':30',':35',':40',':45',':50',':55']
var merged
var resultados = [];
for(h = 0; h < horas.length; h++){
for(i = 0; i < minutos.length; i++){
merged = horas[h].concat(minutos[i]);
resultados.push([merged,merged]);
@marti1125
marti1125 / gist:8939744
Created February 11, 2014 17:31
obtener solo los sabados
List<LocalDate> soloSabados = new ArrayList<LocalDate>();
int diferenciaDias = Days.daysBetween(new LocalDate(desde), new LocalDate(hasta)).getDays();
for(int i = 0; i <= diferenciaDias; i++) {
if(new LocalDate(desde).plusDays(i).getDayOfWeek() == 6){
soloSabados.add(new LocalDate(desde).plusDays(i));
}
}
@marti1125
marti1125 / gist:9213979
Created February 25, 2014 17:43
hibernate group
List<EventualidadDto> sumaTotalDeHoras = ((Session)JPA.em().getDelegate()).createCriteria(Eventualidad.class)
.setProjection( Projections.projectionList()
.add(Projections.sqlGroupProjection("sum({alias}.totalDeHoras) as sumaDeHoras", "{alias}.docente_codigo,{alias}.tipoEventualidad_id",
new String[]{"sumaDeHoras"}, new Type[] {DoubleType.INSTANCE}),"sumaDeHoras"))
.add( Restrictions.sqlRestriction(" ( {alias}.docente_codigo = ? ) ", new String[] {r.codigo}, new Type[] {StringType.INSTANCE}))
.add( Restrictions.sqlRestriction(" ( {alias}.tipoEventualidad_id = ? ) ", new Long[] {tipoEventualidad.id}, new Type[] {LongType.INSTANCE}))
.setResultTransformer(new AliasToBeanResultTransformer(EventualidadDto.class)).list();
@marti1125
marti1125 / gist:9285563
Created March 1, 2014 05:11
Foxy-Board
<?php
/*
Plugin Name: Foxy Board
Plugin URI: http://wordpress.org/plugins/foxy-board/
Version: 0.5.2
Author: Willy Aguirre
Description: Easily Embed and Preview (Mozilla) Firefox Marketplace Apps in a stylish and modern way.
*/
class Foxyboard{
@marti1125
marti1125 / gist:9577017
Created March 16, 2014 01:23
get las page when delete rows
$(document).on("click",
"#deleteSelection${cadenaAleatoria}",
function(){
$('.alertaGrillaResultado').css('display','inherit');
var selectedModels = grid.getSelectedModels();
if(selectedModels != ''){
var respuesta = confirm('¿Desea retirar Horas de Equivalencia?');
if(respuesta){
@marti1125
marti1125 / gist:9806765
Created March 27, 2014 12:46
standalone-datasource
<datasources>
<datasource jndi-name="java:jboss/datasources/UnifiedPushDS" pool-name="UnifiedPushDS" enabled="true" use-java-context="true">
<connection-url>jdbc:mysql://localhost:3306/unifiedpush</connection-url>
<driver>com.mysql.jdbc.Driver</driver>
<security>
<user-name>root</user-name>
<password>mysql</password>
</security>
</datasource>
<drivers>
@marti1125
marti1125 / gist:9c3ea92a23ef10899eb4
Last active August 29, 2015 14:01
ceci-channel-menu
changeChannel : function(handlerType, handler ,color){
//alert(handler)
var visEl = this.component.querySelector("ceci-"+this.channelType+"["+handlerType+"=\""+handler+"\"]");
if (color == "false"){
if (visEl){
visEl.parentNode.removeChild(visEl);
}
} else {
// If it exists
if (visEl){
@marti1125
marti1125 / index.html
Created May 19, 2014 20:35
A Pen by Willy Aguirre.
<div id="visLines" class="channel-visualisation subscription-channels">
<div class="channel" color="blue" for="sendMessage" data-val="4">
4
<div class="dot color"></div>
</div>
<div class="channel" color="pink" for="clear" data-val="3">
3
<div class="dot color"></div>
</div>
@marti1125
marti1125 / gist:f06eb309f8ee1cac315f
Created June 4, 2014 15:26
restore a database sql server 2008
RESTORE DATABASE AdventureWorks
FROM DISK = 'C:\BackupAdventureworks.bak'
WITH REPLACE
@marti1125
marti1125 / gist:cf78a11178b43b22ee02
Created June 6, 2014 00:34
Fix Isuee with Icons Apache/Cordova-FirefoxOS
I did some investigation and I think the plan for now should be:
1. Create a bin/templates/project/res folder in cordova-firefox
2. Copy icons there. At least sizes 128x128 and 60x60.
3. In bin/lib/create.js, make sure you copy res folder into platforms/firefoxos/platform_www. Cordova prepare will copy files in there over to www.
4. update bin/templates/project/cordova/defaults.xml with new default icons
5. Make sure icon implementation in cordova-lib/src/cordova/metadata/firefoxos_parser.js at repo cordova-lib can find the icons.