Skip to content

Instantly share code, notes, and snippets.

@alfchee
alfchee / topkeywords.js
Created October 6, 2015 21:31 — forked from elliotbonneville/topkeywords.js
Find top keywords associated with a Google search with this Node.js application.
var request = require("request"),
cheerio = require("cheerio"),
url = "https://www.google.com/search?q=data+mining",
corpus = {},
totalResults = 0,
resultsDownloaded = 0;
function callback () {
resultsDownloaded++;
@alfchee
alfchee / AbstractModel.php
Created October 2, 2015 03:24
It's an abstract class that works magic methods and properties
<?php
class AbstractModel {
protected $fillable = array();
protected $data = array();
// set magicaly the data attributes
protected function __set($name,$value) {
$this->data[$name] = $value;
@alfchee
alfchee / TP_Camera
Created September 25, 2015 23:14
Is a Third Person Camera that allows to brings to the Main Camera of an scene in Unity3D to follow the main character that have a lookAt object in it's hierarchy
using UnityEngine;
using System.Collections;
public class TP_Camera : MonoBehaviour
{
public static TP_Camera Instance;
public Transform TargetLookAt;
public float Distance = 5f;
public float DistanceMin = 3f;
@alfchee
alfchee / invitacion_dcora
Last active August 29, 2015 14:24
Invitación de D'Cora
<html>
<head>
<meta charset="utf-8">
<link href='http://fonts.googleapis.com/css?family=Lato:300|Open+Sans' rel='stylesheet' type='text/css'>
</head>
<body>
<style>
/*@import url(http://fonts.googleapis.com/css?family=Lato|Open+Sans:300italic);*/
body {
@alfchee
alfchee / cIP
Last active August 29, 2015 14:24
cIP
<?php
/**
$Id: cIP.php,v 1.0 2010/10/14 20:07:04 laudarch Exp $
Author: Archzilon Eshun-Davies
URL: http://www.phpclasses.org/package/8494-PHP-Determine-the-IP-address-of-the-user-from-headers.html
License: BSD License
PHP v: 5.0
*/
# Set to true if you want to test the class
<?php
// app/start/global.php
/*
|--------------------------------------------------------------------------
| Application Error Logger
|--------------------------------------------------------------------------
|
| Here we will configure the error logger setup for the application which
### USAGE
###
### ./ElasticSearch.sh 1.5.0 will install Elasticsearch 1.5.0
### ./ElasticSearch.sh 1.4.4 will install Elasticsearch 1.4.4
### ./ElasticSearch.sh will fail because no version was specified (exit code 1)
###
### CLI options Contributed by @janpieper
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch
### ElasticSearch version
@alfchee
alfchee / DragNDrop
Last active August 29, 2015 14:22
Drag some information from a <table> to a div and make it an item of a list-group of twitter bootstrap. Uses jQuery and Underscore
/// About DragNDrop for....
/// LocalStorage para las operaciones a consolidar
// recuperación del localStorage
aConsolidar = JSON.parse(localStorage.getItem('aConsolidar'));
// si no existe se crea un array sin contenido
if(aConsolidar === null) {
aConsolidar = [];
} else {