Skip to content

Instantly share code, notes, and snippets.

View n3tr's full-sized avatar

Jirat Ki. n3tr

View GitHub Profile
@n3tr
n3tr / 1.Gemfile
Created February 15, 2012 04:22 — forked from nicalpi/1.Gemfile
Creates easy shorten UUID in your RAILS APP
## See http://
gem 'base32-crockford', :require => 'base32/crockford'
@n3tr
n3tr / gist:2179123
Created March 24, 2012 06:44
Get Query String from URI
function getQuerystring(uri, key, default_)
{
if (default_==null) default_="";
key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
var qs = regex.exec(uri);
if(qs == null)
return default_;
else
return qs[1];
@n3tr
n3tr / f3-split-button.html
Created June 23, 2012 17:31 — forked from smileyj68/f3-split-button.html
Foundation 3 Split Button
<div href="#" class="large alert button split dropdown">
<a href="#">Split Button</a>
<span></span>
<ul>
<li><a href="#">Dropdown Item</a></li>
<li><a href="#">Another Dropdown Item</a></li>
<li class="divider"></li>
<li><a href="#">Last Item</a></li>
</ul>
</div>
<table>
<caption>Caption</caption>
<thead>
<tr>
<th>Code</th>
<th>Title</th>
<th>Credit</th>
<th>Description</th>
</tr>
</thead>
<?php
function rrmdir($dir) {
if (is_dir($dir)) {
$objects = scandir($dir);
foreach ($objects as $object) {
if ($object != "." && $object != "..") {
if (filetype($dir."/".$object) == "dir") rrmdir($dir."/".$object); else unlink($dir."/".$object);
}
}
reset($objects);
@n3tr
n3tr / gist:5128645
Last active December 14, 2015 18:19
public function get_generate(){
$usermapping = Usermapping::with(array('course_mapping'))->where('user_id','=',Auth::user()->id)->get();
$credit_local = 0;
$credit_inter = 0;
foreach ($usermapping as $mapping) {
$credit_local += $mapping->course_mapping->localcourse->credit;
$credit = $mapping->course_mapping->intercourse->intercoursedetail[0]->credit;
$credit_inter += $credit;
for (var i = minSqr; sum < max; i++) {
if (i.toString() != reverse(i.toString())) continue;
sum = i*i;
if(sum > min && sum < max )
{
sumStr = sum.toString();
if (sumStr == reverse(sumStr)) {
palindromeCount++;
@n3tr
n3tr / gist:8395947
Last active January 3, 2016 02:29 — forked from schacon/gist:942899
Remove all merged (into develop) remote branches from remote
$ git branch -r --merged |
grep origin |
grep -v '>' |
grep -v develop |
xargs -L1 |
awk '{split($0,a,"origin/"); print a[2]}' |
xargs git push origin --delete
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "Point",
"coordinates": [
100.52144765853882,
@n3tr
n3tr / setup.sh
Created February 13, 2016 22:46
Install Spark + Zeppelin on EC2
# scala install
wget www.scala-lang.org/files/archive/scala-2.11.7.deb
sudo dpkg -i scala-2.11.7.deb
# sbt installation
echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 642AC823
sudo apt-get update
sudo apt-get install sbt