Skip to content

Instantly share code, notes, and snippets.

View vicentereig's full-sized avatar
🐢

Vicente Reig vicentereig

🐢
View GitHub Profile
@domderen
domderen / install.sh
Last active April 17, 2022 06:28
Installation of apache spark on ubuntu machine.
#!/bin/sh
# installation of Oracle Java JDK.
sudo apt-get -y update
sudo apt-get -y install python-software-properties
sudo add-apt-repository -y ppa:webupd8team/java
sudo apt-get -y update
sudo apt-get -y install oracle-java7-installer
# Installation of commonly used python scipy tools
@cybrox
cybrox / EmberChartComponent.js
Created June 5, 2014 12:39
Use Chart.js as a simple Ember.js component
/**
* This is a very simple example of an ember component to integrate
* nnick/chart.js in an ember.js application. Basically, it is simply
* using the components hook to create a ChartJS canvas element.
* Additionally, it supports an update property that allows you to
* let the chart re-rendet if your data or options change. Chart.js
* doesn't support updating its data so this will just create a new
* chart on the given canvas.
*
* Example usage in a handlebars template:
@extralam
extralam / AndroidHttpService.java
Last active August 29, 2015 14:02
Custom Http Service in Background thread
package com.extralam.api;
import android.app.TaskStackBuilder;
import android.os.SystemClock;
import android.util.Log;
import org.apache.http.*;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpGet;
@tadast
tadast / ssl_puma.sh
Last active January 29, 2024 04:41 — forked from trcarden/gist:3295935
localhost SSL with puma
# 1) Create your private key (any password will do, we remove it below)
$ cd ~/.ssh
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
@huacnlee
huacnlee / grape_runtime_log.rb
Last active July 3, 2016 09:56
Output request time spend and parameters in log for Grape
require 'grape'
class API < Grape::API
before do
@log_start_t = Time.now
Rails.logger.info " Parameters: #{params.to_hash.except("route_info")}"
end
after do
@log_end_t = Time.now
function saveObject(request) {
// Return 200 and close the connection right away.
// The client doesn't need to wait for the DB.
request.reply({}).code(200);
db.ModelFoo.create(request.params).success(function(record) {
// This event gets fired some milliseconds later.
// You can chain other business logic here or log success.
});
@elado
elado / AngularBaseCtrl.coffee
Last active January 28, 2017 08:43
Angular.js CoffeeScript Controller Base Class
# dependency - Function.prototype.bind or underscore/lodash
app = angular.module 'someApp'
class @BaseCtrl
@register: (app, name) ->
name ?= @name || @toString().match(/function\s*(.*?)\(/)?[1]
app.controller name, @
@inject: (args...) ->
@rwjblue
rwjblue / computed_on_pojos.js
Created December 13, 2013 15:24
Using Ember.computed on a Plain Old Javascript Object.
pojo = {awesome: false};
Ember.defineProperty(pojo, 'computedAwesomeness', Ember.computed.not('awesome'));
alert("Computed Awesomeness: " + Ember.get(pojo, 'computedAwesomeness'));
#!/usr/bin/env ruby
require 'base64'
require 'open-uri'
# file or url
def get_css(src)
if src.start_with? 'http'
src = src.gsub('|', '%7C')
STDERR.puts "# GET #{src}"
# simulate modern browser to get woff
@rogchap
rogchap / RCDropdown.h
Created August 21, 2013 02:58
Simple native iOS dropdown using UITextFiled
#import <UIKit/UIKit.h>
@interface RCDropdown : UITextField
@property (nonatomic) id<UIPickerViewDelegate> pickerDelegate;
@property (nonatomic) id<UIPickerViewDataSource> pickerDataSource;
@end