Skip to content

Instantly share code, notes, and snippets.

View MistrySaurabh's full-sized avatar
😊
Tea & Coding

Saurabh Mistry MistrySaurabh

😊
Tea & Coding
View GitHub Profile
@akexorcist
akexorcist / index.js
Last active November 17, 2022 11:25
Axios post method requesting with x-www-form-urlencoded content type. See https://axios-http.com/docs/urlencoded
const axios = require('axios')
/* ... */
const params = new URLSearchParams()
params.append('name', 'Akexorcist')
params.append('age', '28')
params.append('position', 'Android Developer')
params.append('description', 'birthdate=25-12-1989&favourite=coding%20coding%20and%20coding&company=Nextzy%20Technologies&website=http://www.akexorcist.com/')
params.append('awesome', true)
@zcaceres
zcaceres / Include-in-Sequelize.md
Last active January 8, 2024 07:14
using Include in sequelize

'Include' in Sequelize: The One Confusing Query That You Should Memorize

When querying your database in Sequelize, you'll often want data associated with a particular model which isn't in the model's table directly. This data is usually typically associated through join tables (e.g. a 'hasMany' or 'belongsToMany' association), or a foreign key (e.g. a 'hasOne' or 'belongsTo' association).

When you query, you'll receive just the rows you've looked for. With eager loading, you'll also get any associated data. For some reason, I can never remember the proper way to do eager loading when writing my Sequelize queries. I've seen others struggle with the same thing.

Eager loading is confusing because the 'include' that is uses has unfamiliar fields is set in an array rather than just an object.

So let's go through the one query that's worth memorizing to handle your eager loading.

The Basic Query

@SaeedPrez
SaeedPrez / LoginController.php
Created March 12, 2017 16:42
Laravel 5.4 Additional Login Conditions - Add custom error message.
<?php
// This is code to return custom error message
// for Youtube tutorial: Laravel 5.4 Additional Login Conditions
// https://www.youtube.com/watch?v=Z8s6uhhD1Pk
namespace App\Http\Controllers\Auth;
<?php
/**
* Description of VideoStream
*
* @author Rana
* @link http://codesamplez.com/programming/php-html5-video-streaming-tutorial
*/
class VideoStream
{
private $path = "";
@vluzrmos
vluzrmos / App_Http_VideoStream.php
Last active February 14, 2024 22:00
Laravel VideoStream.
<?php
namespace App\Http;
/**
* Description of VideoStream
*
* @author Rana
* @link https://gist.github.com/vluzrmos/d5682ad426525196d069
*/
@CrookedNumber
CrookedNumber / gist:8964442
Created February 12, 2014 21:02
git: Removing the last commit

Removing the last commit

To remove the last commit from git, you can simply run git reset --hard HEAD^ If you are removing multiple commits from the top, you can run git reset --hard HEAD~2 to remove the last two commits. You can increase the number to remove even more commits.

If you want to "uncommit" the commits, but keep the changes around for reworking, remove the "--hard": git reset HEAD^ which will evict the commits from the branch and from the index, but leave the working tree around.

If you want to save the commits on a new branch name, then run git branch newbranchname before doing the git reset.

@VenomVendor
VenomVendor / Device Details
Created April 18, 2013 20:20
Get Device Details in Android Programmatically.
String details = "VERSION.RELEASE : "+Build.VERSION.RELEASE
+"\nVERSION.INCREMENTAL : "+Build.VERSION.INCREMENTAL
+"\nVERSION.SDK.NUMBER : "+Build.VERSION.SDK_INT
+"\nBOARD : "+Build.BOARD
+"\nBOOTLOADER : "+Build.BOOTLOADER
+"\nBRAND : "+Build.BRAND
+"\nCPU_ABI : "+Build.CPU_ABI
+"\nCPU_ABI2 : "+Build.CPU_ABI2
+"\nDISPLAY : "+Build.DISPLAY
+"\nFINGERPRINT : "+Build.FINGERPRINT