Skip to content

Instantly share code, notes, and snippets.

View rashad612's full-sized avatar
💭
I may be slow to respond.

Rashad Majali rashad612

💭
I may be slow to respond.
View GitHub Profile
function getUnreadItems() {
$.ajax({
url : "https://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name=" + account + "&count=1",
dataType : "jsonp",
success: function(results) {
var id = results['0'].id;
var text = results['0'].text;
var initialValue = results['0'].id;
var avatar = results['0'].user.profile_image_url;
@rashad612
rashad612 / gist:9760822
Created March 25, 2014 12:25
Dust.js decode html filter [ Browser ].
/**
* Dust.js decode html filter. Only in browser.
*/
(function(dust) {
dust.filters = dust.filters || {};
dust.filters.dh = function(value) {
var d = document.createElement('div');
d.innerHTML = value;
return d.textContent;
};
@rashad612
rashad612 / gist:eab7c3afbbf0bd70ffc4
Created June 24, 2014 10:19
Force tlp to full charge battery temporary
$ [sudo] tlp fullcharge BAT0
@rashad612
rashad612 / gist:062622a6505c9f55236f
Last active August 29, 2015 14:05
NodeJS Simple md5 reusable module
module.exports = function(string) {
var md5 = require('crypto').createHash('md5');
md5.update(string);
return md5.digest('hex');
};
@rashad612
rashad612 / gist:76fbd09ad8ef9b54fbc5
Last active August 29, 2015 14:08
Get version from package.json
$ cat package.json | grep version | awk '{print $2}' | sed s/\"//g | sed s/,//g
@rashad612
rashad612 / gist:d55cb345d5baf191cc83
Created March 5, 2015 17:28
javaScript: Search for cookie [ name or value ]
var search = 'search-phrase';
var matches = document.cookie.split(';').filter(function(e) { return new RegExp(search, 'gi').test(e); });
@rashad612
rashad612 / ffd.desktop
Created June 15, 2015 14:54
Firefox Developer Edition | Desktop File | Fedora
[Desktop Entry]
Version=1.0
Name=Firefox Developer Edition
Comment=Browse the Web
Exec=/opt/firefox/firefox --class="firefox-developer" -P dev-edition-default %u
StartupNotify=true
StartupWMClass=firefox-developer
Icon=/opt/firefox/browser/icons/mozicon128.png
Terminal=false
@rashad612
rashad612 / xdg-desktop-menu.sh
Last active March 20, 2018 11:26
Install/Update new desktop entry: Gnome3/Fedora
xdg-desktop-menu install [path to .desktop file]
@rashad612
rashad612 / xdottool.sh
Last active March 24, 2018 13:12
xdottools
#!/bin/sh
bash -c "xdotool getactivewindow key Home"
bash -c "xdotool getactivewindow key End"
source "/usr/share/tmux/powerline.conf"
# split panes using | and -
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
set-option -g status-interval 1
set-option -g automatic-rename on
set-option -g automatic-rename-format '#{b:pane_current_path}'
setw -g mode-keys vi