Skip to content

Instantly share code, notes, and snippets.

View iSWORD's full-sized avatar
:shipit:

Muha Ajjan iSWORD

:shipit:
View GitHub Profile
@iSWORD
iSWORD / css
Created October 30, 2012 13:22
HTML+JS Supa-Cool Progbar
#o{
width: 200px;
height: 20px;
box-shadow: 0 0 1px gray;
}
#i{
background: -webkit-repeating-linear-gradient(-45deg, rgba(157,213,58,1) 0,rgba(161,213,79,1) 15,rgba(128,194,23,1) 16,rgba(124,188,10,1) 30);
height: 20px;
}
@iSWORD
iSWORD / html+inline js
Created October 30, 2012 13:30
HTML+JS Chrome editable select element
<style>
.select-editable { position:relative; background-color:white; border:solid grey 1px; width:120px; height:18px; }
.select-editable select { position:absolute; top:0px; left:0px; font-size:14px; border:none; width:120px; margin:0; }
.select-editable input { position:absolute; top:0px; left:0px; width:100px; padding:1px; font-size:12px; border:none; }
.select-editable select:focus, .select-editable input:focus { outline:none; }
</style>
<div class="select-editable">
<select tabindex="-1" onchange="this.nextElementSibling.value=this.value">
<option value=""></option>
@iSWORD
iSWORD / html+inline js
Created October 30, 2012 13:30
HTML+JS Cross-browser editable select tag
<select name="project" onchange="t=this;n=t.nextElementSibling;if(t.value=='new')if(confirm('Add new '+t.name+'?')){n.style.display='inline-block'; n.name=t.name; t.name=''; t.style.display='none'; n.focus()}">
<option value="new"><new project></option>
<option selected>Project1</option>
<option>Project2</option>
<option>Project3</option>
</select>
<input style="display:none">
@iSWORD
iSWORD / html+inline js
Created October 30, 2012 13:31
HTML+JS Mega-min special char escaper
<textarea style="display:block" cols=42 rows=10 onkeyup="t=this;t.nextElementSibling.value=t.value.replace(/</g,'&amp;lt;').replace(/>/g,'&amp;gt;')"></textarea>
<textarea readonly onclick="t=this;t.focus();t.select();"></textarea>
@iSWORD
iSWORD / dabblet.css
Created January 25, 2013 22:08
Untitled
div:not(#container){
background: rgb(127,125,224);
text-align: center;
width: 46px;
height: 46px;
margin: 2px;
font: 26px Helvetica;;
}
#container{
@iSWORD
iSWORD / template.asm
Last active December 15, 2015 14:25
AVR Assembly Template
.INCLUDE "m8def.inc"
;====================================================================
;
; AVR assembly template
;
; Author: Muhannad Ajjan (contact@isword.me)
; Created: Tue Dec 8 2015
; Processor: ATmega8
; Frequency: 1 MHz
# https://youtu.be/RTSGm-a0h1Q
from gi.repository import Gtk, Gdk
from scipy import misc
import serial
FILENAME = '/home/isword/Pictures/jb.jpg'
DEVICE = '/dev/ttyACM0'
BAUDRATE = 115200
#!/usr/bin/python2
import sys, fontforge, string
allowed_chars = string.printable # ascii (32 -> 126)
if len(sys.argv) == 3:
font = fontforge.open(sys.argv[1])
for char in allowed_chars.decode("UTF-8"):
font.selection[ord(char)] = True
@iSWORD
iSWORD / shuffle.js
Last active February 15, 2023 20:11
Shuffle & Unshuffle an Array in JavaScript & Swift
// Functions
let shuffle = (inArr, seed, unshuffle = false) => {
let outArr = Array.from(inArr),
len = inArr.length
let swap = (a, b) => [outArr[a], outArr[b]] = [outArr[b], outArr[a]]
for (
@iSWORD
iSWORD / create-tlds.sh
Created June 20, 2018 08:46
.laravel + .localhost TLDs with dynamic nginx configuration
echo 'address=/localhost/127.0.0.1' | sudo tee /etc/NetworkManager/dnsmasq.d/development-tlds > /dev/null
echo 'address=/laravel/127.0.0.1' | sudo tee -a /etc/NetworkManager/dnsmasq.d/development-tlds > /dev/null
sudo service NetworkManager reload