Skip to content

Instantly share code, notes, and snippets.

View stivenson's full-sized avatar
🏠
Working from home

Stivenson stivenson

🏠
Working from home
View GitHub Profile
@stivenson
stivenson / fillfortesting.js
Last active August 12, 2016 17:13 — forked from jonkemp/prepopulate.html
Fill your forms with random data. For testing forms. Requires jQuery.
$( function() {
$('form').find('input:text').val( function(i, val) {
return randomText();
});
$('form').find('input[type="number"]').val( function(i, val) {
return randomInt();
});
@stivenson
stivenson / c_p_jdbc.java
Created February 15, 2017 15:17
Conection Postgresql with jdbc
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import java.sql.ResultSet;
import javax.sql.rowset.CachedRowSet;
import com.sun.rowset.CachedRowSetImpl;
/**
*
* @author beastieux
*/
@stivenson
stivenson / c_m_jdbc.java
Created February 15, 2017 15:21
Conection mysql with jdbc
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
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶
@stivenson
stivenson / 1-sleep-es7.js
Created May 1, 2017 02:40 — forked from danharper/1-sleep-es7.js
ES7's async/await syntax.
// ES7, async/await
function sleep(ms = 0) {
return new Promise(r => setTimeout(r, ms));
}
(async () => {
console.log('a');
await sleep(1000);
console.log('b');
})()
@stivenson
stivenson / account.js
Created May 12, 2017 16:07 — forked from fernandez14/account.js
Mithril 1.x component example.
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;
@stivenson
stivenson / app.js
Created May 13, 2017 06:30 — forked from tobyzerner/app.js
Mithril ES6 Components
import Component from './component';
class Widget extends Component {
init(ctrl) {
var props = this.props;
ctrl.counter = props.initialValue;
ctrl.increment = function() {
ctrl.counter++;
@stivenson
stivenson / flicker.css
Created December 23, 2017 20:38
Flicker color on div
.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
}
@stivenson
stivenson / example-struct-trait-impl.rs
Created July 1, 2019 01:20
Example use of Struct, Trait and impl in rust-lang
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;
@stivenson
stivenson / new-trait-to-man-struct.rs
Created July 1, 2019 02:54
Example of new trait to man struct
// 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 ...