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
let result = |word| { | |
// Heavy logic // | |
let fname = "text_to_find.txt"; | |
// Contents of file | |
let contents = fs::read_to_string(fname).expect("Something went wrong reading the file"); | |
// Search a word into file's content | |
match contents.find(word) { | |
Some(v) => v as u64, | |
None => 0 |
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
const VALUES_COP: &'static [i32;4] = &[50000, 20000, 10000, 2000]; | |
// macro called cashier | |
macro_rules! cashier { | |
() => { // without arguments | |
println!("Now is necessary that you enter a quantity."); | |
}; | |
($($x: expr),+) => { // 1 to n arguments | |
{ | |
let mut total: u64 = 0; |
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
// other Code ... | |
trait Travel { | |
fn new(destination: &'static str) -> Self; | |
fn go(&self) -> &'static str; | |
} | |
impl Travel for Man { | |
fn new(destination: &'static str) -> Man { | |
// logic ... |
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
struct Man { | |
name: &'static str, | |
cellphone: i64, | |
is_alive: bool, | |
} | |
trait Person { | |
fn new(name: &'static str, cellphone: &i64) -> Self; | |
fn name(&self) -> &'static str; | |
fn is_alive(&self) -> &bool; |
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
.background-flicker { | |
background-color: #FFF; | |
animation: flicker 2s; | |
-webkit-animation: flicker 2s; | |
-moz-animation: flicker 2s; | |
animation-iteration-count: infinite; | |
-webkit-animation-iteration-count: infinite; | |
-moz-animation-iteration-count: infinite | |
} |
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
import Component from './component'; | |
class Widget extends Component { | |
init(ctrl) { | |
var props = this.props; | |
ctrl.counter = props.initialValue; | |
ctrl.increment = function() { | |
ctrl.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
import m from 'mithril'; | |
import stream from 'mithril/stream'; | |
import {Button} from '../../ui'; | |
import {Account} from '../../models'; | |
export const FormAccountPublicPage = { | |
oninit(vnode) { | |
this.loading = true; | |
this.saving = false; | |
this.errors = false; |
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
// ES7, async/await | |
function sleep(ms = 0) { | |
return new Promise(r => setTimeout(r, ms)); | |
} | |
(async () => { | |
console.log('a'); | |
await sleep(1000); | |
console.log('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
ּ_בּ | |
בּ_בּ | |
טּ_טּ | |
כּ‗כּ | |
לּ_לּ | |
מּ_מּ | |
סּ_סּ | |
תּ_תּ | |
٩(×̯×)۶ | |
٩(̾●̮̮̃̾•̃̾)۶ |
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
import java.sql.Connection; | |
import java.sql.DriverManager; | |
import java.sql.ResultSet; | |
import java.sql.Statement; | |
import javax.sql.rowset.CachedRowSet; | |
import com.sun.rowset.CachedRowSetImpl; | |
/** | |
* | |
* @author beastieux |
NewerOlder