Skip to content

Instantly share code, notes, and snippets.

@ibnmasud
ibnmasud / install NVM and nodeJS.yml
Created June 18, 2023 10:41 — forked from komuw/install NVM and nodeJS.yml
Ansible task to install nvm and nodeJS
#first seen here: http://www.snip2code.com/Snippet/63701/Ansible-task-to-install-nvm-and-node
# Here is how to install nvm and node in an Ansible task.
# I tried a bunch of different things, and as usual it's simple, but you have to get it right.
# The important part is that you have to shell with /bin/bash -c and source nvm.sh
---
- name: Install nvm
shell: >
curl https://raw.githubusercontent.com/creationix/nvm/v0.7.0/install.sh | sh
creates=/home/{{ ansible_user_id }}/.nvm/nvm.sh
@ibnmasud
ibnmasud / Home.tsx
Created March 7, 2022 22:08 — forked from enappd/Home.tsx
Ionic React Capacitor Push Example - Push functions
import React, { useEffect, useState } from 'react';
import { IonContent, IonHeader, IonPage, IonTitle, IonToolbar, IonButton, IonFooter, IonList, IonCard, IonCardContent, IonItem, IonLabel, IonListHeader, IonText, IonButtons, IonMenuButton } from '@ionic/react';
import { PushNotificationSchema, PushNotifications, Token, ActionPerformed } from '@capacitor/push-notifications';
import './Home.css';
import { Toast } from "@capacitor/toast";
export default function PushNotificationsContainer() {
const nullEntry: any[] = []
const [notifications, setnotifications] = useState(nullEntry);
@ibnmasud
ibnmasud / memcached_macosx.md
Created December 30, 2020 15:29 — forked from tomysmile/memcached_macosx.md
Installing memcached on Mac with Homebrew and Lunchy

Installing memcached on Mac with Homebrew and Lunchy

This is a quick guide for installing memcached on a Mac with Homebrew, and starting and stopping it with Lunchy. I hope this tutorial will get your memcached up and running in no time.

Step 1 — Install Homebrew

Installing Homebrew is super easy. Just paste this in your terminal —

$ ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
@ibnmasud
ibnmasud / aws-sns-example.js
Created December 14, 2018 03:46 — forked from tmarshall/aws-sns-example.js
aws-sdk sns example, in Node.js
var AWS = require('aws-sdk');
AWS.config.update({
accessKeyId: '{AWS_KEY}',
secretAccessKey: '{AWS_SECRET}',
region: '{SNS_REGION}'
});
var sns = new AWS.SNS();
@ibnmasud
ibnmasud / slugify.js
Created April 1, 2018 03:01 — forked from mathewbyrne/slugify.js
Javascript Slugify
function slugify(text)
{
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}
@ibnmasud
ibnmasud / install.rb
Created September 15, 2016 14:52 — forked from skyl/install.rb
Homebrew without sudo
#!/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby
# SET YOUR_HOME TO THE ABSOLUTE PATH OF YOUR HOME DIRECTORY
# chmod +x install.rb
# ./install.rb
YOUR_HOME = ''
HOMEBREW_PREFIX = "#{YOUR_HOME}/usr/local"
HOMEBREW_CACHE = '/Library/Caches/Homebrew'
HOMEBREW_REPO = 'https://github.com/Homebrew/homebrew'
@ibnmasud
ibnmasud / baseConverter.js
Created September 7, 2016 15:56 — forked from faisalman/baseConverter.js
Convert From/To Binary/Decimal/Hexadecimal in JavaScript
/**
* Convert From/To Binary/Decimal/Hexadecimal in JavaScript
* https://gist.github.com/faisalman
*
* Copyright 2012-2015, Faisalman <fyzlman@gmail.com>
* Licensed under The MIT License
* http://www.opensource.org/licenses/mit-license
*/
(function(){