Skip to content

Instantly share code, notes, and snippets.

let express = require ('express');
let express_graphql = require('express-graphql');
let {buildSchema} = require ('graphql');
//GraphQL schema
var schema = buildSchema (`
type Query {
course(id: Int!): Course
courses(topic: String): [Course]
let express = require ('express');
let express_graphql = require('express-graphql');
let {buildSchema} = require ('graphql');
//GraphQL schema
var schema = buildSchema (`
type Query {
message : String
}
<aura:component>
<!--- Your component -->
</aura:component>
/*Source :
https://gomakethings.com/getting-all-query-string-values-from-a-url-with-vanilla-js/
*/
/* @param {String} url The URL
* @return {Object} The URL parameters
*/
var getParams = function (url) {
var params = {};
var parser = document.createElement('a');
public class DynamicTabsCntl {
@AuraEnabled
public static List< foolish__TabsOnLightningComponent__mdt > getData () {
return [SELECT Id, foolish__ComponentName__c , DeveloperName, MasterLabel, foolish__IsActive__c ,foolish__Params__c
FROM foolish__TabsOnLightningComponent__mdt WHERE foolish__IsActive__c = true];
}
}
<!-- TestWsCallout.page -->
<apex:page controller="TestWsCallout" tabstyle="Account">
<apex:form >
<apex:actionFunction action="{!InsertRecord}" name="InsertRecord_JS" Rerender="statuses" status="Status1" oncomplete="CallWebService_JS();"/>
<apex:actionFunction action="{!CallWebService}" name="CallWebService_JS" status="Status2" reRender="statuses, msg"/>
<apex:outputPanel id="statuses">
<apex:actionStatus id="Status1" startText="...Inserting Record Into DB..." />
<apex:actionStatus id="Status2" startText="...Calling Web Service..." />
</apex:outputPanel>
@sudikrt
sudikrt / EmailValidator.kt
Created May 13, 2018 08:54 — forked from ironic-name/EmailValidator.kt
Kotlin regex email validator function
fun isEmailValid(email: String): Boolean {
return Pattern.compile(
"^(([\\w-]+\\.)+[\\w-]+|([a-zA-Z]|[\\w-]{2,}))@"
+ "((([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\.([0-1]?"
+ "[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\."
+ "([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\.([0-1]?"
+ "[0-9]{1,2}|25[0-5]|2[0-4][0-9]))|"
+ "([a-zA-Z]+[\\w-]+\\.)+[a-zA-Z]{2,4})$"
).matcher(email).matches()
}
#table-wrapper {
position:relative;
}
#table-scroll {
height:150px;
overflow:auto;
margin-top:20px;
}
#table-wrapper table {
width:100%;
@sudikrt
sudikrt / facebook--posts-deleter-2016-firefox-greasemonkey.js
Created November 25, 2017 03:46 — forked from vsubhash/com.vsubhash.js.facebook-posts-deleter
"Facebook Posts Deleter 2016" script is a Greasemonkey JavaScript that will automatically delete Facebook posts one by one without any user intervention. Install this script in Firefox using the Greasemonkey add-on. Then, go to your "Activity Log" and click on the "Delete Facebook Posts" that pops on the top-left.
// ==UserScript==
// @name Facebook Posts Deleter 2016
// @namespace com.vsubhash.js.facebook_posts_deleter.2016
// @description Automatically deletes posts from Activity Log of Facebook, one by one.
// @include https://www.facebook.com/*=allactivity
// @version 1
// @grant none
// ==/UserScript==
document.addEventListener("DOMContentLoaded",
Http http = new Http ();
HttpRequest req = new HttpRequest ();
req.setEndPoint ('https://th-apex-http-callout.herokuapp.com/animals');
req.setMethod ('POST');
req.setHeader ('Content-Type', 'application/json;charset=UTF-8');
req.setBody ('{"name":"mighty moose _1"}');
HttpResponse response = http.send(req);
if (response.getStatusCode() != 201) {
System.debug('The status code returned was not expected: ' +
response.getStatusCode() + ' ' + response.getStatus());