Skip to content

Instantly share code, notes, and snippets.

View lazarofl's full-sized avatar
🏃‍♂️

Lazaro Fernandes Lima Suleiman lazarofl

🏃‍♂️
View GitHub Profile
angular.module('app').service('ComprasService', ['$http', function ($http) {
this.ObterListaDeCompras = function() {
return $http.get('/listadecompras').then(function(response) {
return response || null;
}, function(response) {
switch(response.status)
{
default:
throw 'nenhuma informação';
@lazarofl
lazarofl / appMock.js
Created May 29, 2014 06:07
$httpBackend implementation
var app = angular.module('app', []);
app.run(function($httpBackend){
$httpBackend.whenGET('/listadecompras').respond(
[ {
nome: 'Pão',
quantidade: 2,
comprado: false
},
{
@lazarofl
lazarofl / appMock.js
Created May 30, 2014 19:10
$httpBackend para simular as requisições da app de lista de compras
var app = angular.module('app', []);
app.run(function($httpBackend){
$httpBackend.whenGET('/listadecompras').respond(
[ {
nome: 'Pão',
quantidade: 2,
comprado: false
},
{
@lazarofl
lazarofl / appSpec.js
Created May 30, 2014 19:18
Teste para a app de lista de compras utilizando Jasmine
describe('Service: ComprasService', function () {
var ComprasService, $httpBackend;
beforeEach(function(){
module('app');
inject(function($injector){
ComprasService = $injector.get('ComprasService');
$httpBackend = $injector.get('$httpBackend');
});
(function() {
var jasmineEnv = jasmine.getEnv();
jasmineEnv.updateInterval = 250;
/**
Create the `HTMLReporter`, which Jasmine calls to provide results of each spec and each suite. The Reporter is responsible for presenting results to the user.
*/
var htmlReporter = new jasmine.HtmlReporter();
jasmineEnv.addReporter(htmlReporter);
@lazarofl
lazarofl / WebExtensions.cs
Last active January 13, 2016 21:52
Generic C# extension to retrieve data from web/api and convert then to an object
public static class WebExtensions
{
public static T GetResultFromWeb<T>(string url) where T : new()
{
using (var webClient = new WebClient())
{
var json_data = string.Empty;
try
{
!function(){"use strict";angular.module("ngCalendarium",[]).constant("calendarConfig",{template:['<div class="calendarium">','<div class="header">','<button class="previous" ng-click="previousMonth()" title="previous month" ><<</button>',"<h1>{{monthLabel}}/{{yearLabel}}</h1>",'<button class="next" ng-click="nextMonth()" title="next month" >>></button>',"</div>",'<ol class="day-names clear">','<li ng-repeat="weekDay in weekDays">{{weekDay}}</li>',"</o>",'<ol class="days">','<li ng-repeat="dateContainer in dateContainers" title="{{dateContainer.state.tooltip}}">','<div ng-if="dateContainer.state.disabled" class="date disabled" ng-class="dateContainer.state.className"></div>','<div ng-if="!dateContainer.state.disabled && !isDate(dateContainer.date)" class="date empty"></div>','<div ng-if="!dateContainer.state.disabled && isDate(dateContainer.date)" ng-class="dateContainer.state.className" class="date" ng-click="selectDate(dateContainer.date,dateContainer.state)">{{dateContainer.date.getDate()}}</div>',"</li>","
using HoloToolkit.Unity.InputModule;
using UnityEngine;
public class HologramBehaviors : MonoBehaviour, IFocusable, IInputClickHandler
{
[SerializeField]
public bool IsRotating = false;
[SerializeField]
public Color FocusedColor = Color.red;
@lazarofl
lazarofl / update-vs-code.sh
Last active October 24, 2018 13:44
Update VS Code for Ubuntu 64 bits from command line
wget https://vscode-update.azurewebsites.net/latest/linux-deb-x64/stable -O /tmp/code_latest_amd64.deb
sudo dpkg -i /tmp/code_latest_amd64.deb
@lazarofl
lazarofl / reduce_faces.py
Created May 25, 2018 01:29 — forked from tylerlindell/reduce_faces.py
script for reducing faces programmatically with Meshlab's api
#!/usr/bin/env python
import sys
import os
import subprocess
# Script taken from doing the needed operation
# (Filters > Remeshing, Simplification and Reconstruction >
# Quadric Edge Collapse Decimation, with parameters:
# 0.9 percentage reduction (10%), 0.3 Quality threshold (70%)