Skip to content

Instantly share code, notes, and snippets.

View lin's full-sized avatar

Albert Lin lin

View GitHub Profile
@lin
lin / shorthands.php
Created June 20, 2014 18:14
shorthand codes for php
<div>
<p><?=$username?>
</div>
@lin
lin / gist:47c2c3b8e199c56bc610
Created June 20, 2014 21:23
Bootstrap Related resources
1, bootswatch
@lin
lin / header.html
Last active August 29, 2015 14:04
Page loader
<!-- begin #page-loader -->
<div id="page-loader" class="fade in"><span class="spinner"></span></div>
<script>
$(document).ready(function(){
$.when($("#page-loader").addClass("hide")).done(function () {
$(".page-container").addClass("in")
})
});
</script>
<!-- end #page-loader -->
path:
C:\windows\system32\drivers\etc\hosts
add:
127.0.0.1 popshop.local
path:
C:\xampp\apache\conf\extra\httpd-vhosts.conf
add:
@lin
lin / basic.rb
Last active August 29, 2015 14:07
Cheatsheet for Ruby on Rails
##CRUD##
#create
Human.create
#read
Human.find(2)
Human.first
Human.last
human.name
“Focus on the user and all else will follow.”
@lin
lin / decode_json_url.php
Created October 17, 2014 18:48
php decode json to array from url
<?php
$string = file_get_contents("https://www.googleapis.com/customsearch/v1?key=AIzaSyC2seiP3CUr3NK77OzvtzsXO_Q9RyVqogk&cx=011630460259922505622:k84o2c59sea&num=1&alt=json&q=Alice%20and%20Olivia%20brand%20logo&searchType=image");
$json = json_decode($string, true);
echo $json['items'][0]['image']['thumbnailLink'];
?>
@lin
lin / svgtopng.html
Last active August 29, 2015 14:07
convert svg to png through browser
<!DOCTYPE html>
<meta charset="utf-8">
<canvas></canvas>
<script>
var canvas = document.querySelector("canvas"),
context = canvas.getContext("2d");
var image = new Image;
image.src = "math.svg";
$cd
$ls
$ls -a
$pwd
$mkdir
$rm
$rm -r
$php file_name.php
@lin
lin / cheetsheet.rb
Last active August 29, 2015 14:07
Ruby Cheatsheet
#string
str = "str #{placeholder}"
str.length
str = str + "concatenate"
"albert".gsub("al", "ro") #replace
str[3]
#array
arr = ["alb", "ert", 25]
arr.size