Skip to content

Instantly share code, notes, and snippets.

Fernando Basso FernandoBasso

Block or report user

Report or block FernandoBasso

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View pointers.c
#include <stdio.h>
void say_msg(char msg[]);
int main(void) {
char str[] = "C is a butt-kicking programming language.\n";
say_msg(str);
printf("%ld\n", sizeof(str)); // 43. WTF?!
printf("%ld\n", sizeof(&str)); // 8 or 4. Why? Isn't str already a pointer variable.
View SwapArgs.vim
:function! SwapArgs()
. subst :(\zs\([^,]\+\), \([^)]\+\):\2, \1
endfunction
" :call SwapArgs()
" nnoremap <Leader>sa :call SwapArgs()<CR>
@FernandoBasso
FernandoBasso / bashrc
Last active Aug 29, 2015
List all categories, and all the posts in each category.
View bashrc
unset HISTFILESIZE
HISTSIZE=2000
PROMPT_COMMAND="${PROMPT_COMMAND:-:}; history -a"
export HISTSIZE PROMPT_COMMAND
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
View nodepgsql.js
var http = require('http');
var pg = require('pg');
var constr = 'postgres://devel:1234@127.0.0.1/tcc';
var server = http.createServer(function(req, res) {
pg.connect(constr, function(err, client, done) {
var handleError = function(err) {
View Makefile
orig=tmp.c
dest=./bin/tmp.bin
SDL_FLAGS := $(shell sdl-config --cflags)
SDL_LDFLAGS := $(shell sdl-config --libs);
build:
gcc $(orig) -o $(dest) -std=c99 -Wall -pedantic $(SDL_FLAGS) $(SDL_LDFLAGS)
View prog.cpp
#include <iostream>
class Vector
{
public:
float x, y;
};
class Point
{
View Guardfile
#!/usr/bin/env ruby -wU
#
# Source:
#
# http://asciidoctor.org/docs/editing-asciidoc-with-live-preview/#using-bundler
#
Bundler.require(:default)
@FernandoBasso
FernandoBasso / app.js
Last active Aug 29, 2015
ionic open view upon clicking button
View app.js
var l = function l() {
console.log.apply(console, arguments);
};
var itemsDb = null;
// Ionic Starter App
// angular.module is a global place for creating, registering and retrieving Angular modules
View _form.html.erb
<%= form_for @user_category do |f| %>
<p>
<%= f.label :description %>
<%= f.text_field :description %>
</p>
<p>
<%= f.radio_button :status, true, :id => 'status_true' %>
<%= f.label 'Ativo', :for => 'status_true' %>
View three-table-join.sql
-- I have the tables `category`, `subscription` and `document`. Document
-- references subscription, and subscription references category. I am trying to
-- get the category name based on a documents PK. I am doing something like this:
SELECT category_name FROM categorias
INNER JOIN subscription ON category_fk = category_pk
INNER JOIN documents ON subscription_fk = document_pk
AND document_pk = 14;
You can’t perform that action at this time.