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 <stdio.h> | |
#include "../cspec/cspec.c" | |
int * some_function(){ | |
static int fun_call_counter = 0; | |
fun_call_counter++; | |
return &fun_call_counter; | |
} |
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 <stdio.h> | |
#include "../cspec/cspec.c" | |
// Withour this line, compiler wont compile your code. | |
// error: `some_var_declared_somewhere` undeclared (first use in this function) | |
extern int some_var_declared_somewhere; | |
void test_runner(void); | |
void main(){ |
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 <stdio.h> | |
#include <stdlib.h> | |
#include <assert.h> | |
int* getSum(int a, int b){ | |
/* Local var stored in `heap` instead of `stack` */ | |
int* sum = malloc(sizeof(int)); | |
*sum = a + b; |
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 all the preexisting configs | |
include "/usr/share/nano/*.nanorc" | |
set linenumbers | |
set tabsize 4 | |
set tabstospaces |
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
git filter-branch --commit-filter \ | |
'if [ "$GIT_AUTHOR_EMAIL" = "old_email" ]; then \ | |
export GIT_AUTHOR_NAME="Shiva Bhusal";\ | |
export GIT_AUTHOR_EMAIL=new_emil;\ | |
export GIT_COMMITTER_NAME="Shiva Bhusal";\ | |
export GIT_COMMITTER_EMAIL="new_emailu@gmail.com";\ | |
fi;\ | |
git commit-tree "$@"' |
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
syntax "markdown" "\.md$" "\.markdown$" | |
## Quotations | |
color cyan "^>.*" | |
## Emphasis | |
color green "_[^_]*_" | |
color green "\*[^\*]*\*" | |
## Strong emphasis |
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 Board | |
def initialize(text) | |
@text = text | |
end | |
def display | |
@text | |
end | |
end |
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
# What happens to existing behavior if older version object still exists | |
class MyClass | |
def print | |
puts 'This is still old behavior' | |
end | |
end | |
old_class = MyClass.new | |
# Modifying the original blue print or prototype |
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
# Some use case of OpenClass feature | |
def red(string) | |
color_code = 31 | |
"\e[#{color_code}m#{string}\e[0m" | |
end | |
def blue(string) | |
color_code = 34 | |
"\e[#{color_code}m#{string}\e[0m" | |
end |
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
3.times do | |
class A | |
puts "Class opened" | |
end | |
end | |
# => Class opened | |
# => Class opened | |
# => Class opened |