Skip to content

Instantly share code, notes, and snippets.

View iamsebastian's full-sized avatar

Sebastian Blei iamsebastian

View GitHub Profile
@iamsebastian
iamsebastian / gist:dc869429e78ef22a8bfd67b3eda22178
Created March 25, 2019 16:33
Try to speedup Dell Boomi mapping
var i = function(f1, f2) { $('body > div:nth-child(21) > div:nth-child(2) > div > div:nth-child(5) > div > div > div:nth-child(4) > div > div:nth-child(3) > div > div:nth-child(3) > div > div:nth-child(4) > div > div:nth-child(2) > div > div.component_editor_panel > div > div:nth-child(2) > div > div:nth-child(3) > div > div:nth-child(8) > div > div:nth-child(2) > div > div:nth-child(3) > div > div.text_search_box > input').value = f1; $('body > div:nth-child(21) > div:nth-child(2) > div > div:nth-child(5) > div > div > div:nth-child(4) > div > div:nth-child(3) > div > div:nth-child(3) > div > div:nth-child(4) > div > div:nth-child(2) > div > div.component_editor_panel > div > div:nth-child(2) > div > div:nth-child(3) > div > div:nth-child(8) > div > div:nth-child(4) > div > div:nth-child(3) > div > div.text_search_box > input').value = f2; };
var j = function(arg) { var spl = arg.split('\t'); i.call(spl); console.log(spl); i.apply(this, spl);}
j('src_field dest_field');
@iamsebastian
iamsebastian / nginx.conf
Created December 13, 2018 12:13
[nginx] proxy pass with PATCH instead of PUT
# This is your nginx.conf to setting up a proxy, changing the
# HTTP method from * to PATCH, and forward the request.
http {
server {
listen 80;
location / {
proxy_method PATCH;
proxy_pass http://YOUR_URL:YOUR_PORT/;
}
❯ RUST_BACKTRACE=full cargo run --bin main
Compiling ...
error[E0412]: cannot find type `table` in module `age_within_the_range_gs`
--> src/models/age_within_the_range_gs.rs:18:10
|
18 | #[derive(AsChangeset, Clone, Debug, Insertable, RustcDecodable, RustcEncodable)]
| ^^^^^^^^^^^ did you mean `Table`?
|
help: possible candidates are found in other modules, you can import them into scope
|
@iamsebastian
iamsebastian / x.rs
Created July 5, 2017 08:34
group_by, api, rust
#[derive(Debug, RustcEncodable)]
struct ByRoughSegm {
count: i32,
id: i32,
kut_id: i32,
oe_id: i32,
sector_id: i32,
segment_id: i32,
}
let vec = X::find_all_based_on_y(y);
fn1(&Some(vec));
fn2(&Some(vec));
fn3(&Some(vec));
@iamsebastian
iamsebastian / gen.rs
Created October 27, 2016 11:01
Generate rust struct with documentation
macro_rules! generate_import_struct {
($doc:expr, name: $name:ident, $($element: ident: $ty: ty : $elem_doc: expr),*) => {
#[doc=$doc]
pub struct $name {
pub id: i32,
$(#[doc=$elem_doc]
pub $element: $ty),*
}
}
}
@iamsebastian
iamsebastian / application.adapters.application.js
Last active December 9, 2015 15:18
Why are the banks not set as relationships?
import DS from 'ember-data';
//import ENV from '../config/environment';
export default DS.JSONAPIAdapter.extend({
host: '',// is configured in environment
namespace: ''// is configured in environment,
});
@iamsebastian
iamsebastian / gist:479907d6384874a3da85
Created November 26, 2015 08:21
GET ALL blz TABLES
SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME='blz' AND (COLUMN_KEY>'');
lcount=0; echo 'Please enter your mysql username:'; read mysqluser; echo '\nPlease enter your mysql password:'; read mysqlpw; echo 'SELECT TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME="blz" AND !(COLUMN_KEY>"") AND TABLE_SCHEMA="macsi";' | mysql -u$mysqluser -p$mysqlpw macsi | while read -r line; do if [ "$line" != "TABLE_NAME" ]; then ((lcount++)); echo 'ALTER TABLE `'$line'` ADD INDEX(`blz`);' | mysql -u$mysqluser -p$mysqlpw macsi; fi; done; echo '\n'$(tput setaf 2)'Successfully altered '$(tput setaf 3)$lcount$(tput setaf 2)' tables (added index to them).';
@iamsebastian
iamsebastian / playground.rs
Created October 18, 2015 18:30 — forked from anonymous/playground.rs
Shared via Rust Playground
fn main() {
let i_start: i8 = 50;
let i_end: i8 = 64;
for i in i_start..i_end {
let l = twice(i);
println!("{}", l);
}
}
fn twice(a: i8) -> i8 {