Skip to content

Instantly share code, notes, and snippets.

@peysal
peysal / readme.md
Created December 6, 2019 13:10 — forked from benstr/readme.md
Gist Markdown Cheatsheet

#Heading 1 ##Heading 2 ###Heading 3 ####Heading 4 #####Heading 5 ######Heading 6


Paragraph

Verifying that +peysal is my blockchain ID. https://onename.com/peysal
@peysal
peysal / Where do I belong.js
Created January 14, 2016 10:33
Bonfire: Where do I belong
function where(arr, num) {
// Find my place in this sorted array.
var sortedAsc = arr.sort(function(before, after){
return before - after;
});
console.log('| sortedAsc:' + sortedAsc);
var position = sortedAsc.reduce(function(before, after){
return "ayam";
});
console.log('| ayam:' + position);
@peysal
peysal / SeekAndDestroy.js
Created January 13, 2016 11:16
Bonfire: Seek and Destroy
function destroyer(arr) {
var args = new Array(arguments.length);
for(i=0; i<args.length;i++){
args[i] = arguments[i];
}
console.log('| args[0]:' + args[0]);
var result = args[0].filter(function(element){
for(o=1; o<args.length;o++){
console.log('| making sure element:' + element + ' is not:' + args[o]);
@peysal
peysal / regex1.xml
Last active August 29, 2015 14:24
Remove xml tag and removing data within element
<mapping path="/B49C/FASE1">/B49C/FASE1</mapping>
<mapping path="/B49C/FASE2">/B49C/FASE2</mapping>
@peysal
peysal / couchdb_note
Last active August 29, 2015 14:15
Couchdb exploration
Map objective: build up key
Key query: use browser to query.
example http://127.0.0.1:5984/cms21_sample_file/_design/sample_file/_view/account?key=[%22C002%22,%222001%22]
This example query multiple key value
Tips 1: key shuoldnt contain any empty space infront or at back. Use trim. Ease the process building the URL request
Using Curl: http://stackoverflow.com/questions/8333920/passing-a-url-with-brackets-to-curl
example curl -X GET http://127.0.0.1:5984/cms21_sample_file/_design/sample_file/_view/account?key=[%22C002%22,%222001%22] -g
@peysal
peysal / input.html
Created August 14, 2014 13:57
Basic input
<div class="container">
<div class="row clearfix">
<div class="col-md-12 column">
<div class="page-header">
<h1>
Example page header <small>Subtext for header</small>
</h1>
</div>
<ul class="nav nav-tabs">
<li class="active">
@peysal
peysal / 0_reuse_code.js
Created August 12, 2014 14:21
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@peysal
peysal / GroovyShell.groovy
Created March 26, 2014 09:28
Groovy process calling external groovy script
def shell = new GroovyShell()
def file = new File("SqlGroovy.groovy")
shell.evaluate(file)
@peysal
peysal / SqlGroovy.groovy
Created March 26, 2014 09:23
Basic sql query to db using groovy
import groovy.sql.Sql
String db_server = "bun"
String db_database = "bun"
String db_port = "1433"
String db_user = "bun"
String db_password = "bun"
String connectionUrl = "jdbc:sqlserver://" + db_server + ":" + db_port +
";database=" + db_database +
";user=" + db_user +