Skip to content

Instantly share code, notes, and snippets.

View iraycd's full-sized avatar
🎯
Focusing

Ray Ch iraycd

🎯
Focusing
View GitHub Profile
@iraycd
iraycd / example-user.js
Created May 6, 2012 06:35 — forked from nijikokun/example-user.js
Beautiful Validation..Javascript Username and Password Validation
var user = {
validateCredentials: function (username, password) {
return (
(!(username += '') || username === '') ? { error: "No Username Given.", field: 'name' }
: (!(username += '') || password === '') ? { error: "No Password Given.", field: 'pass' }
: (username.length < 3) ? { error: "Username is less than 3 Characters.", field: 'name' }
: (password.length < 4) ? { error: "Password is less than 4 Characters.", field: 'pass' }
: (!/^([a-z0-9-_]+)$/i.test(username)) ? { error: "Username contains invalid characters.", field: 'name' }
: false
);
@iraycd
iraycd / gist:3812173
Created October 1, 2012 14:37
Error In the MySQL
(app)dilipray@app$ python manage.py syncdb
Creating tables ...
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_user_permissions
Creating table auth_user_groups
Creating table auth_user
Creating table django_content_type
Creating table django_session
@iraycd
iraycd / .bash_profile
Created October 1, 2012 14:43
.bash_profile
export LANG="en_US.UTF-8"
export LC_COLLATE="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"
export LC_MESSAGES="en_US.UTF-8"
export LC_MONETARY="en_US.UTF-8"
export LC_NUMERIC="en_US.UTF-8"
export LC_TIME="en_US.UTF-8"
export LC_ALL=
sudo apt-get install python3
sudo apt-get install git-core
sudo apt-get install ninja-ide
sudo apt-get install postgresql-9.1
sudo apt-get install python-pip libpq-dev python-dev build-essential
sudo pip install --upgrade pip
sudo pip install --upgrade virtualenv
sudo virtualenv my_env_name --no-site-packages
source my_env_name/bin/activate
pip install django
@iraycd
iraycd / Android with Ubuntu
Created April 22, 2013 18:41
Connect an Android 4.0+ phone/tablet to Ubuntu
## Bootstrap for the ubuntu
sudo apt-get install golang fuse git-core libmtp-dev libfuse-dev
sudo adduser $USER fuse
mkdir /tmp/go
GOPATH=/tmp/go go get github.com/hanwen/go-mtpfs
sudo mv /tmp/go/bin/go-mtpfs /usr/bin/
mkdir ~/AndroidPhone
## Mouthing
@mixin box-shadow($top, $left, $blur, $color, $inset: false) {
@if $inset {
-webkit-box-shadow:inset $top $left $blur $color;
-moz-box-shadow:inset $top $left $blur $color;
box-shadow:inset $top $left $blur $color;
} @else {
-webkit-box-shadow: $top $left $blur $color;
-moz-box-shadow: $top $left $blur $color;
box-shadow: $top $left $blur $color;
}
@iraycd
iraycd / ubuntu-installation.sh
Last active January 2, 2016 14:08
My Ubuntu Bootstrap
#Dependencies
sudo add-apt-repository ppa:noobslab/themes #Theme
sudo add-apt-repository ppa:webupd8team/sublime-text-3 #Sublime
#Spotify
sudo apt-add-repository -y "deb http://repository.spotify.com stable non-free"
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 94558F59
##Ubuntu Basic Installation
@iraycd
iraycd / square_image.py
Last active August 29, 2015 13:56
Simple script for making square images.
from PIL import Image,ImageOps
import os
dir = os.listdir('./')
size = (300,300) # To the size 300
for i in dir:
image = Image.open(i)
thumb = ImageOps.fit(image, size, Image.ANTIALIAS)
thumb.save(i)
<link rel="stylesheet" href="http://goratchet.com/dist/ratchet.css" />
<nav class="bar bar-tab">
<a class="tab-item active" href="#">
<span class="icon icon-home"></span>
<span class="tab-label">Home</span>
</a>
<a class="tab-item" href="#">
<span class="icon icon-person"></span>
<span class="tab-label">Profile</span>
</a>
@iraycd
iraycd / breakpoints.scss
Created March 9, 2014 17:19
Max-Points and Min-Points. Foundation Framework
//
// @functions
//
// RANGES
// We use these functions to define ranges for various things, like media queries.
@function lower-bound($range){
@if length($range) <= 0 {
@return 0;