Skip to content

Instantly share code, notes, and snippets.

View ajingopi-bridge's full-sized avatar
🎯
Focusing

ajingopi-bridge

🎯
Focusing
View GitHub Profile
//settings.json.config file
//... Rest of file
"emeraldwalk.runonsave": {
"commands": [
{
"match": "\\.pug$",
"cmd": "pug ./ --doctype html --pretty"
},
{
@DawidMyslak
DawidMyslak / vue.md
Last active April 22, 2024 12:49
Vue.js and Vuex - best practices for managing your state

Vue.js and Vuex - best practices for managing your state

Modifying state object

Example

If you have to extend an existing object with additional property, always prefer Vue.set() over Object.assign() (or spread operator).

Example below explains implications for different implementations.

@jwilson8767
jwilson8767 / es6-element-ready.js
Last active April 22, 2024 20:28
Wait for an element to exist. ES6, Promise, MutationObserver
// MIT Licensed
// Author: jwilson8767
/**
* Waits for an element satisfying selector to exist, then resolves promise with the element.
* Useful for resolving race conditions.
*
* @param selector
* @returns {Promise}
*/
@scottopolis
scottopolis / splice-object-array.js
Last active January 31, 2023 06:54
Remove object from array of objects in Javascript
// we have an array of objects, we want to remove one object using only the id property
const apps = [{id:34,name:'My App',another:'thing'},{id:37,name:'My New App',another:'things'}];
// get index of object with id of 37
const removeIndex = apps.findIndex( item => item.id === 37 );
// remove object
apps.splice( removeIndex, 1 );
@adhithyan15
adhithyan15 / countdown.js
Last active May 10, 2024 09:35
A simple countdown timer in Javascript
/********************************************************************************************************************
Countdown.js is a simple script to add a countdown timer
for your website. Currently it can only do full minutes
and partial minutes aren't supported. This script is a fork of http://jsfiddle.net/HRrYG/ with some
added extensions. Since the original code that I forked was released under Creative Commons by SA license,
I have to release this code under the same license. You can view a live demo of this code at http://jsfiddle.net/JmrQE/2/.
********************************************************************************************************************/
function countdown(minutes) {
var seconds = 60;
var mins = minutes
@bulkan
bulkan / gist:4221633
Created December 6, 2012 03:48
How To Create a Django MultiWidget

What are MultiWidgets ?

A MultiWidget is a widget that contains more than one widget and bundles it into one. Sometimes you require two or more inputs from the user where the data is not mutually exclusive. For example the expiry date on a credit card or a phone number with the area code.

This blog post will show and explain how to create a MultiWidget for an expiry date that accepts a month and a year.

I heard you like Widgets so I put a Widget into your Widget so you can Widget

Creating a MultiWidget is similar to creating a custom Widget. Here is the code for an expiry date multiwidget that accepts two values the month and year that a credit card expires.

@ksafranski
ksafranski / Common-Currency.json
Last active June 12, 2024 16:45
Common Currency Codes in JSON
{
"USD": {
"symbol": "$",
"name": "US Dollar",
"symbol_native": "$",
"decimal_digits": 2,
"rounding": 0,
"code": "USD",
"name_plural": "US dollars"
},