Skip to content

Instantly share code, notes, and snippets.

View sachinkiranti's full-sized avatar
:octocat:
Focusing

Sachin Rai sachinkiranti

:octocat:
Focusing
View GitHub Profile
@rajeshisnepali
rajeshisnepali / setup-project.sh
Last active December 28, 2019 14:00
setup a project (laravel or any php) making serverblock (nginx) after cloning from git.
#!/bin/bash
# version 1.2
### changelog: first ask whether it's a laravel project or not.
# to be able to work this function globally, copy or create link in /usr/local/bin with execute permission (chmod +x)
## Process
# 1. cp .env.example .env
# 2. composer install
# 3. php artisan key:generate
<?php
// === Eloquent Model Filter Function === //
private function filters($query, $request)
{
if ($request->has('user')) {
$query->where('user_id', $request->get('user'))->whereNotNull('text');
//profile - show all except responses without text
} else {
@alexpchin
alexpchin / socket-cheatsheet.js
Created December 15, 2015 16:58
A quick cheatsheet for socket.io
// sending to sender-client only
socket.emit('message', "this is a test");
// sending to all clients, include sender
io.emit('message', "this is a test");
// sending to all clients except sender
socket.broadcast.emit('message', "this is a test");
// sending to all clients in 'game' room(channel) except sender
@Kevinlearynet
Kevinlearynet / Popular Posts This Month
Created October 8, 2012 13:52
Popular Posts Tracking