Skip to content

Instantly share code, notes, and snippets.

View n0m4dz's full-sized avatar

Tseegii Tselmeg n0m4dz

View GitHub Profile
@n0m4dz
n0m4dz / _ide_helper.php
Created March 12, 2017 07:55 — forked from barryvdh/_ide_helper.php
Laravel IDE Helper for Netbeans / PhpStorm / Sublime Text 2 CodeIntel, generated using https://github.com/barryvdh/laravel-ide-helper
<?php
/**
* A helper file for Laravel 5, to provide autocomplete information to your IDE
* Generated for Laravel 5.4.11 on 2017-02-14.
*
* @author Barry vd. Heuvel <barryvdh@gmail.com>
* @see https://github.com/barryvdh/laravel-ide-helper
*/
namespace {
exit("This file should not be included, only analyzed by your IDE");
@n0m4dz
n0m4dz / stream.js
Created March 2, 2017 05:07 — forked from padenot/stream.js
How to serve media on node.js
var http = require('http');
var path = require('path');
var fs = require('fs');
var AUDIOFILE = "./audio.ogg";
function serveWithRanges(request, response, content) {
var range = request.headers.range;
var total = content.length;
var parts = range.replace(/bytes=/, "").split("-");
package main
import (
"database/sql"
"fmt"
"log"
_ "github.com/go-sql-driver/mysql"
"github.com/gocraft/dbr"
)
@n0m4dz
n0m4dz / Map-Filter.js
Last active November 9, 2016 12:40
Map and Filter in ES6
function map(objList){
var newArr = [];
objList.foreach(function(obj){
if(obj.id == 1){
obj.job = 'New job';
}
newArr.push(obj);
})
return newArr;
}
@n0m4dz
n0m4dz / BlogController.php
Created October 31, 2016 06:04 — forked from tobysteward/BlogController.php
Laravel AJAX Pagination with JQuery
<?php
class BlogController extends Controller
{
/**
* Posts
*
* @return void
*/
public function showPosts()
@n0m4dz
n0m4dz / mocha-guide-to-testing.js
Created September 1, 2016 23:45 — forked from samwize/mocha-guide-to-testing.js
Explain Mocha's testing framework - describe(), it() and before()/etc hooks
// # Mocha Guide to Testing
// Objective is to explain describe(), it(), and before()/etc hooks
// 1. `describe()` is merely for grouping, which you can nest as deep
// 2. `it()` is a test case
// 3. `before()`, `beforeEach()`, `after()`, `afterEach()` are hooks to run
// before/after first/each it() or describe().
//
// Which means, `before()` is run before first it()/describe()
@n0m4dz
n0m4dz / lopmonhoc.js.jsx
Created August 30, 2016 12:59 — forked from revskill10/lopmonhoc.js.jsx
Integrate Datatable with React.js
/** @jsx React.DOM */
var LopMonHoc = React.createClass({
getInitialState: function(){
return {data: []}
},
loadData: function(){
$.ajax({
url: '/daotao/lops',
success: function(data){
@n0m4dz
n0m4dz / react-with-routing.js
Created August 8, 2016 11:30 — forked from jaysoo/react-with-routing.js
React structure with routing
/*
* This file contains JS modules for a React app using react-router and redux.
* Each module should be in its own separate file, but for the purposes of
* this gist, I've inlined them all.
*/
/* app/index.js */
import React from 'react'
import { Router, browserHistory } from 'react-router'
@n0m4dz
n0m4dz / README.md
Created July 14, 2016 12:13 — forked from denji/README.md
Remove settings and cli-links WebStorm; PhpStorm, PyCharm, RubyMine, AppCode, CLion, IntelliJ, 0xDBE10, Rider (OS X & macOS)

Quick uninstall JetBrains settings:

curl -sL https://gist.github.com/denji/9731967/raw/jetbrains-uninstall.sh | bash -s

Quick backup JetBrains settings:

curl -sL https://gist.github.com/denji/9731967/raw/jetbrains-backup.sh | bash -s
@n0m4dz
n0m4dz / chruby_ruby-build.sh
Created May 20, 2016 14:30 — forked from havenwood/chruby_ruby-build.sh
On Debian, Ubuntu, or Mint: install Ruby with chruby and ruby-build
# Install apt-get packages:
sudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config
# Install chruby:
cd
wget https://github.com/downloads/postmodern/chruby/chruby-0.2.3.tar.gz
tar -xzvf chruby-0.2.3.tar.gz
cd chruby-0.2.3
sudo make install