Skip to content

Instantly share code, notes, and snippets.

View Gazer's full-sized avatar
💭
Coding

Ricardo Markiewicz Gazer

💭
Coding
View GitHub Profile
class User
def full_name
"BLA"
end
alias :full_name, :real_full_name
def full_name
@cache ||= real_full_name
end
end
<VirtualHost *:80>
<Directory "/xxx/yyy/zzz/falta-uno/current/public">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
ServerAdmin mimail@midominio.com
DocumentRoot /xxx/yyy/zzz/falta-uno/current/public
void
setup_language_manager_path(GtkSourceLanguageManager *lm)
{
gchar **lang_files;
int i, lang_files_count;
char **new_langs;
lang_files = g_strdupv (gtk_source_language_manager_get_search_path (lm));
lang_files_count = g_strv_length (lang_files);
@Gazer
Gazer / MyModel.rb
Created May 31, 2011 21:44
URL for models in JSON Response
class MyModel
attr_accessor :item_url
def as_json(options={})
{
:url => item_url
}.merge(self.attributes)
end
end
<?php
$api = new CSApi($public_key, $private_key);
$res = $api->check_authentication('e@mail.com', 'clave');
if ($api->has_errors) {
echo "$api->last_error.\n";
} else {
if ($res == 0) {
@Gazer
Gazer / index.php
Created April 10, 2013 21:00
Refactoring a SlimFramework-based app for fun & profit
<?php
get('/', function () {
$contacts = ORM::for_table('contact')->find_many();
render('home.php', array('contacts' => $contacts));
});
get('/contacts/new', function () {
render('contacts/form.php', array(
@Gazer
Gazer / localhost.conf
Last active October 20, 2021 14:55
Nginx example to redirect users to a "Comming soon portal" if they are not developers.
server {
listen 80;
server_name localhost;
location @until {
# Static "comming soon" directory with index.html and assets
root /var/www/;
index index.html;
}
@Gazer
Gazer / distance.ino
Created January 31, 2014 22:27
Ejemplo sensor ultrasónico HC-SR04 con Arduino y NewPing
#include <NewPing.h>
#define trigPin 2
#define echoPin 4
NewPing sonar(trigPin, echoPin, 800);
void setup() {
Serial.begin(9600);
}
@Gazer
Gazer / clean_noise.sh
Created May 28, 2014 03:25
Noise Removal using avconv and sox
#!/bin/sh
# Tested with :
# * avconv version 9.13-6:9.13-0ubuntu0.14.04.1,
# * SoX v14.4.1
#
# Just run clean.sh input_file.mp4 output_file.mp4
INPUT=$1
OUTPUT=$2
@Gazer
Gazer / MainActivity.groovy
Created December 29, 2014 16:23
Groovy on Android
@CompileStatic
public class MainActivity extends ActionBarActivity {
TextView textView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
textView = findViewById(R.id.text) as TextView;