Skip to content

Instantly share code, notes, and snippets.

shuf -i 79001111111-79999999999 -n 4000000 > 23.txt
@bandicoot86
bandicoot86 / CustomEvent.trigger
Created July 3, 2017 08:05
Trigger for CustomEvent__c
trigger CustomEvent on CustomEvent__c(before insert, before update) {
CustomEventHelper h = new CustomEventHelper();
for (CustomEvent__c e : trigger.new){
if (e.StartDate__c == null || e.EndDate__c == null || (e.EndDate__c.getTime() - e.StartDate__c.getTime()) <=0){
e.addError('Укажите корректные даты (непустые и дата окончания должна быть больше даты начала)');
return;
}
if (!h.timeAv(e.StartDate__c, e.EndDate__c, e.Account__c, e.Id)){
e.addError('Dates are already taken');
@bandicoot86
bandicoot86 / Inventory.trigger
Last active July 3, 2017 08:06
Inventory trigger to fill predefined field from CustomSettings
trigger Inventory on Account(before insert, before update) {
List<Account> newList = trigger.new;
for (Account a : newList){
if (a.Country__c != null && a.AccountNumber != null){
AccountCustomSetting__c s = AccountCustomSetting__c.getValues(a.Country__c);
if (s!= null){
String fieldName = s.Field__c;
a.put(fieldName, a.AccountNumber);
a.AccountNumber = null;
@bandicoot86
bandicoot86 / CustomHelper.cls
Created July 3, 2017 08:06
Custom event helper to do the logic
public class CustomEventHelper {
public Boolean timeAv(DateTime s, DateTime e, Id accId, Id cid) {
Boolean allowed = false;
try {
Long c = [SELECT count() FROM CustomEvent__c WHERE Account__c=:accId
AND
(
(StartDate__c <=:s AND EndDate__c >=:s) OR
(StartDate__c <=:e AND EndDate__c >=:e) OR
public class TestDriveCtrl {
public TestDrive__c drive {get; set;}
public List<SelectOption> makes { get; set; }
public List<SelectOption> models { get; set; }
public String selectedMake { set; get; }
public String selectedModel {get;set;}
public TestDriveCtrl(){
makes = new List<SelectOption>();
models = new List<SelectOption>();
<apex:page controller="TestDriveCtrl">
<script>
window.onload = function() {
console.log('{!$Profile.Name}');
var t = '{!$User.UIThemeDisplayed}';
if ('Theme4t' == t){
alert('Salesforce1');
}
gsettings set org.gnome.settings-daemon.plugins.cursor active false
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.consumiqate.controllers;
import static com.consumiqate.controllers.BasicController.logger;
import com.consumiqate.scheduler.telegram.BotInfoRunnable;
import com.consumiqate.scheduler.telegram.TelegramBotRunnable;
@bandicoot86
bandicoot86 / ThinkLight
Created February 4, 2018 14:33 — forked from vzaliva/ThinkLight
This script controll keyboard backlight on IBM ThinkPad X-series
#!/bin/bash
# Vadim Zaliva [email protected]
# based on https://gist.github.com/hadess/6847281
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
{
"brand": {
"oodji": 69815896,
"Ringspun": 328,
"Replay": 656,
"GIORGIO DI MARE": 328
},
"categories": {
"Для дома": 127,
"Женщинам": 3,