This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rails console | |
user = User.new | |
user.orders << Order.create! | |
user.save | |
#will create a User with a single new Order |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Description count LOC in files without taking commented or empty lines | |
if [[ $# < 1 ]] | |
then | |
echo Give me some folder to count into | |
echo Add some options that will be passed to find after | |
echo "loc <folder> [options]" | |
exit 0 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#This is free adaptation of an idea exposed at http://jeroenjanssens.com/2013/08/16/quickly-navigate-your-filesystem-from-the-command-line.html | |
#Include this directly in your .bashrc or source it | |
#Examples: | |
# [very/deep/path] $ mark deep | |
# [other/location] $ jmp deep | |
# $ mark list #will list all your marks | |
# $ unmark deep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef LISTENABLE_H | |
#define LISTENABLE_H | |
class Listener { | |
}; | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# generate property based QObject with common getter/setter | |
# Just implement for my naming conventions : | |
# Ex: for a new class MyGeneratedObject | |
# => header file my_generated_object.h | |
# => source file my_generated_object.cpp | |
# A property double value | |
# => member variable: double m_value | |
# => getter: double value() const; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from distutils.core import setup | |
import py2exe | |
setup( | |
options = {'py2exe': {'bundle_files': 1, 'compressed': True, 'dll_excludes': ['w9xpopen.exe']}}, | |
console=['foobar.py'], | |
zipfile = None | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#As readlink is not available on all distro or OSX, provide a portable way to get an | |
#absolute path from a relative one. | |
make_absolute() { | |
local ret=false | |
local rel_path=$1 | |
if [[ ! -z $rel_path ]]; then | |
#strip eventual last slash | |
rel_path=${rel_path%/} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A { | |
static T a; | |
static T initStaticA() { | |
T t; | |
//do some stuff on t | |
return t; | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "downloader.hpp" | |
#include <QNetworkRequest> | |
#include <QNetworkReply> | |
#include <QUrl> | |
#include <QVariant> | |
#include <QDebug> | |
Downloader::Downloader(QObject *parent) : | |
QObject(parent) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Customize BASH PS1 prompt to show current GIT repository and branch. | |
# by Mike Stewart - http://mediadoneright.com/content/ultimate-git-ps1-bash-prompt | |
# SETUP CONSTANTS | |
# Bunch-o-predefined colors. Makes reading code easier than escape sequences. | |
# I don't remember where I found this. o_O | |
# Reset | |
Color_Off="\[\033[0m\]" # Text Reset |
OlderNewer