Skip to content

Instantly share code, notes, and snippets.

View diewland's full-sized avatar
✳️

diewland.eth diewland

✳️
View GitHub Profile
@diewland
diewland / get_combobox_index.js
Created January 21, 2017 15:26
Find combobox index on change event
$('#combobox').change(function(){
var idx = $(this)[0].selectedIndex;
console.log(idx);
});
@diewland
diewland / pre_debug.php
Created January 4, 2017 07:27
Debug php variable in good format
function pre_debug($data){
echo '<pre>'.print_r($data, true).'</pre>';
}
@diewland
diewland / edit_git_config.sh
Created January 3, 2017 15:56
Edit .gitconfig global file
git config --global -e
@diewland
diewland / php_to_js.php
Last active January 3, 2017 08:32
Transform data from php to javascript
<script>
<?php
echo "var data = ".json_encode($data).";";
?>
</script>
@diewland
diewland / debug_post.php
Last active December 22, 2016 01:14
Display beautiful variable data to screen
function debug_post(){
echo '<pre>'.print_r($_POST, true).'</pre>';
}
@diewland
diewland / bulma-combobox-css-fixed.css
Last active February 20, 2017 09:08
Fixed some elements css of bulma.io
/*
--- combobox with icon ---
<div class="control has-icon">
<div class="select is-fullwidth">
<select name='my_cbb'>
<option value='1'>value 1</option>
<option value='2'>value 2</option>
<option value='3'>value 3</option>
</select>
</div>
@diewland
diewland / download_flickr_photos.py
Created November 16, 2016 10:57
Download flickr 100 photos from api
import requests
import urllib
tag = 'person'
url = "https://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=881cbcfeb398828ea12b253c1743224e&text=%s&format=json&nojsoncallback=1" % tag
proxies = {'http': 'http://your.proxy:port/'}
r = requests.get(url)
image = urllib.URLopener(proxies)
@diewland
diewland / ez_db.php
Last active July 8, 2017 08:51
$pdo helper class
<?php // require initialize $pdo from outside
class EzDb {
// init pdo function
public static function init_pdo($host, $db_name, $user, $pass){
global $pdo;
return new PDO(
"mysql:host=$host;dbname=$db_name;charset=utf8",
$user,
$pass,
@diewland
diewland / .gitconfig
Last active January 3, 2017 15:56 — forked from ColinHarrington/.gitconfig
git aliases
[user]
name = diewland
email = [email protected]
[alias]
st = status
ci = commit
br = branch
co = checkout
l = log --graph --decorate --pretty=oneline --abbrev-commit -n 10
ll = log --graph --decorate --pretty=oneline --abbrev-commit --all
@diewland
diewland / n10_hdmi_resolution.txt
Created June 16, 2016 04:44
Nexus 10 change resolution script for fix hdmi problem
# ----------------
# http://forum.xda-developers.com/showthread.php?t=2278508
# http://forum.xda-developers.com/showthread.php?t=2294786
#
# (require root)
# reset
wm size reset
wm density reset
wm overscan reset